Skip to content

Commit 3db265f

Browse files
author
Chris Cole
committed
test: 537088 - Fix linting errors
1 parent 122bf65 commit 3db265f

5 files changed

Lines changed: 32 additions & 42 deletions

File tree

src/server/plugins/engine/components/AutocompleteField.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe.each([
172172

173173
describe('State', () => {
174174
it.each([...options.examples])('returns text from state', (item) => {
175-
const state1 = getFormState(item.state)
175+
const state1 = getFormState(item.value)
176176
const state2 = getFormState(null)
177177

178178
const answer1 = getAnswer(field, state1)
@@ -183,7 +183,7 @@ describe.each([
183183
})
184184

185185
it.each([...options.examples])('returns payload from state', (item) => {
186-
const state1 = getFormState(item.state)
186+
const state1 = getFormState(item.value)
187187
const state2 = getFormState(null)
188188

189189
const payload1 = field.getFormDataFromState(state1)
@@ -194,7 +194,7 @@ describe.each([
194194
})
195195

196196
it.each([...options.examples])('returns value from state', (item) => {
197-
const state1 = getFormState(item.state)
197+
const state1 = getFormState(item.value)
198198
const state2 = getFormState(null)
199199

200200
const value1 = field.getFormValueFromState(state1)
@@ -207,7 +207,7 @@ describe.each([
207207
it.each([...options.examples])(
208208
'returns context for conditions and form submission',
209209
(item) => {
210-
const state1 = getFormState(item.state)
210+
const state1 = getFormState(item.value)
211211
const state2 = getFormState(null)
212212

213213
const value1 = field.getContextValueFromState(state1)
@@ -225,7 +225,7 @@ describe.each([
225225
const value1 = field.getStateFromValidForm(payload1)
226226
const value2 = field.getStateFromValidForm(payload2)
227227

228-
expect(value1).toEqual(getFormState(item.state))
228+
expect(value1).toEqual(getFormState(item.value))
229229
expect(value2).toEqual(getFormState(null))
230230
})
231231
})

src/server/plugins/engine/components/CheckboxesField.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ describe.each([
240240
it.each([...options.examples])(
241241
'returns text from state (single)',
242242
(item) => {
243-
const state1 = getFormState([item.state])
243+
const state1 = getFormState([item.value])
244244
const state2 = getFormState(null)
245245

246246
const answer1 = getAnswer(field, state1)
@@ -260,7 +260,7 @@ describe.each([
260260
const item1 = options.examples[0]
261261
const item2 = options.examples[2]
262262

263-
const state = getFormState([item1.state, item2.state])
263+
const state = getFormState([item1.value, item2.value])
264264
const answer = getAnswer(field, state)
265265

266266
expect(answer).toBe(outdent`
@@ -272,7 +272,7 @@ describe.each([
272272
})
273273

274274
it.each([...options.examples])('returns payload from state', (item) => {
275-
const state1 = getFormState([item.state])
275+
const state1 = getFormState([item.value])
276276
const state2 = getFormState(null)
277277

278278
const payload1 = field.getFormDataFromState(state1)
@@ -283,7 +283,7 @@ describe.each([
283283
})
284284

285285
it.each([...options.examples])('returns value from state', (item) => {
286-
const state1 = getFormState([item.state])
286+
const state1 = getFormState([item.value])
287287
const state2 = getFormState(null)
288288

289289
const value1 = field.getFormValueFromState(state1)
@@ -296,13 +296,13 @@ describe.each([
296296
it.each([...options.examples])(
297297
'returns context for conditions and form submission',
298298
(item) => {
299-
const state1 = getFormState([item.state])
299+
const state1 = getFormState([item.value])
300300
const state2 = getFormState(null)
301301

302302
const value1 = field.getContextValueFromState(state1)
303303
const value2 = field.getContextValueFromState(state2)
304304

305-
expect(value1).toEqual([item.state])
305+
expect(value1).toEqual([item.value])
306306
expect(value2).toEqual([])
307307
}
308308
)
@@ -314,7 +314,7 @@ describe.each([
314314
const value1 = field.getStateFromValidForm(payload1)
315315
const value2 = field.getStateFromValidForm(payload2)
316316

317-
expect(value1).toEqual(getFormState([item.state]))
317+
expect(value1).toEqual(getFormState([item.value]))
318318
expect(value2).toEqual(getFormState(null))
319319
})
320320
})

src/server/plugins/engine/components/RadiosField.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe.each([
170170

171171
describe('State', () => {
172172
it.each([...options.examples])('returns text from state', (item) => {
173-
const state1 = getFormState(item.state)
173+
const state1 = getFormState(item.value)
174174
const state2 = getFormState(null)
175175

176176
const answer1 = getAnswer(field, state1)
@@ -181,7 +181,7 @@ describe.each([
181181
})
182182

183183
it.each([...options.examples])('returns payload from state', (item) => {
184-
const state1 = getFormState(item.state)
184+
const state1 = getFormState(item.value)
185185
const state2 = getFormState(null)
186186

187187
const payload1 = field.getFormDataFromState(state1)
@@ -192,7 +192,7 @@ describe.each([
192192
})
193193

194194
it.each([...options.examples])('returns value from state', (item) => {
195-
const state1 = getFormState(item.state)
195+
const state1 = getFormState(item.value)
196196
const state2 = getFormState(null)
197197

198198
const value1 = field.getFormValueFromState(state1)
@@ -205,7 +205,7 @@ describe.each([
205205
it.each([...options.examples])(
206206
'returns context for conditions and form submission',
207207
(item) => {
208-
const state1 = getFormState(item.state)
208+
const state1 = getFormState(item.value)
209209
const state2 = getFormState(null)
210210

211211
const value1 = field.getContextValueFromState(state1)
@@ -223,7 +223,7 @@ describe.each([
223223
const value1 = field.getStateFromValidForm(payload1)
224224
const value2 = field.getStateFromValidForm(payload2)
225225

226-
expect(value1).toEqual(getFormState(item.state))
226+
expect(value1).toEqual(getFormState(item.value))
227227
expect(value2).toEqual(getFormState(null))
228228
})
229229
})

src/server/plugins/engine/components/SelectField.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe.each([
171171

172172
describe('State', () => {
173173
it.each([...options.examples])('returns text from state', (item) => {
174-
const state1 = getFormState(item.state)
174+
const state1 = getFormState(item.value)
175175
const state2 = getFormState(null)
176176

177177
const answer1 = getAnswer(field, state1)
@@ -182,7 +182,7 @@ describe.each([
182182
})
183183

184184
it.each([...options.examples])('returns payload from state', (item) => {
185-
const state1 = getFormState(item.state)
185+
const state1 = getFormState(item.value)
186186
const state2 = getFormState(null)
187187

188188
const payload1 = field.getFormDataFromState(state1)
@@ -193,7 +193,7 @@ describe.each([
193193
})
194194

195195
it.each([...options.examples])('returns value from state', (item) => {
196-
const state1 = getFormState(item.state)
196+
const state1 = getFormState(item.value)
197197
const state2 = getFormState(null)
198198

199199
const value1 = field.getFormValueFromState(state1)
@@ -206,7 +206,7 @@ describe.each([
206206
it.each([...options.examples])(
207207
'returns context for conditions and form submission',
208208
(item) => {
209-
const state1 = getFormState(item.state)
209+
const state1 = getFormState(item.value)
210210
const state2 = getFormState(null)
211211

212212
const value1 = field.getContextValueFromState(state1)
@@ -224,7 +224,7 @@ describe.each([
224224
const value1 = field.getStateFromValidForm(payload1)
225225
const value2 = field.getStateFromValidForm(payload2)
226226

227-
expect(value1).toEqual(getFormState(item.state))
227+
expect(value1).toEqual(getFormState(item.value))
228228
expect(value2).toEqual(getFormState(null))
229229
})
230230
})

test/fixtures/list.js

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,19 @@ export const listNumber = createListFromFactory({
2121
export const listNumberExamples = [
2222
createListItemFactory({
2323
text: '1 point',
24-
value: 1,
25-
state: 1
24+
value: 1
2625
}),
2726
createListItemFactory({
2827
text: '2 points',
29-
value: 2,
30-
state: 2
28+
value: 2
3129
}),
3230
createListItemFactory({
3331
text: '3 points',
34-
value: 3,
35-
state: 3
32+
value: 3
3633
}),
3734
createListItemFactory({
3835
text: '4 points',
39-
value: 4,
40-
state: 4
36+
value: 4
4137
})
4238
]
4339

@@ -59,36 +55,30 @@ export const listString = createListFromFactory({
5955
export const listStringExamples = [
6056
createListItemFactory({
6157
text: '1 hour',
62-
value: '1',
63-
state: '1'
58+
value: '1'
6459
}),
6560
createListItemFactory({
6661
text: '2 hours',
67-
value: '2',
68-
state: '2'
62+
value: '2'
6963
}),
7064
createListItemFactory({
7165
text: '3 hours',
72-
value: '3',
73-
state: '3'
66+
value: '3'
7467
}),
7568
createListItemFactory({
7669
text: '4 hours',
77-
value: '4',
78-
state: '4'
70+
value: '4'
7971
})
8072
]
8173

8274
export const listYesNoExamples = [
8375
createListItemFactory({
8476
text: 'Yes',
85-
value: true,
86-
state: true
77+
value: true
8778
}),
8879
createListItemFactory({
8980
text: 'No',
90-
value: false,
91-
state: false
81+
value: false
9282
})
9383
]
9484

0 commit comments

Comments
 (0)