From 858cc098de7456088e4f01479c5cd7ee5d51bb59 Mon Sep 17 00:00:00 2001 From: anmol thapar <mr.anmolthapar@gmail.com> Date: Thu, 16 Jan 2025 10:09:21 +0000 Subject: [PATCH] unit + integration tests --- .github/workflows/playwrightCI.yml | 4 +-- app/client-v2/src/__tests__/App.spec.ts | 1 - .../src/__tests__/stores/projectStore.spec.ts | 28 ++++++++++++++++++- .../__tests__/utils/projectCsvUtils.spec.ts | 10 +++---- app/server/tests/integration/testSample.ts | 10 +++++++ 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/.github/workflows/playwrightCI.yml b/.github/workflows/playwrightCI.yml index c2212dffb..f049ec3b3 100644 --- a/.github/workflows/playwrightCI.yml +++ b/.github/workflows/playwrightCI.yml @@ -12,7 +12,7 @@ on: jobs: playwright-tests: timeout-minutes: 60 - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest env: STORAGE_PATH: ${{ github.workspace }}/storage/dbs strategy: @@ -75,7 +75,7 @@ jobs: if: ${{ !cancelled() }} needs: [playwright-tests] - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/app/client-v2/src/__tests__/App.spec.ts b/app/client-v2/src/__tests__/App.spec.ts index 97c1e9867..abcb381fc 100644 --- a/app/client-v2/src/__tests__/App.spec.ts +++ b/app/client-v2/src/__tests__/App.spec.ts @@ -4,7 +4,6 @@ import { createTestingPinia } from "@pinia/testing"; import { render, screen } from "@testing-library/vue"; import { defineComponent } from "vue"; import { createRouter, createWebHistory } from "vue-router"; -import PrimeVue from "primevue/config"; const mockedThemeValues = { setInitialTheme: vitest.fn(), diff --git a/app/client-v2/src/__tests__/stores/projectStore.spec.ts b/app/client-v2/src/__tests__/stores/projectStore.spec.ts index 5a10f1668..da991b487 100644 --- a/app/client-v2/src/__tests__/stores/projectStore.spec.ts +++ b/app/client-v2/src/__tests__/stores/projectStore.spec.ts @@ -698,7 +698,33 @@ describe("projectStore", () => { [MOCK_PROJECT_SAMPLES[0].hash]: MOCK_PROJECT_SAMPLES[0].sketch, [MOCK_PROJECT_SAMPLES[1].hash]: MOCK_PROJECT_SAMPLES[1].sketch, [MOCK_PROJECT_SAMPLES[2].hash]: MOCK_PROJECT_SAMPLES[2].sketch - } + }, + amrForMetadataCsv: [ + { + "Chloramphenicol Resistance": "Probably", + "Cotrim Resistance": "Probably not", + "Erythromycin Resistance": "Probably not", + ID: "sample1-test-hash", + "Penicillin Resistance": "Unlikely", + "Tetracycline Resistance": "Highly unlikely" + }, + { + "Chloramphenicol Resistance": "Probably", + "Cotrim Resistance": "Almost certainly", + "Erythromycin Resistance": "Almost certainly", + ID: "sample2-test-hash", + "Penicillin Resistance": "Highly unlikely", + "Tetracycline Resistance": "Highly unlikely" + }, + { + "Chloramphenicol Resistance": "Probably", + "Cotrim Resistance": "Unlikely", + "Erythromycin Resistance": "Probably not", + ID: "sample3-test-hash", + "Penicillin Resistance": "Probably", + "Tetracycline Resistance": "Highly unlikely" + } + ] }); }); it("should get download url & download when downloadZip is called", async () => { diff --git a/app/client-v2/src/__tests__/utils/projectCsvUtils.spec.ts b/app/client-v2/src/__tests__/utils/projectCsvUtils.spec.ts index f81117a8d..0848b6ed9 100644 --- a/app/client-v2/src/__tests__/utils/projectCsvUtils.spec.ts +++ b/app/client-v2/src/__tests__/utils/projectCsvUtils.spec.ts @@ -53,11 +53,11 @@ describe("projectCsvUtils", () => { const result = convertAmrForCsv(amr); expect(result).toEqual({ - Penicillin: "word", - Chloramphenicol: "word", - Erythromycin: "word", - Tetracycline: "word", - Cotrim: "word" + "Penicillin Resistance": "word", + "Chloramphenicol Resistance": "word", + "Erythromycin Resistance": "word", + "Tetracycline Resistance": "word", + "Cotrim Resistance": "word" }); }); }); diff --git a/app/server/tests/integration/testSample.ts b/app/server/tests/integration/testSample.ts index 0b1ffa881..c3e3ecbb8 100644 --- a/app/server/tests/integration/testSample.ts +++ b/app/server/tests/integration/testSample.ts @@ -13135,4 +13135,14 @@ export const testSample = ( }, }, names: { fd38a3bc7197390fd3734240a67fb515: "7622_5#78.fa" }, + amrForMetadataCsv: [ + { + ID: "fd38a3bc7197390fd3734240a67fb515", + "Penicillin Resistance": "Highly unlikely", + "Chloramphenicol Resistance": "Unsure", + "Erythromycin Resistance": "Highly unlikely", + "Tetracycline Resistance": "Almost certainly", + "Cotrim Resistance": "Highly likely", + }, + ], });