From bda9ae997740355907f352cc20b86a20196ab76c Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Fri, 24 Jan 2025 17:51:48 -0500 Subject: [PATCH] update tests --- src/Common/Constants.ts | 2 +- src/Common/DatabaseAccountUtility.test.ts | 44 +++++++++++++---------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index 5677c3765..92498c6cf 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -101,7 +101,7 @@ export enum WorkloadType { Learning = "Learning", DevelopmentTesting = "Development/Testing", Production = "Production", - None = "None" + None = "None", } // flight names returned from the portal are always lowercase export class Flights { diff --git a/src/Common/DatabaseAccountUtility.test.ts b/src/Common/DatabaseAccountUtility.test.ts index 3941d2329..f60266d95 100644 --- a/src/Common/DatabaseAccountUtility.test.ts +++ b/src/Common/DatabaseAccountUtility.test.ts @@ -4,23 +4,31 @@ import { DatabaseAccount, Tags } from "Contracts/DataModels"; import { updateUserContext } from "UserContext"; describe("Database Account Utility", () => { - describe("Workload Type", () => { - it("Workload Type should return Learning", () => { - updateUserContext({ - databaseAccount: { - tags: { - "hidden-workload-type": WorkloadType.Learning - } as Tags - } as DatabaseAccount - }) + describe("Workload Type", () => { + beforeEach(() => { + updateUserContext({ + databaseAccount: { + tags: {} as Tags, + } as DatabaseAccount, + }); + }); + + it("Workload Type should return Learning", () => { + updateUserContext({ + databaseAccount: { + tags: { + "hidden-workload-type": WorkloadType.Learning, + } as Tags, + } as DatabaseAccount, + }); - const workloadType: WorkloadType = getWorkloadType(); - expect(workloadType).toBe(WorkloadType.Learning); - }); + const workloadType: WorkloadType = getWorkloadType(); + expect(workloadType).toBe(WorkloadType.Learning); + }); - it("Workload Type should return None", () => { - const workloadType: WorkloadType = getWorkloadType(); - expect(workloadType).toBe(WorkloadType.None); - }); - }) -}) \ No newline at end of file + it("Workload Type should return None", () => { + const workloadType: WorkloadType = getWorkloadType(); + expect(workloadType).toBe(WorkloadType.None); + }); + }); +});