Skip to content

Commit

Permalink
test: add end to end tests for details endpoint
Browse files Browse the repository at this point in the history
issue: #283
  • Loading branch information
fengelniederhammer committed Jul 6, 2023
1 parent 74c686f commit 4171a80
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions siloLapisTests/test/details.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { expect } from 'chai';
import { lapisClient } from './common';
import fs from 'fs';
import { SequenceFilters } from './lapisClient';

describe('The /details endpoint', () => {
it('should return details with specified fields', async () => {
const result = await lapisClient.postDetails({
detailsPostRequest: {
pangoLineage: 'B.1.617.2',
fields: ['pango_lineage', 'division'],
},
});

expect(result).to.have.length(2);
expect(result[0]).to.be.deep.equal({
age: undefined,
country: undefined,
date: undefined,
division: 'Aargau',
gisaidEpiIsl: undefined,
pangoLineage: 'B.1.617.2',
qcValue: undefined,
region: undefined,
});
});

it('should return details with all fields when no explicit fields were specified', async () => {
const result = await lapisClient.postDetails({
detailsPostRequest: {
pangoLineage: 'B.1.617.2',
},
});

expect(result).to.have.length(2);
expect(result[0]).to.be.deep.equal({
age: 50,
country: 'Switzerland',
date: '2021-07-19',
division: 'Aargau',
gisaidEpiIsl: 'EPI_ISL_3128811',
pangoLineage: 'B.1.617.2',
qcValue: 0.9,
region: 'Europe',
});
});
});

0 comments on commit 4171a80

Please sign in to comment.