Skip to content

Commit a7eeda4

Browse files
authored
chore(tests): refactor assertions to use 'to.contain' instead of 'to.contains' (#599)
1 parent 634ac00 commit a7eeda4

32 files changed

Lines changed: 174 additions & 174 deletions

test/commands/api/create.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('invalid api:create', () => {
141141
'--setdefault'
142142
])
143143
.catch(err => {
144-
expect(err.message).to.contains('Object doesn\'t exist')
144+
expect(err.message).to.contain('Object doesn\'t exist')
145145
})
146146
.it('error shows as create failed and publish and setdefault are not executed')
147147

@@ -162,7 +162,7 @@ describe('invalid api:create', () => {
162162
)
163163
.command(['api:create', validIdentifier, '-f=test/resources/valid_api.yaml', '--setdefault', '--published=publish'])
164164
.catch(err => {
165-
expect(err.message).to.contains('An error occurred. Publishing API failed')
165+
expect(err.message).to.contain('An error occurred. Publishing API failed')
166166
})
167167
.it('error shows as publish failed and setdefault is not executed')
168168

@@ -187,7 +187,7 @@ describe('invalid api:create', () => {
187187
)
188188
.command(['api:create', validIdentifier, '-f=test/resources/valid_api.yaml', '--published=publish', '--setdefault'])
189189
.catch(err => {
190-
expect(err.message).to.contains('An error occurred. Setting default version failed')
190+
expect(err.message).to.contain('An error occurred. Setting default version failed')
191191
})
192192
.it('error shows as setdefault failed')
193193
})
@@ -207,7 +207,7 @@ describe('valid api:create', () => {
207207
.stdout()
208208
.command(['api:create', validIdentifier, '--file=test/resources/valid_api.yaml'])
209209
.it('runs api:create with yaml file', ctx => {
210-
expect(ctx.stdout).to.contains('Created API \'org/api\'')
210+
expect(ctx.stdout).to.contain('Created API \'org/api\'')
211211
})
212212

213213
test
@@ -228,7 +228,7 @@ describe('valid api:create', () => {
228228
.stdout()
229229
.command(['api:create', validIdentifier, '--file=test/resources/valid_api.yaml', '--setdefault'])
230230
.it('runs api:create to set default version', ctx => {
231-
expect(ctx.stdout).to.contains('Created API \'org/api\'\nDefault version of org/api set to 1.0.0')
231+
expect(ctx.stdout).to.contain('Created API \'org/api\'\nDefault version of org/api set to 1.0.0')
232232
})
233233

234234
test
@@ -249,7 +249,7 @@ describe('valid api:create', () => {
249249
.stdout()
250250
.command(['api:create', validIdentifier, '--file=test/resources/valid_api.yaml', '--published=publish'])
251251
.it('runs api:create to publish API', ctx => {
252-
expect(ctx.stdout).to.contains('Created API \'org/api\'\nPublished API org/api/1.0.0')
252+
expect(ctx.stdout).to.contain('Created API \'org/api\'\nPublished API org/api/1.0.0')
253253
})
254254

255255
test
@@ -331,7 +331,7 @@ describe('valid api:create', () => {
331331
'--visibility=public'
332332
])
333333
.it('runs api:create with json file', ctx => {
334-
expect(ctx.stdout).to.contains('Created API \'org/api\'')
334+
expect(ctx.stdout).to.contain('Created API \'org/api\'')
335335
})
336336

337337
test
@@ -353,7 +353,7 @@ describe('valid api:create', () => {
353353
'--visibility=public'
354354
])
355355
.it('runs api:create with asyncapi json file', ctx => {
356-
expect(ctx.stdout).to.contains('Created API \'org/api\'')
356+
expect(ctx.stdout).to.contain('Created API \'org/api\'')
357357
})
358358
test
359359
.stub(config, 'getConfig', stub => stub.returns({ SWAGGERHUB_URL: shubUrl }))
@@ -374,7 +374,7 @@ describe('valid api:create', () => {
374374
'--visibility=public'
375375
])
376376
.it('runs api:create with asyncapi yaml file', ctx => {
377-
expect(ctx.stdout).to.contains('Created API \'org/api\'')
377+
expect(ctx.stdout).to.contain('Created API \'org/api\'')
378378
})
379379
})
380380

@@ -397,7 +397,7 @@ describe('valid create new version with api:create', () => {
397397
.stdout()
398398
.command(['api:create', 'org/api', '--file=test/resources/valid_api.yaml'])
399399
.it('runs api:create with yaml file reading version from file', ctx => {
400-
expect(ctx.stdout).to.contains('Created version 1.0.1 of API \'org/api\'')
400+
expect(ctx.stdout).to.contain('Created version 1.0.1 of API \'org/api\'')
401401
})
402402

403403
test
@@ -422,7 +422,7 @@ describe('valid create new version with api:create', () => {
422422
'--visibility=public'
423423
])
424424
.it('runs api:create with json file reading version from file', ctx => {
425-
expect(ctx.stdout).to.contains('Created version 2.0.0 of API \'org/api\'')
425+
expect(ctx.stdout).to.contain('Created version 2.0.0 of API \'org/api\'')
426426
})
427427
})
428428

test/commands/api/delete.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('valid api:delete', () => {
1515
.stdout()
1616
.command(['api:delete', apiVersionId])
1717
.it('runs api:delete on API version', ctx => {
18-
expect(ctx.stdout).to.contains(`Deleted version 1.0.0 of API '${apiId}'`)
18+
expect(ctx.stdout).to.contain(`Deleted version 1.0.0 of API '${apiId}'`)
1919
})
2020

2121
test
@@ -28,7 +28,7 @@ describe('valid api:delete', () => {
2828
.stdout()
2929
.command(['api:delete', apiId])
3030
.it('runs api:delete on API defintion', ctx => {
31-
expect(ctx.stdout).to.contains(`Deleted API '${apiId}'`)
31+
expect(ctx.stdout).to.contain(`Deleted API '${apiId}'`)
3232
})
3333

3434
test
@@ -47,7 +47,7 @@ describe('valid api:delete', () => {
4747
.stdout()
4848
.command(['api:delete', apiId, '-f'])
4949
.it('runs api:delete on API defintion with -f flag', ctx => {
50-
expect(ctx.stdout).to.contains(`Deleted API '${apiId}'`)
50+
expect(ctx.stdout).to.contain(`Deleted API '${apiId}'`)
5151
})
5252

5353
test
@@ -59,7 +59,7 @@ describe('valid api:delete', () => {
5959
.stdout()
6060
.command(['api:delete', apiId, '--force'])
6161
.it('runs api:delete on API defintion with --force flag', ctx => {
62-
expect(ctx.stdout).to.contains(`Deleted API '${apiId}'`)
62+
expect(ctx.stdout).to.contain(`Deleted API '${apiId}'`)
6363
})
6464
})
6565

test/commands/api/get.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('valid identifier on api:get', () => {
3535
.stdout()
3636
.command(['api:get', 'org1/api2/1.0.0', '--json'])
3737
.it('runs api:get --json and returns response in json format', ctx => {
38-
expect(ctx.stdout).to.contains(JSON.stringify(jsonResponse, null, 2))
38+
expect(ctx.stdout).to.contain(JSON.stringify(jsonResponse, null, 2))
3939
})
4040

4141
test
@@ -47,7 +47,7 @@ describe('valid identifier on api:get', () => {
4747
.stdout()
4848
.command(['api:get', 'org1/api2/1.0.0', '-j'])
4949
.it('runs api:get -j and returns response in json format', ctx => {
50-
expect(ctx.stdout).to.contains(JSON.stringify(jsonResponse, null, 2))
50+
expect(ctx.stdout).to.contain(JSON.stringify(jsonResponse, null, 2))
5151
})
5252

5353
test
@@ -59,7 +59,7 @@ describe('valid identifier on api:get', () => {
5959
.stdout()
6060
.command(['api:get', 'org1/api2/1.0.0'])
6161
.it('runs api:get and returns response in yaml format', ctx => {
62-
expect(ctx.stdout).to.contains(yaml.dump(jsonResponse))
62+
expect(ctx.stdout).to.contain(yaml.dump(jsonResponse))
6363
})
6464

6565
test
@@ -75,7 +75,7 @@ describe('valid identifier on api:get', () => {
7575
.stdout()
7676
.command(['api:get', 'org1/api2'])
7777
.it('runs api:get to return default API version in yaml format', ctx => {
78-
expect(ctx.stdout).to.contains(yaml.dump(jsonResponse))
78+
expect(ctx.stdout).to.contain(yaml.dump(jsonResponse))
7979
})
8080

8181
test
@@ -91,7 +91,7 @@ describe('valid identifier on api:get', () => {
9191
.stdout()
9292
.command(['api:get', 'org1/api2', '-j'])
9393
.it('runs api:get to return default API version in json format', ctx => {
94-
expect(ctx.stdout).to.contains(JSON.stringify(jsonResponse, null, 2))
94+
expect(ctx.stdout).to.contain(JSON.stringify(jsonResponse, null, 2))
9595
})
9696

9797
test
@@ -103,7 +103,7 @@ describe('valid identifier on api:get', () => {
103103
.stdout()
104104
.command(['api:get', 'org1/api2/1.0.0', '--resolved'])
105105
.it('runs api:get --resolved to return resolved API definition in yaml format', ctx => {
106-
expect(ctx.stdout).to.contains(yaml.dump(jsonResponse))
106+
expect(ctx.stdout).to.contain(yaml.dump(jsonResponse))
107107
})
108108

109109
test
@@ -119,7 +119,7 @@ describe('valid identifier on api:get', () => {
119119
.stdout()
120120
.command(['api:get', 'org1/api2', '-r'])
121121
.it('run api:get -r and returns resolved default API version', ctx => {
122-
expect(ctx.stdout).to.contains(yaml.dump(jsonResponse))
122+
expect(ctx.stdout).to.contain(yaml.dump(jsonResponse))
123123
})
124124

125125
test
@@ -131,7 +131,7 @@ describe('valid identifier on api:get', () => {
131131
.stdout()
132132
.command(['api:get', 'org1/api2/1.0.0', '-jr'])
133133
.it('runs api:get -jr to return resolved definition', ctx => {
134-
expect(ctx.stdout).to.contains(JSON.stringify(jsonResponse, null, 2))
134+
expect(ctx.stdout).to.contain(JSON.stringify(jsonResponse, null, 2))
135135
})
136136
})
137137

test/commands/api/publish.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('valid api:publish', () => {
1414
.stdout()
1515
.command(['api:publish', 'org/api/1.0.0'])
1616
.it('runs api:publish with identifier', ctx => {
17-
expect(ctx.stdout).to.contains('Published API org/api/1.0.0')
17+
expect(ctx.stdout).to.contain('Published API org/api/1.0.0')
1818
})
1919

2020
test
@@ -41,7 +41,7 @@ describe('valid api:publish', () => {
4141
.stdout()
4242
.command(['api:publish', 'org/api/1.0.0', '--force'])
4343
.it('runs api:publish with force argument', ctx => {
44-
expect(ctx.stdout).to.contains('Published API org/api/1.0.0')
44+
expect(ctx.stdout).to.contain('Published API org/api/1.0.0')
4545
})
4646
})
4747

test/commands/api/setdefault.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('valid api:setdefault', () => {
1212
.stdout()
1313
.command(['api:setdefault', 'org/api/2.0.0'])
1414
.it('runs api:setdefault with identifier', ctx => {
15-
expect(ctx.stdout).to.contains('Default version of org/api set to 2.0.0')
15+
expect(ctx.stdout).to.contain('Default version of org/api set to 2.0.0')
1616
})
1717
})
1818

test/commands/api/unpublish.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('valid api:unpublish', () => {
1212
.stdout()
1313
.command(['api:unpublish', 'org/api/1.0.0'])
1414
.it('runs api:unpublish with identifier', ctx => {
15-
expect(ctx.stdout).to.contains('Unpublished API org/api/1.0.0')
15+
expect(ctx.stdout).to.contain('Unpublished API org/api/1.0.0')
1616
})
1717
})
1818

0 commit comments

Comments
 (0)