-
Notifications
You must be signed in to change notification settings - Fork 20
/
tests.js
159 lines (135 loc) · 3.87 KB
/
tests.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
const assert = require("assert");
const graphql = require("graphql").graphql;
const { client, schema, content } = require("./");
assert.equal(
content.workshops.find(o => o.title === "Styleguide-driven Development")
.speakers[0].name,
"Andrey Okonetchnikov"
);
assert.equal(
content.workshops.find(o => o.title === "Styleguide-driven Development")
.location.address,
"Aleksanterinkatu 16"
);
assert.equal(
content.speakers.find(o => o.name === "Andrey Okonetchnikov").workshops[0]
.title,
content.workshops.find(o => o.title === "Styleguide-driven Development").title
);
assert(content.speakers.find(o => o.name === "Juho Vepsäläinen"));
assert.equal(
content.speakers.find(o => o.name === "Andrey Okonetchnikov").social.twitter,
"https://twitter.com/okonetchnikov"
);
assert.equal(
content.sponsors.find(o => o.name === "Solita").social.linkedin,
"https://linkedin.com/company/solita-oy"
);
assert.equal(
content.sponsors.find(o => o.name === "Solita").social.medium,
undefined
);
assert.equal(
content.sponsors.find(o => o.name === "Solita").social.homepage,
"https://www.solita.fi/en/"
);
assert.equal(
content.locations.find(o => o.name === "Elisa Appelsiini").social.linkedin,
"https://linkedin.com/company/elisa"
);
assert.equal(
content.locations.find(o => o.name === "Valkoinen Sali").address,
"Aleksanterinkatu 16"
);
assert.equal(
content.speakers.find(o => o.name === "Christian Alfoni").presentations[0]
.title,
content.presentations.find(
o => o.title === "Declarative state and side effects"
).title
);
assert.equal(
content.presentations.find(
o => o.title === "Declarative state and side effects"
).urls.slides,
"https://slides.react-finland.fi/2018/02-christian-alfoni.pdf"
);
assert.equal(
content.keynotes.find(o => o.title === "How React changed everything").urls
.slides,
"https://slides.react-finland.fi/2018/13-ken-wheeler.pdf"
);
assert.equal(
content.keynotes.find(o => o.title === "How React changed everything").urls
.web,
"https://reactfinland.surge.sh/"
);
assert.equal(
content.speakers.find(o => o.name === "Christian Alfoni").presentations[0]
.title,
content.talks.find(o => o.title === "Declarative state and side effects")
.title
);
assert.equal(
content.speakers.find(o => o.name === "Jani Eväkallio").keynotes[0].title,
content.keynotes.find(o => o.title === "The New Best Practices").title
);
assert.equal(
content.speakers.find(o => o.name === "Jani Eväkallio").keynotes[0].title,
content.talks.find(o => o.title === "The New Best Practices").title
);
assert.equal(
content.speakers.find(o => o.name === "Varya Stepanova").lightningTalks[0]
.title,
content.lightningTalks.find(
o =>
o.title ===
"How to use React, webpack and other buzzwords if there is no need"
).title
);
assert.equal(
content.speakers.find(o => o.name === "Varya Stepanova").lightningTalks[0]
.title,
content.talks.find(
o =>
o.title ===
"How to use React, webpack and other buzzwords if there is no need"
).title
);
assert(content.partners.find(o => o.name === "Agent Conf"));
assert.equal(
content.organizers.find(o => o.name === "Toni Ristola").social.twitter,
"https://twitter.com/toniristola"
);
assert.equal(
content.talks.find(
o =>
o.title ===
"How to use React, webpack and other buzzwords if there is no need"
).type,
schema.enums.LIGHTNING_TALK
);
graphql(schema.executable(), "{ speakers { name } }")
.then(({ data }) => {
assert.deepEqual(
data.speakers.map(speaker => speaker.name),
Object.values(content.speakers).map(speaker => speaker.name)
);
})
.catch(e => {
throw new Error(e);
});
graphql(
schema.executable(),
`
{
page(id: "about") {
id
}
}
`
)
.then(({ data: { page: { id } } }) => assert(id === "about"))
.catch(e => {
throw new Error(e);
});