Skip to content

Commit

Permalink
refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Jun 2, 2018
1 parent 36611f1 commit f7ba5e1
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions samples/universal-react-node/_test_/client/components/home.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,25 @@ describe("Home", () => {

it("has 8 items on menu", () => {
expect(component.find("li").length).toEqual(8);

const item1 = "CSRF protection using electrode-csrf-jwt";
const item2 = "Above the Fold Render with skip=true - increase your App's performance by using a skip prop";
const item3 = "Above the Fold Render with skip=false - increase your App's performance by using a skip prop";
const item4 = "SSR Caching Simple Type Example";
const item5 = "SSR Caching Template Type Example";
const item6 = "Push Notifications Example";
const item7 = "Todo List Example";
const item8 = "MongoDB Example";

expect(component.find("li").at(0).text()).toEqual(item1);
expect(component.find("li").at(1).text()).toEqual(item2);
expect(component.find("li").at(2).text()).toEqual(item3);
expect(component.find("li").at(3).text()).toEqual(item4);
expect(component.find("li").at(4).text()).toEqual(item5);
expect(component.find("li").at(5).text()).toEqual(item6);
expect(component.find("li").at(6).text()).toEqual(item7);
expect(component.find("li").at(7).text()).toEqual(item8);

const items = [
"CSRF protection using electrode-csrf-jwt",
"Above the Fold Render with skip=true - increase your App's performance by using a skip prop",
"Above the Fold Render with skip=false - increase your App's performance by using a skip prop",
"SSR Caching Simple Type Example",
"SSR Caching Template Type Example",
"Push Notifications Example",
"Todo List Example",
"MongoDB Example"
];

for (let x = 0; x < 8; x++) {
expect(
component
.find("li")
.at(x)
.text()
).toEqual(items[x]);
}
});
});

0 comments on commit f7ba5e1

Please sign in to comment.