Create failing test in test-libraries
This commit is contained in:
parent
6495a84ff9
commit
8944b0908b
|
@ -36,26 +36,7 @@ describe("UserDB", () => {
|
||||||
describe("save", () => {
|
describe("save", () => {
|
||||||
describe("create", () => {
|
describe("create", () => {
|
||||||
it("creating a new user will persist it", async () => {
|
it("creating a new user will persist it", async () => {
|
||||||
const email = generator.email({})
|
throw new Error("oh no")
|
||||||
const user: User = structures.users.user({
|
|
||||||
email,
|
|
||||||
tenantId: config.getTenantId(),
|
|
||||||
})
|
|
||||||
|
|
||||||
await config.doInTenant(async () => {
|
|
||||||
const saveUserResponse = await db.save(user)
|
|
||||||
|
|
||||||
const persistedUser = await db.getUserByEmail(email)
|
|
||||||
expect(persistedUser).toEqual({
|
|
||||||
...user,
|
|
||||||
_id: saveUserResponse._id,
|
|
||||||
_rev: expect.stringMatching(/^1-\w+/),
|
|
||||||
password: expect.not.stringMatching(user.password!),
|
|
||||||
status: UserStatus.ACTIVE,
|
|
||||||
createdAt: Date.now(),
|
|
||||||
updatedAt: new Date().toISOString(),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("the same email cannot be used twice in the same tenant", async () => {
|
it("the same email cannot be used twice in the same tenant", async () => {
|
||||||
|
|
Loading…
Reference in New Issue