Skip to content

Commit

Permalink
fix: add strictEqual checks for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Oct 29, 2024
1 parent bcd9bd4 commit 50be6d7
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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',
}

Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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)
})
})

0 comments on commit 50be6d7

Please sign in to comment.