Skip to content

Commit 7bf1c6b

Browse files
committed
Test
Type: Test
1 parent d5ea0a4 commit 7bf1c6b

File tree

13 files changed

+4460
-459
lines changed

13 files changed

+4460
-459
lines changed

__test__/client_daysTillTrip.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Import the js file to test
2+
import { daysTillTrip } from "../src/client/js/daysTillTrip"
3+
4+
describe("Testing the generation of days indication", () => {
5+
test("Testing the formCheck() function with an empty object response", () => {
6+
// Define the input for the function, if any, in the form of variables/array
7+
const input = "None Selected";
8+
// Define the expected output, if any, in the form of variables/array
9+
// The expect() function, in combination with a Jest matcher, is used to check if the function produces the expected output
10+
// The general syntax is `expect(myFunction(arg1, arg2, ...)).toEqual(expectedValue);`, where `toEqual()` is a matcher
11+
expect(daysTillTrip(input)).toBe(0);
12+
}
13+
);
14+
test("Testing the formCheck() function with the date 2029/12/31", () => {
15+
// Define the input for the function, if any, in the form of variables/array
16+
const input = "2029/12/31";
17+
// Define the expected output, if any, in the form of variables/array
18+
// The expect() function, in combination with a Jest matcher, is used to check if the function produces the expected output
19+
// The general syntax is `expect(myFunction(arg1, arg2, ...)).toEqual(expectedValue);`, where `toEqual()` is a matcher
20+
expect(daysTillTrip(input)).toBeGreaterThan(0);
21+
}
22+
);
23+
}
24+
);

__test__/client_formCheck.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Import the js file to test
2+
import { formCheck } from "../src/client/js/formCheck"
3+
4+
describe("Testing whether the fields are filled out correctly", () => {
5+
test("Testing the formCheck() function", () => {
6+
// Define the input for the function, if any, in the form of variables/array
7+
const input = "";
8+
// Define the expected output, if any, in the form of variables/array
9+
// The expect() function, in combination with a Jest matcher, is used to check if the function produces the expected output
10+
// The general syntax is `expect(myFunction(arg1, arg2, ...)).toEqual(expectedValue);`, where `toEqual()` is a matcher
11+
expect(formCheck(input)).toBeTruthy();
12+
})});

__test__/server_consultTrip.test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Import the js file to test
2+
//import { consultTrip } from "../src/server/consultTrip"
3+
4+
// --------------------------------consultTrip-------------------------------------
5+
// Import function from another js file in the same folder
6+
let consultTrip = require('./src/server/consultTrip.js');
7+
8+
9+
describe("Testing the consultTrip request sent from the client side to the server", () => {
10+
test("Testing the consultTrip() function with a prepared object request", () => {
11+
// Define the input for the function, if any, in the form of variables/array
12+
const input = {
13+
"tripId":"1"
14+
};
15+
16+
// Variables referred to during the test
17+
const savedTrips = {
18+
"1": {
19+
"test": "object"
20+
}
21+
};
22+
23+
// Define the expected output, if any, in the form of variables/array
24+
const output = {
25+
"1": {
26+
"test": "object"
27+
}
28+
};
29+
30+
// The expect() function, in combination with a Jest matcher, is used to check if the function produces the expected output
31+
// The general syntax is `expect(myFunction(arg1, arg2, ...)).toEqual(expectedValue);`, where `toEqual()` is a matcher
32+
expect(consultTrip(input)).toMatchObject(output);
33+
}
34+
);
35+
}
36+
);

documentation/UDACITY_Project_Rubric.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,63 +40,63 @@ The project should have a structure like the one shown below. All files shown mu
4040

4141
### Usability
4242

43-
-[] All features are usable across modern desktop and phone browsers.
44-
-[] Ensure the HTML elements, eg. texts and buttons, are proportionate and readable in small screen devices.
43+
-[x] All features are usable across modern desktop and phone browsers.
44+
-[x] Ensure the HTML elements, eg. texts and buttons, are proportionate and readable in small screen devices.
4545

4646
### Styling
4747

48-
-[] Styling is set up in a logical way.
49-
-[] All interactive elements have hover states.
48+
-[x] Styling is set up in a logical way.
49+
-[x] All interactive elements have hover states.
5050

5151
### HTML Structure
5252

53-
-[] HTML structure should be indented properly with classes and ID’s that make sense.
53+
-[x] HTML structure should be indented properly with classes and ID’s that make sense.
5454

5555
### Visual Design
5656

57-
-[] The design should clearly be different from the design used in projects 3 and 4.
57+
-[x] The design should clearly be different from the design used in projects 3 and 4.
5858

5959
## API and JS Integration
6060

6161
---
6262

6363
### src > server > server.js
6464

65-
-[] server.js file should be taken directly from passed project 3 with the addition of added member: value pairs and the required API keys.
65+
-[x] server.js file should be taken directly from passed project 3 with the addition of added member: value pairs and the required API keys.
6666

6767
### index.js
6868

69-
-[] src > client > index.js
70-
-[] At least one function should be imported.
69+
-[x] src > client > index.js
70+
-[x] At least one function should be imported.
7171
-[] At least one event listener should be imported.
7272
(styles referenced in html/css)
7373

7474
### app.js
7575

76-
-[] src > client > js > app.js
77-
-[] There should be URLS and API Keys for at least 3 APIs, including Geonames, Weatherbit, and Pixabay. You can feel free to use more than 3 APIs.
78-
-[] There should be a primary object with placeholder member value pairs.
79-
-[] There should be a primary function that is exported to index.js (index.js file should import the functions from other files).
76+
-[x] src > client > js > app.js
77+
-[x] There should be URLS and API Keys for at least 3 APIs, including Geonames, Weatherbit, and Pixabay. You can feel free to use more than 3 APIs.
78+
-[x] There should be a primary object with placeholder member value pairs.
79+
-[x] There should be a primary function that is exported to index.js (index.js file should import the functions from other files).
8080

8181
## Documentation
8282

8383
---
8484

8585
### README
8686

87-
-[] A README file is included detailing the app and all dependencies.
87+
-[x] A README file is included detailing the app and all dependencies.
8888

8989
#### Other requirements
9090

9191
-[x] The Readme file should have non-default text in it that is specific to this project. It doesn’t have to be thorough, but should have some basic info. Bonus points if correct markdown is used.
9292

9393
### Comments
9494

95-
-[] Comments are present and effectively explain longer code procedure when necessary.
95+
-[x] Comments are present and effectively explain longer code procedure when necessary.
9696

9797
### Code Quality
9898

99-
-[] Code is formatted with consistent, logical, and easy-to-read formatting as described in the Udacity JavaScript Style Guide.
99+
-[x] Code is formatted with consistent, logical, and easy-to-read formatting as described in the Udacity JavaScript Style Guide.
100100

101101
## Suggestions to Make Your Project Stand Out!
102102

@@ -108,7 +108,7 @@ At least one of these is required, but the rest are great additional ways to fur
108108
-[] Pull in an image for the country from Pixabay API when the entered location brings up no results (good for obscure localities).
109109
-[] Allow user to add multiple destinations on the same trip.
110110
-[] Pull in weather for additional locations.
111-
-[] Allow the user to add hotel and/or flight data.
111+
-[x] Allow the user to add hotel and/or flight data.
112112
-[] Multiple places to stay? Multiple flights?
113113
-[] Integrate the REST Countries API to pull in data for the country - being visited.
114114
-[] Allow the user to remove the trip.
@@ -117,6 +117,6 @@ At least one of these is required, but the rest are great additional ways to fur
117117
-[] Incorporate icons into forecast.
118118
-[] Allow user to Print their trip and/or export to PDF.
119119
-[] Allow the user to add a todo list and/or packing list for their trip.
120-
-[] Allow the user to add additional trips (this may take some heavy reworking, but is worth the challenge).
120+
-[x] Allow the user to add additional trips (this may take some heavy reworking, but is worth the challenge).
121121
-[] Automatically sort additional trips by countdown.
122122
-[] Move expired trips to bottom/have their style change so it’s clear it’s expired.

0 commit comments

Comments
 (0)