git ssb

0+

Piet / ssb-loomio



Tree: a9066ada5725359824ce7bca9e5007251109f74c

Files: a9066ada5725359824ce7bca9e5007251109f74c / test / position / sync / chooseOneResults.test.js

1717 bytesRaw
1const test = require('tape')
2const ChooseOne = require('../../../position/sync/chooseOne')
3const Position = require('../../../position/sync/position')
4const chooseOneResults = require('../../../position/sync/chooseOneResults')
5
6const pietId = '@Mq8D3YC6VdErKQzV3oi2oK5hHSoIwR0hUQr4M46wr/0=.ed25519'
7const mixId = '@Mq8D3YC6VdErKQzV3oi2oK5hHSoIwR0hUQr4M46wr/1=.ed25519'
8const mikeyId = '@Mq8D3YC6VdErKQzV3oi2oK5hHSoIwR0hUQr4M46wr/2=.ed25519'
9const timmyId = '@Mq8D3YC6VdErKQzV3oi2oK5hHSoIwR0hUQr4M46wr/3=.ed25519'
10const tommyId = '@Mq8D3YC6VdErKQzV3oi2oK5hHSoIwR0hUQr4M46wr/4=.ed25519'
11const sallyId = '@Mq8D3YC6VdErKQzV3oi2oK5hHSoIwR0hUQr4M46wr/5=.ed25519'
12
13const poll = '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256'
14
15test('Position - ChooseOneResults', function (t) {
16 const positions = [
17 { value: { content: Position(ChooseOne({choice: 0, poll})), author: pietId } },
18 { value: { content: Position(ChooseOne({choice: 0, poll})), author: mixId } },
19 { value: { content: Position(ChooseOne({choice: 0, poll})), author: mikeyId } },
20 { value: { content: Position(ChooseOne({choice: 1, poll})), author: timmyId } },
21 { value: { content: Position(ChooseOne({choice: 1, poll})), author: tommyId } },
22 { value: { content: Position(ChooseOne({choice: 2, poll})), author: sallyId } }
23 ]
24
25 const actual = chooseOneResults({positions})
26 t.deepEqual(actual[0], [pietId, mixId, mikeyId], 'correct voters for choice 0')
27 t.deepEqual(actual[1], [timmyId, tommyId], 'correct voters for choice 1')
28 t.deepEqual(actual[2], [sallyId], 'correct voters for choice 2')
29 t.end()
30})
31
32test.skip('Position - A position stated after the closing time of the poll is not counted', function(t) {
33
34 t.end()
35})
36

Built with git-ssb-web