Skip to content

Commit 406004e

Browse files
author
Josh Goldberg
committed
Added remaining tests
1 parent 7d904d6 commit 406004e

5 files changed

+66
-2
lines changed

cypress/integration/number_statistics_spec.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
describe("2. Number Statistics", () => {
2+
beforeEach(() => {
3+
cy.visit("./numberStatistics.html");
4+
});
5+
26
const inputValues = (...values) => {
37
for (const value of values) {
48
cy.get("#number-statistics-number-input")
9+
.clear()
510
.type(`${value}`)
611
.get("#number-statistics-form button")
712
.click();
@@ -24,6 +29,6 @@ describe("2. Number Statistics", () => {
2429

2530
it("displays maximum and minimum in the paragraphs when multiple numbers are entered", () => {
2631
inputValues(7, 14, 42);
27-
expectStatistics(21, 42, 14);
32+
expectStatistics(21, 42, 7);
2833
});
2934
});

cypress/integration/star_wars_spec.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const expected = [
2+
'Alderaan (pop. 2000000000)',
3+
'Yavin IV (pop. 1000)',
4+
'Hoth (pop. unknown)',
5+
'Dagobah (pop. unknown)',
6+
'Bespin (pop. 6000000)',
7+
'Endor (pop. 30000000)',
8+
'Naboo (pop. 4500000000)',
9+
'Coruscant (pop. 1000000000000)',
10+
'Kamino (pop. 1000000000)',
11+
'Geonosis (pop. 100000000000)',
12+
];
13+
14+
describe("4. Star Wars", () => {
15+
it("contains the expected users", () => {
16+
cy.visit("./starWars.html");
17+
18+
cy.get("#planets-list li")
19+
.should("have.length", expected.length)
20+
.each((item, index) => expect(item).to.contain(expected[index]));
21+
});
22+
});
23+

cypress/integration/text_duplicator_spec.js

+14
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
describe("1. Text Duplicator", () => {
22
for (let i = 1; i <= 5; i += 1) {
33
it(`duplicates text when the input is ${i}`, () => {
4+
cy.visit("./textDuplicator.html");
5+
46
cy.get("#text-duplicator-string-input")
7+
.clear()
58
.type("Hello world!")
69
.get("#text-duplicator-number-input")
10+
.clear()
711
.type(`${i}`)
12+
.get("#text-duplicator-form button")
13+
.click()
814
.get("#text-duplicator-list li")
915
.should("have.length", i)
16+
.each((item) => expect(item).to.contain("Hello world!"))
17+
.get("#text-duplicator-number-input")
18+
.clear()
19+
.type('3')
20+
.get("#text-duplicator-form button")
21+
.click()
22+
.get("#text-duplicator-list li")
23+
.should("have.length", i + 3)
1024
.each((item) => expect(item).to.contain("Hello world!"));
1125
});
1226
}

cypress/integration/user_list_spec.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const expected = [
2+
"ruth nicolas (CH)",
3+
"رها سلطانی نژاد (IR)",
4+
"patricia hale (GB)",
5+
"fernando cooper (US)",
6+
"یسنا صدر (IR)",
7+
"eino tuomala (FI)",
8+
"gonca özkara (TR)",
9+
"kyle castillo (US)",
10+
"olivia kumar (NZ)",
11+
"raymond durand (CH)",
12+
];
13+
14+
describe("3. User List", () => {
15+
it("contains the expected users", () => {
16+
cy.visit("./userList.html");
17+
18+
cy.get("#user-list li")
19+
.should("have.length", expected.length)
20+
.each((item, index) => expect(item).to.contain(expected[index]));
21+
});
22+
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "[![Pursuit Logo](https://avatars1.githubusercontent.com/u/5825944?s=200&v=4)](https://pursuit.org)",
55
"main": "index.js",
66
"scripts": {
7-
"test": "cypress open"
7+
"test": "./node_modules/.bin/cypress open"
88
},
99
"repository": {
1010
"type": "git",

0 commit comments

Comments
 (0)