Skip to content

Commit

Permalink
removed uneeded unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ARADDCC002 committed Nov 25, 2024
1 parent 549b3f8 commit 5d5e4f7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
10 changes: 1 addition & 9 deletions backend/src/services/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,7 @@ export async function checkCollaboratorAuthorisation(
if (collaborator === '') {
throw BadReq('Collaborator name must be a valid string')
}
try {
await authentication.getUserInformation(collaborator)
} catch (err) {
if (err instanceof Error && err.name === 'Not Found') {
throw NotFound(`Unable to find user ${collaborator}`, { err })
} else {
throw err
}
}
await authentication.getUserInformation(collaborator)
}),
)
}
Expand Down
18 changes: 0 additions & 18 deletions backend/test/services/model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,6 @@ describe('services > model', () => {
expect(modelMocks.save).not.toBeCalled()
})

test('createModel > should throw an internal error if getUserInformation fails due to invalid user', async () => {
authenticationMocks.getUserInformation.mockImplementation(() => {
throw new Error('Could not find user')
})
expect(() =>
createModel({} as any, { collaborators: [{ entity: 'user:unknown_user', roles: [] }] } as any),
).rejects.toThrowError(/^Unable to find user user:unknown_user/)
})

test('createModel > bad request is thrown when attempting to set both source and destinationModelId simultaneously', async () => {
vi.mocked(authorisation.model).mockResolvedValueOnce({
info: 'You cannot select both settings simultaneously.',
Expand Down Expand Up @@ -336,15 +327,6 @@ describe('services > model', () => {
).rejects.toThrowError(/^You cannot select both mirror settings simultaneously./)
})

test('updateModel > should throw an internal error if getUserInformation fails due to invalid user', async () => {
authenticationMocks.getUserInformation.mockImplementation(() => {
throw new Error('Could not find user')
})
expect(() =>
updateModel({} as any, '123', { collaborators: [{ entity: 'user:unknown_user', roles: [] }] }),
).rejects.toThrowError(/^Unable to find user user:unknown_user/)
})

test('createModelcardFromSchema > should throw an error when attempting to change a model from mirrored to standard', async () => {
vi.mocked(authorisation.model).mockResolvedValue({
info: 'Cannot alter a mirrored model.',
Expand Down

0 comments on commit 5d5e4f7

Please sign in to comment.