Skip to content

Commit

Permalink
refactor(annotation-server): rename tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Jul 26, 2022
1 parent f10e9fa commit 9dff6f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Medication Entity', () => {
expect(medication.synonyms.length).toBe(2);
});

it('should able to handle only one external-identifier and international-brand', () => {
it('should handle only one external-identifier and international-brand', () => {
const exampleDrug = new DrugDto();
exampleDrug.name = exampleName;
exampleDrug.description = exampleDescription;
Expand Down
28 changes: 14 additions & 14 deletions annotation-server/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ describe('App (e2e)', () => {
expect(createResponse.status).toEqual(400);
});

it(`should verify guidelines haven't been fetched`, async () => {
it(`should get null for last guideline update`, async () => {
const getResponse = await request(app.getHttpServer()).get(
'/guidelines/last_update',
);
expect(getResponse.status).toEqual(200);
expect(new Date(getResponse.body).getTime()).toBeNaN();
});

it(`should verify medications haven't been fetched`, async () => {
it(`should get null for last medication update`, async () => {
const getResponse = await request(app.getHttpServer()).get(
'/medications/last_update',
);
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('App (e2e)', () => {
}, 30000);
});

describe('Retrieve data for all medications & guidelines', () => {
describe('get data for all medications & guidelines', () => {
const verifyLastUpdate = (dateString: string) => {
const lastUpdate = new Date(dateString).getTime();
const now = new Date().getTime();
Expand All @@ -85,23 +85,23 @@ describe('App (e2e)', () => {
expect(interval).toBeLessThanOrEqual(5 * 60 * 1000);
};

it('should verify guidelines have been fetched in the last 5 minutes', async () => {
it('should get last guideline update date within the last 5 minutes', async () => {
const getResponse = await request(app.getHttpServer()).get(
'/guidelines/last_update',
);
expect(getResponse.status).toEqual(200);
verifyLastUpdate(getResponse.body);
});

it('should verify medications have been fetched in the last 5 minutes', async () => {
it('should get last medication update date within the last 5 minutes', async () => {
const getResponse = await request(app.getHttpServer()).get(
'/medications/last_update',
);
expect(getResponse.status).toEqual(200);
verifyLastUpdate(getResponse.body);
});

it('should verify that data errors have been saved', async () => {
it('should get more than 0 data errors', async () => {
const getResponse = await request(app.getHttpServer()).get(
'/guidelines/errors',
);
Expand All @@ -124,7 +124,7 @@ describe('App (e2e)', () => {
codeineId = getResponse.body[1].id;
});

it('should return 3 medication ids', async () => {
it('should get 3 medication ids', async () => {
const getResponse = await request(app.getHttpServer())
.get('/medications')
.query({ onlyIds: true });
Expand All @@ -140,15 +140,15 @@ describe('App (e2e)', () => {
expect(getResponse.body.length).toEqual(2);
});

it('should return 2 medications matching a search query', async () => {
it('should get 2 medications matching a search query', async () => {
const getResponse = await request(app.getHttpServer())
.get('/medications')
.query({ search: 'cod' });
expect(getResponse.status).toEqual(200);
expect(getResponse.body.length).toEqual(2);
});

it('should return 1 medications matching a search query with guidelines', async () => {
it('should get 1 medication matching a search query with guidelines', async () => {
const getResponse = await request(app.getHttpServer())
.get('/medications')
.query({
Expand All @@ -171,8 +171,8 @@ describe('App (e2e)', () => {
});
});

describe('Retrieve data for a specific medication', () => {
it('should verify details for one medication', async () => {
describe('Get data for a specific medication', () => {
it('should get correct details for one medication', async () => {
const getResponse = await request(app.getHttpServer()).get(
'/medications/' + codeineId,
);
Expand All @@ -188,7 +188,7 @@ describe('App (e2e)', () => {
expect(getResponse.status).toEqual(200);
});

it('should verify guidelines for one medication', async () => {
it('should get correct guidelines for one medication', async () => {
const getResponse = await request(app.getHttpServer())
.get('/medications/' + codeineId)
.query({ getGuidelines: true });
Expand Down Expand Up @@ -230,7 +230,7 @@ describe('App (e2e)', () => {
});

describe('Verify modified data', () => {
it('should verify details for one medication', async () => {
it('should get correct details for one medication', async () => {
const getResponse = await request(app.getHttpServer()).get(
'/medications/' + codeineId,
);
Expand All @@ -239,7 +239,7 @@ describe('App (e2e)', () => {
expect(getResponse.body.indication).toEqual('Codeine/indication');
});

it('should verify details for one medication', async () => {
it('should get correct details for one medication', async () => {
const getResponse = await request(app.getHttpServer()).get(
'/guidelines/' + guidelineId,
);
Expand Down

0 comments on commit 9dff6f3

Please sign in to comment.