Skip to content

Commit

Permalink
fix: Remove invalid imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen-plug committed Sep 21, 2021
1 parent 539f2d6 commit 651d285
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .idea/runConfigurations/All_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions packages/easy-mongo/test/Collection.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { convert, Field, Json } from '@thisisagile/easy';
import '@thisisagile/easy-test';
import moment from 'moment';
import { DevCollection } from './ref/DevCollection';
import { DevDatabase } from '@thisisagile/easy/test/ref';
import { Collection } from '../src';
Expand Down Expand Up @@ -49,11 +48,11 @@ describe('Collection', () => {
name: 'Dries',
CodingLevel: '6',
languages: ['Java', 'Typescript'],
date: moment('1992-03-25T22:39:44.000Z').toDate(),
dates: [moment('1992-03-25T22:55:44.000Z').toDate()],
date: new Date('1992-03-25T22:39:44.000Z'),
dates: [new Date('1992-03-25T22:55:44.000Z')],
created: {
by: { id: '5555', date: moment('1980-11-22T05:12:50.000Z').toDate() },
when: moment('2021-05-27T08:15:04.000Z').toDate(),
by: { id: '5555', date: new Date('1980-11-22T05:12:50.000Z') },
when: new Date('2021-05-27T08:15:04.000Z'),
},
};
const out: any = test.out(input);
Expand Down
18 changes: 11 additions & 7 deletions packages/easy-test/test/mock/Mock.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mock } from '../../src';
import { HttpStatus } from '@thisisagile/easy';
import { HttpStatus } from '../../src/utils/Response';

describe('mock', () => {
const version = 'Version 42';
Expand Down Expand Up @@ -158,19 +158,23 @@ describe('mock', () => {
});

test('get props from resp', () => {
const resp = mock.resp.items(HttpStatus.Ok, [project]);
expect(resp.status).toBe(HttpStatus.Ok);
expect(resp.body?.data?.code).toBe(200);
const ok = { id: 200, name: "OK" } as HttpStatus;
const resp = mock.resp.items(ok, [project]);

expect(resp.status).toBe(ok);
expect(resp.body?.data?.code).toBe(ok.id);
expect(resp.body?.error).toBeUndefined();
expect(resp.body?.data?.itemCount).toBe(1);
expect(resp.body?.data?.items).toContain(project);
});

test('get props from error resp', () => {
const resp = mock.resp.errors(HttpStatus.InternalServerError, 'u fool', ['error', 'error two']);
expect(resp.status).toBe(HttpStatus.InternalServerError);
const serverError = { id: 500, name: "Internal Server Error" } as HttpStatus;
const resp = mock.resp.errors(serverError, 'u fool', ['error', 'error two']);

expect(resp.status).toBe(serverError);
expect(resp.body?.data).toBeUndefined();
expect(resp.body?.error?.code).toBe(500);
expect(resp.body?.error?.code).toBe(serverError.id);
expect(resp.body?.error?.errorCount).toBe(2);
expect(resp.body?.error?.errors).toContain('error');
expect(resp.body?.error?.errors).toContain('error two');
Expand Down

0 comments on commit 651d285

Please sign in to comment.