From 19c365d1b1dcf143d4a1c151d2bc1e66fd7a39ba Mon Sep 17 00:00:00 2001 From: Dave Gordon Date: Tue, 28 May 2024 22:43:14 +0100 Subject: [PATCH] [integration] chore: Rename integration tests --- ...ckend-unit-tests.yml => backend-integration-tests.yml} | 4 ++-- README.md | 4 ++-- backend/README.md | 8 ++++---- backend/package.json | 4 ++-- backend/tests/{unit => integration}/login.spec.ts | 0 backend/tests/{unit => integration}/mocks/notes.mock.ts | 0 backend/tests/{unit => integration}/mocks/users.mock.ts | 0 backend/tests/{unit => integration}/notes.spec.ts | 0 backend/tests/{unit => integration}/primsa.spec.ts | 0 backend/tests/{unit => integration}/users.spec.ts | 0 ...test.config.unit.mts => vitest.config.integration.mts} | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) rename .github/workflows/{backend-unit-tests.yml => backend-integration-tests.yml} (90%) rename backend/tests/{unit => integration}/login.spec.ts (100%) rename backend/tests/{unit => integration}/mocks/notes.mock.ts (100%) rename backend/tests/{unit => integration}/mocks/users.mock.ts (100%) rename backend/tests/{unit => integration}/notes.spec.ts (100%) rename backend/tests/{unit => integration}/primsa.spec.ts (100%) rename backend/tests/{unit => integration}/users.spec.ts (100%) rename backend/{vitest.config.unit.mts => vitest.config.integration.mts} (88%) diff --git a/.github/workflows/backend-unit-tests.yml b/.github/workflows/backend-integration-tests.yml similarity index 90% rename from .github/workflows/backend-unit-tests.yml rename to .github/workflows/backend-integration-tests.yml index 570d9050..37702958 100644 --- a/.github/workflows/backend-unit-tests.yml +++ b/.github/workflows/backend-integration-tests.yml @@ -1,4 +1,4 @@ -name: Backend Unit Tests +name: Backend Integration Tests on: push: @@ -33,7 +33,7 @@ jobs: npm ci npm run build - - name: Unit Tests with Coverage + - name: Integration Tests with Coverage run: npm run test:coverage - name: Coverage Report diff --git a/README.md b/README.md index ee658e66..9511d82e 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,10 @@ Refactored the app for testability and added a few additional tweaks. ### BE Tests [![Backend Service Tests](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-service-tests.yml/badge.svg)](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-service-tests.yml) -[![Backend Unit Tests](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-unit-tests.yml/badge.svg)](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-unit-tests.yml) +[![Backend Integration Tests](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-integration-tests.yml/badge.svg)](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-integration-tests.yml) - Service tests with docker, [supertest](https://github.com/ladjs/supertest) and [vitest](https://vitest.dev/) -- Unit tests with [supertest](https://github.com/ladjs/supertest), [vitest](https://vitest.dev/) and [vitest-mock-extended](https://github.com/eratio08/vitest-mock-extended) +- Integration tests with [supertest](https://github.com/ladjs/supertest), [vitest](https://vitest.dev/) and [vitest-mock-extended](https://github.com/eratio08/vitest-mock-extended) ### Contract Tests [![Backend Contract Tests](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-contract-tests.yml/badge.svg)](https://github.com/helloitsdave/notes-app-full-stack-testing/actions/workflows/backend-contract-tests.yml) diff --git a/backend/README.md b/backend/README.md index 46297846..eb79ac49 100644 --- a/backend/README.md +++ b/backend/README.md @@ -26,17 +26,17 @@ npm run docker:down ## Test Execution -### Unit Tests +### Integration Tests -Execute the unit tests +Execute the integration tests ```bash npm run test ``` -### Unit Tests with Coverage +### Integration Tests with Coverage -Execute the unit tests with coverage +Execute the integration tests with coverage ```bash npm run test:coverage diff --git a/backend/package.json b/backend/package.json index 961787fd..2e1b3466 100644 --- a/backend/package.json +++ b/backend/package.json @@ -5,8 +5,8 @@ "main": "dist/index.js", "scripts": { "test:service": "npx vitest **/service/*.spec.ts", - "test:unit": "npx vitest -c ./vitest.config.unit.mts", - "test:coverage": "npx vitest **/unit/*.spec.ts --coverage", + "test:integration": "npx vitest -c ./vitest.config.integration.mts", + "test:coverage": "npx vitest **/integration/*.spec.ts --coverage", "test:contract": "npx vitest --testTimeout 30000 **/contract/*.spec.ts", "start:local": "npx nodemon", "start": "node dist/index.js", diff --git a/backend/tests/unit/login.spec.ts b/backend/tests/integration/login.spec.ts similarity index 100% rename from backend/tests/unit/login.spec.ts rename to backend/tests/integration/login.spec.ts diff --git a/backend/tests/unit/mocks/notes.mock.ts b/backend/tests/integration/mocks/notes.mock.ts similarity index 100% rename from backend/tests/unit/mocks/notes.mock.ts rename to backend/tests/integration/mocks/notes.mock.ts diff --git a/backend/tests/unit/mocks/users.mock.ts b/backend/tests/integration/mocks/users.mock.ts similarity index 100% rename from backend/tests/unit/mocks/users.mock.ts rename to backend/tests/integration/mocks/users.mock.ts diff --git a/backend/tests/unit/notes.spec.ts b/backend/tests/integration/notes.spec.ts similarity index 100% rename from backend/tests/unit/notes.spec.ts rename to backend/tests/integration/notes.spec.ts diff --git a/backend/tests/unit/primsa.spec.ts b/backend/tests/integration/primsa.spec.ts similarity index 100% rename from backend/tests/unit/primsa.spec.ts rename to backend/tests/integration/primsa.spec.ts diff --git a/backend/tests/unit/users.spec.ts b/backend/tests/integration/users.spec.ts similarity index 100% rename from backend/tests/unit/users.spec.ts rename to backend/tests/integration/users.spec.ts diff --git a/backend/vitest.config.unit.mts b/backend/vitest.config.integration.mts similarity index 88% rename from backend/vitest.config.unit.mts rename to backend/vitest.config.integration.mts index 1e0857b5..fe4909c0 100644 --- a/backend/vitest.config.unit.mts +++ b/backend/vitest.config.integration.mts @@ -4,7 +4,7 @@ const isCI = process.env.CI === "true"; export default defineConfig({ test: { - include: ['tests/unit/*.spec.ts'], + include: ['tests/integration/*.spec.ts'], coverage: { provider: 'istanbul', // or 'v8' reporter: isCI ? ["lcov", "text-summary"] : ["text","text-summary"],