Skip to content

Commit 197b385

Browse files
authored
small test improvements for getMapsOfUser (#1136)
1 parent f73b5b9 commit 197b385

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

teammapper-backend/src/map/controllers/maps.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('MapsController', () => {
131131
})
132132

133133
it('should return an empty array when req is undefined', async () => {
134-
const response = await mapsController.findAll(undefined)
134+
const response = await mapsController.findAll()
135135
expect(response).toEqual([])
136136
})
137137
})

teammapper-backend/src/map/services/maps.service.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -947,19 +947,25 @@ describe('MapsService', () => {
947947

948948
it('returns [] if the id is the string undefined', async () => {
949949
await mapsRepo.save({ ownerExternalId: undefined })
950-
const result = await mapsService.getMapsOfUser('undefined')
950+
const result = await mapsService.getMapsOfUser(undefined as unknown as string)
951951
expect(result).toEqual([])
952952
})
953953

954954
it('returns [] if the id is the string null', async () => {
955955
await mapsRepo.save({ ownerExternalId: null })
956-
const result = await mapsService.getMapsOfUser('null')
956+
const result = await mapsService.getMapsOfUser(null as unknown as string)
957957
expect(result).toEqual([])
958958
})
959959

960-
it('returns [] if the id is an empty array []', async () => {
960+
it('returns [] if the id is an empty string', async () => {
961961
await mapsRepo.save({ ownerExternalId: undefined })
962-
const result = await mapsService.getMapsOfUser('[]')
962+
const result = await mapsService.getMapsOfUser('')
963+
expect(result).toEqual([])
964+
})
965+
966+
it('returns [] if the id is an empty array', async () => {
967+
await mapsRepo.save({ ownerExternalId: undefined })
968+
const result = await mapsService.getMapsOfUser([] as unknown as string)
963969
expect(result).toEqual([])
964970
})
965971

0 commit comments

Comments
 (0)