From 0a9759935c81d450d9e9125ab69ca58349966a6c Mon Sep 17 00:00:00 2001 From: Issam Mezgueldi Date: Mon, 25 Mar 2024 15:39:55 +0000 Subject: [PATCH] install and use pnpm in the ci pipeline --- .github/workflows/main.yaml | 7 +++++-- src/app.controller.spec.ts | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/app.controller.spec.ts diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a671228..a91f6f6 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,11 +21,14 @@ jobs: with: node-version: 20 + - name: Install PNPM + run: npm install -g pnpm + - name: Install Dependencies - run: npm install + run: pnpm install - name: Run Tests - run: npm test + run: pnpm test - name: Build and Push Docker image run: | diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts new file mode 100644 index 0000000..29c7023 --- /dev/null +++ b/src/app.controller.spec.ts @@ -0,0 +1,22 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { AppController } from './app.controller'; +import { AppService } from './app.service'; + +describe('AppController', () => { + let appController: AppController; + + beforeEach(async () => { + const app: TestingModule = await Test.createTestingModule({ + controllers: [AppController], + providers: [AppService], + }).compile(); + + appController = app.get(AppController); + }); + + describe('root', () => { + it('should return { message: "Hello World!"}', () => { + expect(appController.getHello()).toEqual('Hello World!'); + }); + }); +});