From 7ab34f5d6d91deda33a612d3c005edbab717d610 Mon Sep 17 00:00:00 2001 From: pfwd Date: Tue, 27 Sep 2022 20:31:02 +0100 Subject: [PATCH] #119 Adding APIClient options tests --- .github/workflows/api-client.yaml | 4 ++++ api-client/tests/unit/api/apiClient.test.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/api-client.yaml b/.github/workflows/api-client.yaml index faa0ef1..e6bdc0e 100644 --- a/.github/workflows/api-client.yaml +++ b/.github/workflows/api-client.yaml @@ -31,6 +31,10 @@ jobs: working-directory: ./api-client run: yarn install + - name: Setting up .environment variables + working-directory: ./api-client + run: cp .env.sample .env + - name: Unit tests working-directory: ./api-client run: yarn run test diff --git a/api-client/tests/unit/api/apiClient.test.ts b/api-client/tests/unit/api/apiClient.test.ts index 95ac30a..5d0dd06 100644 --- a/api-client/tests/unit/api/apiClient.test.ts +++ b/api-client/tests/unit/api/apiClient.test.ts @@ -1,4 +1,6 @@ import apiClient from "../../../src/api/apiClient"; +import * as dotenv from "dotenv" +dotenv.config() describe('API Client headers', () => { it('Should have a content type of application/json', () => { @@ -10,3 +12,9 @@ describe('API Client headers', () => { expect(headers['Accept']).toEqual('application/json') }) }) +describe('API Client options', () => { + it('Should have the base url of ' + process.env.API_BASE_PATH, () => { + let baseURL = apiClient.axiosClient.defaults.baseURL; + expect(baseURL).toEqual(process.env.API_BASE_PATH) + }) +}) \ No newline at end of file