Skip to content

Commit 744ad3d

Browse files
fix tests
1 parent b5c366d commit 744ad3d

File tree

10 files changed

+27
-23
lines changed

10 files changed

+27
-23
lines changed

test/unit/lib/actions/content-type/field-rename.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { expect } from 'chai'
2-
import { cloneDeep } from 'lodash'
2+
import lodash from 'lodash'
33
import { FieldRenameAction } from '../../../../../src/lib/action/field-rename'
44
import ContentType from '../../../../../src/lib/entities/content-type'
55

6+
const { cloneDeep } = lodash
7+
68
describe('rename field', () => {
79
describe('annotations on renamed field', () => {
810
it('renames the corresponding key in metadata', async () => {

test/unit/lib/actions/content-type/field-update.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect } from 'chai'
2-
import { cloneDeep } from 'lodash'
2+
import lodash from 'lodash'
3+
const { cloneDeep } = lodash
34
import { FieldUpdateAction } from '../../../../../src/lib/action/field-update'
45
import ContentType from '../../../../../src/lib/entities/content-type'
56
import APIContentType from '../../../../../src/lib/interfaces/content-type'

test/unit/lib/actions/field-add-items-validation.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ describe('FieldAddItemsValidationAction', () => {
8686
await action.applyTo(contentType)
8787

8888
const field = contentType.fields.getField('test')
89-
expect(field.items).to.exist
89+
expect(field.items).to.not.equal(undefined)
9090
expect(field.items?.type).to.equal('Symbol')
9191
expect(field.items?.validations).to.have.length(1)
9292
expect(field.items?.validations?.[0]).to.deep.equal({ unique: true })
9393
})
9494
})
95-
})
95+
})

test/unit/lib/intent-validator/content-transform.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { expect } from 'chai'
55
import ContentTransformIntentValidator from '../../../../src/lib/intent-validator/content-transform'
66
import createValidator from './validate-steps'
77
const validateSteps = createValidator([ContentTransformIntentValidator])
8-
import { omit } from 'lodash'
8+
import lodash from 'lodash'
9+
const { omit } = lodash
910

1011
describe('Content transformation', function () {
1112
describe('when providing the required properties', function () {

test/unit/lib/intent-validator/entry-derive.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict'
22

33
import { expect } from 'chai'
4-
import { omit } from 'lodash'
4+
import lodash from 'lodash'
5+
const { omit } = lodash
56

67
import EntryDeriveIntentValidator from '../../../../src/lib/intent-validator/entry-derive'
78
import createValidator from './validate-steps'

test/unit/lib/intent/field-add-items-validation.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('FieldAddItemsValidationIntent', function () {
1414
0,
1515
'test',
1616
0,
17-
[{ unique: true }],
18-
fakeCallsite()
17+
fakeCallsite(),
18+
[{ unique: true }]
1919
)
2020

2121
const contentTypes: APIContentType[] = [
@@ -53,8 +53,8 @@ describe('FieldAddItemsValidationIntent', function () {
5353
0,
5454
'test',
5555
0,
56-
[{ unique: true }],
57-
fakeCallsite()
56+
fakeCallsite(),
57+
[{ unique: true }]
5858
)
5959

6060
const contentTypes: APIContentType[] = [
@@ -90,8 +90,8 @@ describe('FieldAddItemsValidationIntent', function () {
9090
0,
9191
'test',
9292
0,
93-
[{ unique: true }],
94-
fakeCallsite()
93+
fakeCallsite(),
94+
[{ unique: true }]
9595
)
9696

9797
const contentTypes: APIContentType[] = [
@@ -114,10 +114,10 @@ describe('FieldAddItemsValidationIntent', function () {
114114

115115
const contentType = await api.getContentType('test')
116116
const field = contentType.fields.getField('test')
117-
expect(field.items).to.exist
117+
expect(field.items).to.not.equal(undefined)
118118
expect(field.items?.type).to.equal('Symbol')
119119
expect(field.items?.validations).to.have.length(1)
120120
expect(field.items?.validations?.[0]).to.deep.equal({ unique: true })
121121
})
122122
})
123-
})
123+
})

test/unit/lib/migration-chunks/validation/derive-entries.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from 'chai'
2-
import { omit } from 'lodash'
3-
4-
const validateChunks = require('./validate-chunks').default
2+
import lodash from 'lodash'
3+
const { omit } = lodash
4+
import validateChunks from './validate-chunks'
55

66
describe('Derive entries chunk validation', function () {
77
describe('when deriving entries of a non existing Content Type', function () {

test/unit/lib/migration-chunks/validation/set-tags-for-entries.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expect } from 'chai'
2-
import { omit } from 'lodash'
2+
import lodash from 'lodash'
3+
const { omit } = lodash
34
import makeApiTag from '../../../../helpers/make-api-tag'
4-
5-
const validateChunks = require('./validate-chunks').default
5+
import validateChunks from './validate-chunks'
66

77
describe('Set tags chunk validation', function () {
88
describe('when setting tags on a non existing Content Type', function () {

test/unit/lib/migration-chunks/validation/transform-entries.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { expect } from 'chai'
2-
3-
const validateChunks = require('./validate-chunks').default
2+
import validateChunks from './validate-chunks'
43

54
describe('Transform entries chunk validation', function () {
65
describe('when transforming entries of a non existing Content Type', function () {

test/unit/lib/migration-parser.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const { expect } = require('chai')
3+
import { expect } from 'chai'
44
import Fetcher from '../../../src/lib/fetcher'
55
import createMigrationParser from '../../../src/lib/migration-parser'
66

0 commit comments

Comments
 (0)