Commit be17b27d1ff6966e3d7d922f5e612f4d2477dce4
Adds failing test.
Piet Geursen committed on 3/8/2018, 10:57:49 PMParent: 829c28e4dcb2845cd8b4e4737cfe0bd196ffcaef
Files changed
test/position/sync/chooseOneResults.test.js | changed |
test/position/sync/chooseOneResults.test.js | ||
---|---|---|
@@ -35,12 +35,37 @@ | ||
35 | 35 … | { value: { content: ChooseOne({choice: 1, poll}), author: tommyId } }, |
36 | 36 … | { value: { content: ChooseOne({choice: 2, poll}), author: sallyId } } |
37 | 37 … | ] |
38 | 38 … | |
39 … | + const expected = { | |
40 … | + results: [ | |
41 … | + { | |
42 … | + choice: '1', | |
43 … | + voters: { | |
44 … | + [pietId]: positions[0], | |
45 … | + [mixId]: positions[1], | |
46 … | + [mikeyId]: positions[2] | |
47 … | + } | |
48 … | + }, | |
49 … | + { | |
50 … | + choice: '2', | |
51 … | + voters: { | |
52 … | + [timmyId]: positions[3], | |
53 … | + [tommyId]: positions[4] | |
54 … | + } | |
55 … | + }, | |
56 … | + { | |
57 … | + choice: 'three', | |
58 … | + voters: { | |
59 … | + [sallyId]: positions[5] | |
60 … | + } | |
61 … | + } | |
62 … | + ], | |
63 … | + errors: {} | |
64 … | + } | |
65 … | + | |
39 | 66 … | const actual = chooseOneResults({positions, poll: validPoll}) |
40 | - t.deepEqual(actual[0], [pietId, mixId, mikeyId], 'correct voters for choice 0') | |
41 | - t.deepEqual(actual[1], [timmyId, tommyId], 'correct voters for choice 1') | |
42 | - t.deepEqual(actual[2], [sallyId], 'correct voters for choice 2') | |
67 … | + t.deepEqual(actual, expected, 'results are correct') | |
43 | 68 … | t.end() |
44 | 69 … | }) |
45 | 70 … | |
46 | 71 … | test('ChooseOneResults - a position stated for an invalid choice index is not counted', function (t) { |
Built with git-ssb-web