-
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.
feat(model/linked-account): add github oauth class
- Loading branch information
1 parent
63a4a1b
commit 12d7feb
Showing
2 changed files
with
65 additions
and
12 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 |
---|---|---|
|
@@ -138,14 +138,14 @@ void discord() { | |
void twitter() { | ||
final var linkedAccount = read(""" | ||
{ | ||
"type": "twitter_oauth", | ||
"subject": "123456789", | ||
"name": "John Doe", | ||
"username": "johndoe", | ||
"profile_picture_url": "https://pbs.twimg.com/profile_images/x/x.jpg", | ||
"verified_at": 1725376993, | ||
"first_verified_at": 1725376993, | ||
"latest_verified_at": 1725376993 | ||
"type": "twitter_oauth", | ||
"subject": "123456789", | ||
"name": "John Doe", | ||
"username": "johndoe", | ||
"profile_picture_url": "https://pbs.twimg.com/profile_images/x/x.jpg", | ||
"verified_at": 1725376993, | ||
"first_verified_at": 1725376993, | ||
"latest_verified_at": 1725376993 | ||
} | ||
"""); | ||
|
||
|
@@ -162,14 +162,42 @@ void twitter() { | |
assertEquals(date, twitter.getLatestVerifiedAt()); | ||
} | ||
|
||
@Test | ||
void github() { | ||
final var linkedAccount = read(""" | ||
{ | ||
"type": "github_oauth", | ||
"subject": "1234567", | ||
"username": "johndoe", | ||
"email": "[email protected]", | ||
"name": "John Doe", | ||
"verified_at": 1725376993, | ||
"first_verified_at": 1725376993, | ||
"latest_verified_at": 1725376993 | ||
} | ||
"""); | ||
|
||
final var github = assertInstanceOf(LinkedAccount.Github.class, linkedAccount); | ||
|
||
assertEquals("1234567", github.getSubject()); | ||
assertEquals("johndoe", github.getUsername()); | ||
assertEquals("[email protected]", github.getEmail()); | ||
assertEquals("John Doe", github.getName()); | ||
|
||
final var date = new Date(1725376993l * 1000); | ||
assertEquals(date, github.getVerifiedAt()); | ||
assertEquals(date, github.getFirstVerifiedAt()); | ||
assertEquals(date, github.getLatestVerifiedAt()); | ||
} | ||
|
||
@Test | ||
void other() { | ||
final var linkedAccount = read(""" | ||
{ | ||
"type": "unsupported", | ||
"subject": "123456789", | ||
"name": "John Doe", | ||
"verified_at": 1725376993 | ||
"type": "unsupported", | ||
"subject": "123456789", | ||
"name": "John Doe", | ||
"verified_at": 1725376993 | ||
} | ||
"""); | ||
|
||
|