From 50be6d77bba6aa2da076ef2b13af04990139ca50 Mon Sep 17 00:00:00 2001 From: Birk Johansson Date: Tue, 29 Oct 2024 16:35:10 +0100 Subject: [PATCH] fix: add strictEqual checks for test --- .../deduplicate-org-unit-roots.test.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/organisation-unit-tree/src/organisation-unit-tree/deduplicate-org-unit-roots.test.ts b/components/organisation-unit-tree/src/organisation-unit-tree/deduplicate-org-unit-roots.test.ts index 9a289b873..acb1bdb0e 100644 --- a/components/organisation-unit-tree/src/organisation-unit-tree/deduplicate-org-unit-roots.test.ts +++ b/components/organisation-unit-tree/src/organisation-unit-tree/deduplicate-org-unit-roots.test.ts @@ -1,19 +1,21 @@ import { deduplicateOrgUnitRoots } from './deduplicate-org-unit-roots.js' - const unitToPath = { sierra: '/ImspTQPwCqd', tanzania: '/N5hLlID8ihI', ethiopia: '/LK1v9z1Jt3k', 'sierra/bo': '/ImspTQPwCqd/O6uvpzGd5pu', 'sierra/bo/bargbe': '/ImspTQPwCqd/O6uvpzGd5pu/dGheVylzol6', - 'sierra/bo/bargbe/barlie': '/ImspTQPwCqd/O6uvpzGd5pu/dGheVylzol6/y5hLlID8ihI', + 'sierra/bo/bargbe/barlie': + '/ImspTQPwCqd/O6uvpzGd5pu/dGheVylzol6/y5hLlID8ihI', 'sierra/bargbe/barlie': '/ImspTQPwCqd/dGheVylzol6/y5hLlID8ihI', - 'sierra/bargbe/barlie/ngalu': '/ImspTQPwCqd/O6uvpzGd5pu/dGheVylzol6/y5hLlID8ihI/Aj5v9z1Jt3k', + 'sierra/bargbe/barlie/ngalu': + '/ImspTQPwCqd/O6uvpzGd5pu/dGheVylzol6/y5hLlID8ihI/Aj5v9z1Jt3k', 'sierra/bo/baoma': '/ImspTQPwCqd/O6uvpzGd5pu/vWbkYPRmKyS', 'sierra/bo/baoma/faabu': '/ImspTQPwCqd/O6uvpzGd5pu/vWbkYPRmKyS/ZpE2POxvl9P', 'sierra/bo/badjia': '/ImspTQPwCqd/O6uvpzGd5pu/YuQRtpLP10I', - 'sierra/bo/badjia/ngelehun': '/ImspTQPwCqd/O6uvpzGd5pu/YuQRtpLP10I/DiszpKrYNg8', + 'sierra/bo/badjia/ngelehun': + '/ImspTQPwCqd/O6uvpzGd5pu/YuQRtpLP10I/DiszpKrYNg8', 'sierra/bombali': '/ImspTQPwCqd/fdc6uOvgoji', } @@ -37,6 +39,7 @@ describe('findMinimumRootUnits', () => { { path: unitToPath['sierra/bo'], level: 2 }, { path: unitToPath['sierra/bombali'], level: 2 }, ]) + expect(units).toStrictEqual(units) }) it('should return only the root unit when one unit is a child of another', () => { @@ -46,6 +49,7 @@ describe('findMinimumRootUnits', () => { ] const result = deduplicateOrgUnitRoots(units) expect(result).toEqual([{ path: unitToPath['sierra'], level: 1 }]) + expect(units).toStrictEqual(units) }) it('should return only the root unit when one unit is a deep child of another', () => { @@ -55,6 +59,7 @@ describe('findMinimumRootUnits', () => { ] const result = deduplicateOrgUnitRoots(units) expect(result).toEqual([{ path: unitToPath['sierra'], level: 1 }]) + expect(units).toStrictEqual(units) }) it('should return multiple root units when paths do not overlap', () => { @@ -69,6 +74,7 @@ describe('findMinimumRootUnits', () => { { path: unitToPath['tanzania'], level: 1 }, { path: unitToPath['ethiopia'], level: 1 }, ]) + expect(units).toStrictEqual(units) }) it('should return the correct root units when there is a mix of roots and children', () => { @@ -84,6 +90,7 @@ describe('findMinimumRootUnits', () => { { path: unitToPath['sierra/bo/bargbe'], level: 3 }, { path: unitToPath['sierra/bo/badjia/ngelehun'], level: 4 }, ]) + expect(units).toStrictEqual(units) }) it('should return the root units when multiple nested children exist', () => { @@ -99,11 +106,13 @@ describe('findMinimumRootUnits', () => { { path: unitToPath['sierra/bo'], level: 2 }, { path: unitToPath['sierra/bargbe/barlie'], level: 3 }, ]) + expect(units).toStrictEqual(units) }) it('should handle empty input and return an empty array', () => { const units = [] const result = deduplicateOrgUnitRoots(units) expect(result).toEqual([]) + expect(units).toStrictEqual(units) }) })