-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server: Fixes #10118: Missing record validation before trying to add …
…item to user (#10471)
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { beforeAllDb, afterAllTests, beforeEachDb, models } from '../utils/testing/testUtils'; | ||
|
||
describe('UserItemModel', () => { | ||
|
||
beforeAll(async () => { | ||
await beforeAllDb('UserItemModel'); | ||
}); | ||
|
||
afterAll(async () => { | ||
await afterAllTests(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await beforeEachDb(); | ||
}); | ||
|
||
test('should throw error if item does not exist', async () => { | ||
const mockUserId = 'not-a-real-user-id'; | ||
const mockId = 'not-a-real-item-id'; | ||
expect(async () => models().userItem().add(mockUserId, mockId)).rejects.toThrow('No such item: not-a-real-item-id'); | ||
}); | ||
}); | ||
|