Skip to content

Commit 2109e07

Browse files
committed
chore: fix test cases to be compatible with mocha@6.x
See mochajs/mocha#3550
1 parent 14db67c commit 2109e07

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

packages/repository/test/unit/repositories/relation.repository.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('relation repository', () => {
8888
});
8989
});
9090

91-
context('patch', async () => {
91+
context('patch', () => {
9292
it('can patch related model instance', async () => {
9393
const constraint: Partial<Customer> = {name: 'Jane'};
9494
const hasManyCrudInstance = givenDefaultHasManyInstance(constraint);

packages/rest-explorer/test/acceptance/rest-explorer.acceptance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('API Explorer (acceptance)', () => {
5555
});
5656
});
5757

58-
context('with custom RestServerConfig', async () => {
58+
context('with custom RestServerConfig', () => {
5959
it('honours custom OpenAPI path', async () => {
6060
await givenAppWithCustomRestConfig({
6161
openApiSpec: {

packages/rest/test/unit/coercion/paramStringToNumber.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('coerce param from string to number - required', () => {
5656
});
5757

5858
describe('coerce param from string to number - optional', () => {
59-
context('valid values', async () => {
59+
context('valid values', () => {
6060
test(NUMBER_PARAM, '0', 0);
6161
test(NUMBER_PARAM, '1', 1);
6262
test(NUMBER_PARAM, '-1', -1);

packages/rest/test/unit/rest.component.unit.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,30 @@ import {
2424
const SequenceActions = RestBindings.SequenceActions;
2525
describe('RestComponent', () => {
2626
describe('Providers', () => {
27-
describe('Default implementations are bound', async () => {
28-
const app = new Application();
29-
app.component(RestComponent);
27+
describe('Default implementations are bound', () => {
28+
let app: Application;
29+
let comp: Component;
3030

31-
// Stub constructor requirements for some providers.
32-
app.bind(RestBindings.Http.CONTEXT).to(new Context());
33-
app.bind(RestBindings.HANDLER).to(new HttpHandler(app));
31+
before(async () => {
32+
app = new Application();
33+
app.component(RestComponent);
34+
35+
// Stub constructor requirements for some providers.
36+
app.bind(RestBindings.Http.CONTEXT).to(new Context());
37+
app.bind(RestBindings.HANDLER).to(new HttpHandler(app));
38+
39+
comp = await app.get<Component>('components.RestComponent');
40+
});
3441

35-
const comp = await app.get<Component>('components.RestComponent');
36-
for (const key in comp.providers || {}) {
37-
it(key, async () => {
38-
const result = await app.get(key);
39-
const expected: Provider<BoundValue> = new comp.providers![key]();
40-
expect(result).to.deepEqual(expected.value());
41-
});
42-
}
42+
it('', async () => {
43+
for (const key in comp.providers || {}) {
44+
it(key, async () => {
45+
const result = await app.get(key);
46+
const expected: Provider<BoundValue> = new comp.providers![key]();
47+
expect(result).to.deepEqual(expected.value());
48+
});
49+
}
50+
});
4351
});
4452
describe('LOG_ERROR', () => {
4553
it('matches expected argument signature', async () => {

0 commit comments

Comments
 (0)