Skip to content

Commit 74232a4

Browse files
committed
fix async expectations in unit tests
1 parent 4a58f6b commit 74232a4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

spec/test.spec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -361,31 +361,31 @@ describe('S3Adapter tests', () => {
361361

362362
it('should get using the baseUrl', async () => {
363363
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
364-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
364+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
365365
'http://example.com/files/foo/bar/test.png'
366366
);
367367
});
368368

369369
it('should get direct to baseUrl', async () => {
370370
options.baseUrlDirect = true;
371371
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
372-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
372+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
373373
'http://example.com/files/test.png'
374374
);
375375
});
376376

377377
it('should get without directAccess', async () => {
378378
options.directAccess = false;
379379
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
380-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
380+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
381381
'http://my.server.com/parse/files/xxxx/test.png'
382382
);
383383
});
384384

385385
it('should go directly to amazon', async () => {
386386
delete options.baseUrl;
387387
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
388-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
388+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
389389
'https://my-bucket.s3.amazonaws.com/foo/bar/test.png'
390390
);
391391
});
@@ -412,31 +412,31 @@ describe('S3Adapter tests', () => {
412412

413413
it('should get using the baseUrl', async () => {
414414
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
415-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
415+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
416416
'http://example.com/files/foo/bar/test.png'
417417
);
418418
});
419419

420420
it('should get direct to baseUrl', async () => {
421421
options.baseUrlDirect = true;
422422
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
423-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
423+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
424424
'http://example.com/files/test.png'
425425
);
426426
});
427427

428428
it('should get without directAccess', async () => {
429429
options.directAccess = false;
430430
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
431-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
431+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
432432
'http://my.server.com/parse/files/xxxx/test.png'
433433
);
434434
});
435435

436436
it('should go directly to amazon', async () => {
437437
delete options.baseUrl;
438438
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
439-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
439+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
440440
'https://my-bucket.s3.amazonaws.com/foo/bar/test.png'
441441
);
442442
});
@@ -459,7 +459,7 @@ describe('S3Adapter tests', () => {
459459

460460
it('should get using the baseUrl', async () => {
461461
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
462-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
462+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
463463
'http://example.com/files/foo/bar/test.png'
464464
);
465465
});
@@ -496,23 +496,23 @@ describe('S3Adapter tests', () => {
496496
it('should get direct to baseUrl', async () => {
497497
options.baseUrlDirect = true;
498498
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
499-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
499+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
500500
'http://example.com/files/test.png'
501501
);
502502
});
503503

504504
it('should get without directAccess', async () => {
505505
options.directAccess = false;
506506
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
507-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
507+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
508508
'http://my.server.com/parse/files/xxxx/test.png'
509509
);
510510
});
511511

512512
it('should go directly to amazon', async () => {
513513
delete options.baseUrl;
514514
const s3 = new S3Adapter('accessKey', 'secretKey', 'my-bucket', options);
515-
expect(await s3.getFileLocation(testConfig, 'test.png')).toEqual(
515+
await expectAsync(s3.getFileLocation(testConfig, 'test.png')).toBeResolvedTo(
516516
'https://my-bucket.s3.amazonaws.com/foo/bar/test.png'
517517
);
518518
});

0 commit comments

Comments
 (0)