generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- For UserServiceAPI
- Loading branch information
Showing
5 changed files
with
293 additions
and
254 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 |
---|---|---|
|
@@ -25,6 +25,10 @@ const { | |
isUserLoggedIn, | ||
} = require("../../Authentication/AuthenticationState"); | ||
|
||
afterAll(async () => { | ||
await deleteUser(); | ||
}); | ||
|
||
test("Test User Registration Flow", async () => { | ||
return registerUser( | ||
"Test Name", | ||
|
@@ -33,11 +37,46 @@ test("Test User Registration Flow", async () => { | |
"TestGitHubId", | ||
"TestLanguage" | ||
).then(async (data) => { | ||
expect(data).toBe(true); | ||
expect(data.success).toBe(true); | ||
|
||
expect(await isUserLoggedIn()).toBe(true); | ||
expect(getUserName()).toBe("Test Name"); | ||
|
||
expect(getFirebaseUserCredentials).not.toBe(null); | ||
}); | ||
}); | ||
|
||
test("Test User Logout Flow", async () => { | ||
return logoutUser().then((data) => { | ||
expect(data).toBe(true); | ||
}); | ||
}); | ||
|
||
test("Test User Login Flow", async () => { | ||
return loginUser("[email protected]", "Password123").then(async (data) => { | ||
expect(data).toBe(true); | ||
|
||
expect(getUserName()).toBe("Test Name"); | ||
expect(getUserEmail()).toBe("[email protected]"); | ||
expect(getUserPreferredLanguage()).toBe("TestLanguage"); | ||
expect(getUserGithubId()).toBe("TestGitHubId"); | ||
expect(await isUserAdmin()).toBe(false); | ||
}); | ||
}); | ||
|
||
test("Test User Data Update Flow", async () => { | ||
return updateUserData( | ||
"Updated Name", | ||
"[email protected]", | ||
"UpdatedGitHubId", | ||
"UpdatedTestLanguage" | ||
).then(async (data) => { | ||
expect(data).toBe(true); | ||
|
||
expect(getUserName()).toBe("Updated Name"); | ||
expect(getUserEmail()).toBe("[email protected]"); | ||
expect(getUserPreferredLanguage()).toBe("UpdatedTestLanguage"); | ||
expect(getUserGithubId()).toBe("UpdatedGitHubId"); | ||
expect(await isUserAdmin()).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.