Skip to content

Commit

Permalink
chore: fix test cases to be compatible with mocha@6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Jan 30, 2019
1 parent c601c4c commit a4c2086
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('relation repository', () => {
});
});

context('patch', async () => {
context('patch', () => {
it('can patch related model instance', async () => {
const constraint: Partial<Customer> = {name: 'Jane'};
const hasManyCrudInstance = givenDefaultHasManyInstance(constraint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('API Explorer (acceptance)', () => {
});
});

context('with custom RestServerConfig', async () => {
context('with custom RestServerConfig', () => {
it('honours custom OpenAPI path', async () => {
await givenAppWithCustomRestConfig({
openApiSpec: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('coerce param from string to number - required', () => {
});

describe('coerce param from string to number - optional', () => {
context('valid values', async () => {
context('valid values', () => {
test(NUMBER_PARAM, '0', 0);
test(NUMBER_PARAM, '1', 1);
test(NUMBER_PARAM, '-1', -1);
Expand Down
36 changes: 22 additions & 14 deletions packages/rest/test/unit/rest.component.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,30 @@ import {
const SequenceActions = RestBindings.SequenceActions;
describe('RestComponent', () => {
describe('Providers', () => {
describe('Default implementations are bound', async () => {
const app = new Application();
app.component(RestComponent);
describe('Default implementations are bound', () => {
let app: Application;
let comp: Component;

// Stub constructor requirements for some providers.
app.bind(RestBindings.Http.CONTEXT).to(new Context());
app.bind(RestBindings.HANDLER).to(new HttpHandler(app));
before(async () => {
app = new Application();
app.component(RestComponent);

// Stub constructor requirements for some providers.
app.bind(RestBindings.Http.CONTEXT).to(new Context());
app.bind(RestBindings.HANDLER).to(new HttpHandler(app));

comp = await app.get<Component>('components.RestComponent');
});

const comp = await app.get<Component>('components.RestComponent');
for (const key in comp.providers || {}) {
it(key, async () => {
const result = await app.get(key);
const expected: Provider<BoundValue> = new comp.providers![key]();
expect(result).to.deepEqual(expected.value());
});
}
it('', async () => {
for (const key in comp.providers || {}) {
it(key, async () => {
const result = await app.get(key);
const expected: Provider<BoundValue> = new comp.providers![key]();
expect(result).to.deepEqual(expected.value());
});
}
});
});
describe('LOG_ERROR', () => {
it('matches expected argument signature', async () => {
Expand Down

0 comments on commit a4c2086

Please sign in to comment.