Skip to content

Commit 405a594

Browse files
committed
chore: observerVaraintAnotations - update tests
DEVSU-2471
1 parent 0d0e9d7 commit 405a594

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

test/routes/report/observedVariantAnnotations.test.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const HTTP_STATUS = require('http-status-codes');
1+
const {StatusCodes} = require('http-status-codes');
22

33
const supertest = require('supertest');
44
const getPort = require('get-port');
@@ -34,7 +34,7 @@ const getVariantByIdent = async (ident, reportIdent) => {
3434
.query()
3535
.auth(username, password)
3636
.type('json')
37-
.expect(HTTP_STATUS.OK);
37+
.expect(StatusCodes.OK);
3838

3939
const checkVar = allVars.body.filter((item) => {
4040
return item.ident === ident;
@@ -86,7 +86,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
8686
.query({rapidTable: 'therapeuticAssociation'})
8787
.auth(username, password)
8888
.type('json')
89-
.expect(HTTP_STATUS.OK);
89+
.expect(StatusCodes.OK);
9090

9191
const allvars = res.body.filter((variant) => {
9292
return variant.variantType === 'cnv'; // choose a random nontherapeutic example
@@ -102,7 +102,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
102102
variantIdent: variant.ident,
103103
annotations: {rapidReportTableTag: 'cancerRelevance'},
104104
})
105-
.expect(HTTP_STATUS.CREATED);
105+
.expect(StatusCodes.CREATED);
106106

107107
const checkVar = await getVariantByIdent(variant.ident, rapidReportIdent.ident);
108108
const annotation = checkVar.observedVariantAnnotation;
@@ -120,7 +120,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
120120
variantIdent: 'hello',
121121
annotations: {rapidReportTableTag: 'therapeutic'},
122122
})
123-
.expect(HTTP_STATUS.BAD_REQUEST);
123+
.expect(StatusCodes.BAD_REQUEST);
124124
});
125125

126126
test('Does not create new annotation with fake variant type- OK', async () => {
@@ -133,7 +133,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
133133
variantIdent: 'hello',
134134
annotations: {rapidReportTableTag: 'therapeutic'},
135135
})
136-
.expect(HTTP_STATUS.BAD_REQUEST);
136+
.expect(StatusCodes.BAD_REQUEST);
137137
});
138138

139139
test('Does not create new annotation when variant already has one - OK', async () => {
@@ -142,7 +142,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
142142
.query({rapidTable: 'unknownSignificance'})
143143
.auth(username, password)
144144
.type('json')
145-
.expect(HTTP_STATUS.OK);
145+
.expect(StatusCodes.CONFLICT);
146146

147147
const allvars = res.body.filter((variant) => {
148148
return variant.variantType === 'mut';
@@ -158,7 +158,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
158158
variantIdent: variant.ident,
159159
annotations: {rapidReportTableTag: 'therapeutic'},
160160
})
161-
.expect(HTTP_STATUS.CREATED);
161+
.expect(StatusCodes.CREATED);
162162

163163
await request
164164
.post(`/api/reports/${rapidReportIdent.ident}/observed-variant-annotations`)
@@ -169,7 +169,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
169169
variantIdent: variant.ident,
170170
annotations: {rapidReportTableTag: 'cancerRelevance'},
171171
})
172-
.expect(HTTP_STATUS.BAD_REQUEST);
172+
.expect(StatusCodes.BAD_REQUEST);
173173
});
174174
});
175175

@@ -181,7 +181,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
181181
.query({rapidTable: 'unknownSignificance'})
182182
.auth(username, password)
183183
.type('json')
184-
.expect(HTTP_STATUS.OK);
184+
.expect(StatusCodes.OK);
185185

186186
const allvars = res.body.filter((variant) => {
187187
return variant.variantType === 'mut';
@@ -201,7 +201,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
201201
variantIdent: origVariant.ident,
202202
annotations,
203203
})
204-
.expect(HTTP_STATUS.CREATED);
204+
.expect(StatusCodes.CREATED);
205205

206206
// get the created variant annotation and check it's correct
207207
const createdVar = await getVariantByIdent(origVariant.ident, rapidReportIdent.ident);
@@ -219,7 +219,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
219219
.send({
220220
annotations,
221221
})
222-
.expect(HTTP_STATUS.OK);
222+
.expect(StatusCodes.OK);
223223

224224
// get the new variant data
225225
const updatedVar = await getVariantByIdent(origVariant.ident, rapidReportIdent.ident);
@@ -239,7 +239,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
239239
.get(`/api/reports/${reportIdent.ident}/${endpt}`)
240240
.auth(username, password)
241241
.type('json')
242-
.expect(HTTP_STATUS.OK);
242+
.expect(StatusCodes.OK);
243243

244244
let record;
245245
let annotation;
@@ -262,7 +262,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
262262
variantIdent: record.ident,
263263
annotations,
264264
})
265-
.expect(HTTP_STATUS.CREATED);
265+
.expect(StatusCodes.CREATED);
266266

267267
let url = `/api/reports/${reportIdent.ident}/${endpt}/${record.ident}`;
268268
if (variantType === 'tmb') {
@@ -273,7 +273,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
273273
.get(url)
274274
.auth(username, password)
275275
.type('json')
276-
.expect(HTTP_STATUS.OK);
276+
.expect(StatusCodes.OK);
277277
const record2 = res2.body;
278278
expect(record2.observedVariantAnnotation.annotations.testTag).toEqual(annotations.testTag);
279279
});
@@ -283,7 +283,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
283283
.get(`/api/reports/${reportIdent.ident}/variants`)
284284
.auth(username, password)
285285
.type('json')
286-
.expect(HTTP_STATUS.OK);
286+
.expect(StatusCodes.OK);
287287

288288
expect(Array.isArray(res.body)).toBe(true);
289289

@@ -307,13 +307,13 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
307307
variantIdent: record.ident,
308308
annotations,
309309
})
310-
.expect(HTTP_STATUS.CREATED);
310+
.expect(StatusCodes.CREATED);
311311

312312
const res2 = await request
313313
.get(`/api/reports/${reportIdent.ident}/variants`)
314314
.auth(username, password)
315315
.type('json')
316-
.expect(HTTP_STATUS.OK);
316+
.expect(StatusCodes.OK);
317317
const updatedRecord = res2.body.filter((variant) => {
318318
return variant.ident === record.ident;
319319
})[0];
@@ -325,7 +325,7 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
325325
.get(`/api/reports/${rapidReportIdent.ident}/variants`)
326326
.auth(username, password)
327327
.type('json')
328-
.expect(HTTP_STATUS.OK);
328+
.expect(StatusCodes.OK);
329329

330330
expect(Array.isArray(res.body)).toBe(true);
331331

@@ -347,14 +347,14 @@ describe('/reports/{REPORTID}/observed-variant-annotations', () => {
347347
variantIdent: record.ident,
348348
annotations: {rapidReportTableTag: 'cancerRelevance', testTag: 'testValue'},
349349
})
350-
.expect(HTTP_STATUS.CREATED);
350+
.expect(StatusCodes.CREATED);
351351

352352
const res2 = await request
353353
.get(`/api/reports/${rapidReportIdent.ident}/variants`)
354354
.query({rapidTable: 'cancerRelevance'})
355355
.auth(username, password)
356356
.type('json')
357-
.expect(HTTP_STATUS.OK);
357+
.expect(StatusCodes.OK);
358358
const updatedRecord = res2.body.filter((variant) => {
359359
return variant.ident === record.ident;
360360
})[0];

0 commit comments

Comments
 (0)