Fixed tests and service for async
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-09-24 17:24:41 +07:00
parent 2a4beb0029
commit 5190435b68
5 changed files with 39 additions and 19 deletions

View File

@@ -15,13 +15,13 @@ describe("user", function () {
const bio = "Software Developer";
// create user test
it("createUser", async (done) => {
it("createUser", (done) => {
// create user
await createUser({
createUser({
email: email,
name: name,
})
.then(async (user) => {
.then((user) => {
if (user == null) {
throw Error("user is null");
}
@@ -31,7 +31,7 @@ describe("user", function () {
expect(name).toBe(user.name);
// create profile
await createProfile(user, {
createProfile(user, {
bio: "Software Developer",
})
.then((profile) => {
@@ -50,8 +50,8 @@ describe("user", function () {
});
// check user test
it("checkUser", async (done) => {
await findOneByEmail(email)
it("checkUser", (done) => {
findOneByEmail(email)
.then((user) => {
if (user == null) {
throw Error("user is null");
@@ -66,8 +66,8 @@ describe("user", function () {
});
// check profile included user test
it("checkProfileUser", async (done) => {
await findOneProfileByEmail(email)
it("checkProfileUser", (done) => {
findOneProfileByEmail(email)
.then((profile) => {
if (profile == null) {
throw Error("profile is null");
@@ -83,8 +83,8 @@ describe("user", function () {
});
// try to finish
afterAll(async (done) => {
await prisma.$disconnect();
afterAll((done) => {
prisma.$disconnect();
done();
});