-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61c4624
commit 6a0c7ed
Showing
5 changed files
with
61 additions
and
39 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
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,59 @@ | ||
import { describe, expect } from "@jest/globals"; | ||
import { prismaMock } from "./_mockdb"; | ||
import { newUser } from "../src/service/user.service"; | ||
|
||
|
||
describe("Create a new user", () => { | ||
// it("should create a new post", () => { | ||
// const post = { | ||
// id: "1", | ||
// authorId: "1", | ||
// authorEmail: "authorEmail", | ||
// source: "source", | ||
// destination: "destination", | ||
// costInPoints: 10, | ||
// service: "service", | ||
// } | ||
|
||
// prismaMock.post.create.mockResolvedValue(post); | ||
|
||
// expect(createPost(post)).resolves.toEqual({ | ||
// error: false, | ||
// data: post | ||
// }); | ||
// }); | ||
|
||
it("should return an error if name is not given", () => { | ||
const user = { | ||
id: "1", | ||
name: "", | ||
email: "email", | ||
phoneNumber: "phoneNumber", | ||
karmaPoints: 0 | ||
} | ||
|
||
prismaMock.user.create.mockResolvedValue(user); | ||
|
||
expect(newUser(user)).resolves.toEqual({ | ||
error: true, | ||
data: "User name is required to create profile." | ||
}); | ||
}) | ||
|
||
it("should return an error if name is not given", () => { | ||
const user = { | ||
id: "1", | ||
name: "name", | ||
email: "email", | ||
phoneNumber: "", | ||
karmaPoints: 0 | ||
} | ||
|
||
prismaMock.user.create.mockResolvedValue(user); | ||
|
||
expect(newUser(user)).resolves.toEqual({ | ||
error: true, | ||
data: "Phone Number is required to create profile." | ||
}); | ||
}) | ||
}) |
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 was deleted.
Oops, something went wrong.