-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
50 lines (39 loc) · 2.21 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const assert = require("assert");
const reduxReselectCucumber = require("./reduxReselectCucumber.js");
const newOrderTests = require("./src/newOrder/test/index.js");
const stateTests = require("./src/state/test/index.js");
const storeCreator = require("./src/state/store.js");
const initialState = require("./src/state/initialState.js");
const { NewOrderSelector } = require("./src/newOrder/selector.js");
console.log("hello payserver tests");
// describe('Selectors', () => {
// it('you can change the name of a sandwich', () => {
// const store = storeCreator(initialState);
// const sandwichName = "The new name of a sandwich";
// store.dispatch({ type: "CHANGE_STAGED_SANDWICH_NAME", payload: sandwichName })
// assert.equal(NewOrderSelector(store.getState()).stagedSandwich, sandwichName);
// });
// it('you can add sandwiches', () => {
// const store = storeCreator(initialState);
// const sandwichName = "The new name of a sandwich";
// assert.equal(NewOrderSelector(store.getState()).sandwiches.length, 0);
// store.dispatch({ type: "CHANGE_STAGED_SANDWICH_NAME", payload: sandwichName })
// store.dispatch({ type: "ADD_SANDWICH" })
// assert.equal(NewOrderSelector(store.getState()).sandwiches.length, 1);
// store.dispatch({ type: "ADD_SANDWICH" })
// store.dispatch({ type: "ADD_SANDWICH" })
// assert.equal(NewOrderSelector(store.getState()).sandwiches.length, 3);
// });
// it('you compute the cost of a sandwich', () => {
// const store = storeCreator(initialState);
// const sandwichName = "The new name of a sandwich";
// assert.equal(NewOrderSelector(store.getState()).sandwiches.length, 0);
// store.dispatch({ type: "CHANGE_STAGED_SANDWICH_NAME", payload: sandwichName })
// store.dispatch({ type: "ADD_SANDWICH" })
// store.dispatch({ type: "SELECT_INGREDIENT_TO_PUSH", payload: { sandwichName: sandwichName, ingredientId: 5 } })
// store.dispatch({ type: "PUSH_INGREDIENT", payload: 0 })
// assert.equal(NewOrderSelector(store.getState()).sandwiches[0].cost, 5);
// });
// });
// we can also do cucumber-ish tests combining a component's and it's associated state's test configurations
reduxReselectCucumber(newOrderTests, stateTests)