@@ -25,16 +25,56 @@ const inputRowObjs = [
25
25
{ Seat : 'President' , Name : 'Jane Doe' , Email : 'janedoe@doe.com' } ,
26
26
]
27
27
28
+ let outRowObjs
29
+
28
30
test ( 'create an election in the db' , async ( ) => {
29
31
const { rowObjs, messages } = await undebatesFromTemplateAndRows ( viewerRecorderTemplate , inputRowObjs )
30
- console . info ( 'messages' , messages )
32
+ outRowObjs = rowObjs
33
+ expect ( rowObjs [ 0 ] . viewer_url ) . toBe ( 'https://cc.enciv.org/country:us/organization:cfa/office:president/2021-03-21' )
34
+ expect ( rowObjs [ 0 ] . recorder_url ) . toMatch (
35
+ / h t t p s : \/ \/ c c .e n c i v .o r g \/ c o u n t r y : u s \/ o r g a n i z a t i o n : c f a \/ o f f i c e : p r e s i d e n t \/ 2 0 2 1 - 0 3 - 2 1 - r e c o r d e r - [ a - f \d ] { 24 } $ /
36
+ )
37
+ const viewers = await Iota . find ( { path : '/country:us/organization:cfa/office:president/2021-03-21' } )
38
+ expect ( viewers [ 0 ] ) . toMatchObject ( viewerRecorderTemplate . candidateViewer )
39
+ const [ recorder0 ] = await Iota . find ( { 'bp_info.candidate_name' : rowObjs [ 0 ] . Name } )
40
+ expect ( recorder0 ) . toMatchObject ( viewerRecorderTemplate . candidateRecorder )
41
+ const [ recorder1 ] = await Iota . find ( { 'bp_info.candidate_name' : rowObjs [ 1 ] . Name } )
42
+ expect ( recorder1 ) . toMatchObject ( viewerRecorderTemplate . candidateRecorder )
43
+ expect ( recorder0 . parentId ) . toBe ( MongoModels . ObjectID ( viewers [ 0 ] . _id ) . toString ( ) )
44
+ expect ( recorder1 . parentId ) . toBe ( MongoModels . ObjectID ( viewers [ 0 ] . _id ) . toString ( ) )
45
+ } )
46
+
47
+ test ( 'update the agenda' , async ( ) => {
48
+ viewerRecorderTemplate . candidateViewer . webComponent . participants . moderator . agenda = [
49
+ [ 'New Introductions' , '1- Name' , '2- Planet' , '3- language' , '4- What role are you running for?' ] ,
50
+ [ 'How did you evolve?' ] ,
51
+ [ 'What is your favorite pet' ] ,
52
+ [ 'How do we get off this planet' ] ,
53
+ [
54
+ 'What is the one thing you want us to know about your candidacy that was not covered by the candidate questions provided?' ,
55
+ ] ,
56
+ [ 'Thank you!' ] ,
57
+ ]
58
+ viewerRecorderTemplate . candidateRecorder . component . participants . moderator . agenda = [
59
+ [ '1- How To' , '2- Record Placeholder' ] ,
60
+ [ 'New Introductions' , '1- Name' , '2- Planet' , '3- language' , '4- What role are you running for?' ] ,
61
+ [ 'How did you evolve?' ] ,
62
+ [ 'What is your favorite pet' ] ,
63
+ [ 'How do we get off this planet' ] ,
64
+ [
65
+ 'What is the one thing you want us to know about your candidacy that was not covered by the candidate questions provided?' ,
66
+ ] ,
67
+ [ 'Thank you!' ] ,
68
+ ]
69
+ const { rowObjs, messages } = await undebatesFromTemplateAndRows ( viewerRecorderTemplate , outRowObjs )
31
70
expect ( rowObjs [ 0 ] . viewer_url ) . toBe ( 'https://cc.enciv.org/country:us/organization:cfa/office:president/2021-03-21' )
32
71
expect ( rowObjs [ 0 ] . recorder_url ) . toMatch (
33
72
/ h t t p s : \/ \/ c c .e n c i v .o r g \/ c o u n t r y : u s \/ o r g a n i z a t i o n : c f a \/ o f f i c e : p r e s i d e n t \/ 2 0 2 1 - 0 3 - 2 1 - r e c o r d e r - [ a - f \d ] { 24 } $ /
34
73
)
35
74
const viewers = await Iota . find ( { path : '/country:us/organization:cfa/office:president/2021-03-21' } )
36
75
expect ( viewers [ 0 ] ) . toMatchObject ( viewerRecorderTemplate . candidateViewer )
37
76
const [ recorder0 ] = await Iota . find ( { 'bp_info.candidate_name' : rowObjs [ 0 ] . Name } )
77
+
38
78
expect ( recorder0 ) . toMatchObject ( viewerRecorderTemplate . candidateRecorder )
39
79
const [ recorder1 ] = await Iota . find ( { 'bp_info.candidate_name' : rowObjs [ 1 ] . Name } )
40
80
expect ( recorder1 ) . toMatchObject ( viewerRecorderTemplate . candidateRecorder )
0 commit comments