Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SJIP-868 fix request body #194

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ describe('Express app (without Arranger)', () => {
});

const requestBody = {
gene_symbol: 'LINC01881',
ensembl_gene_id: 'ENSG00000272368.2',
};

it('should return 403 if no Authorization header', () =>
Expand Down Expand Up @@ -640,7 +640,7 @@ describe('Express app (without Arranger)', () => {
.set({ Authorization: `Bearer ${token}` })
.expect(200, sampleGeneExp);
expect((fetchSampleGeneExp as jest.Mock).mock.calls.length).toEqual(1);
expect((fetchSampleGeneExp as jest.Mock).mock.calls[0][0]).toEqual('LINC01881');
expect((fetchSampleGeneExp as jest.Mock).mock.calls[0][0]).toEqual('ENSG00000272368.2');
});

it('should return 500 if Authorization header contains valid token but an error occurs', async () => {
Expand All @@ -658,7 +658,7 @@ describe('Express app (without Arranger)', () => {
.set({ Authorization: `Bearer ${token}` })
.expect(500, { error: 'Internal Server Error' });
expect((fetchSampleGeneExp as jest.Mock).mock.calls.length).toEqual(1);
expect((fetchSampleGeneExp as jest.Mock).mock.calls[0][0]).toEqual('LINC01881');
expect((fetchSampleGeneExp as jest.Mock).mock.calls[0][0]).toEqual('ENSG00000272368.2');
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export default (keycloak: Keycloak, getProject: (projectId: string) => ArrangerP
});

app.postAsync('/transcriptomics/sampleGeneExp', keycloak.protect(), async (req, res) => {
const gene_symbol: string = req.body.gene_symbol;
const data = await fetchSampleGeneExp(gene_symbol);
const ensembl_gene_id: string = req.body.ensembl_gene_id;
const data = await fetchSampleGeneExp(ensembl_gene_id);

res.json(data);
});
Expand Down
Loading