forked from bluesky-social/atproto
-
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.
apply basic email validation to createAccount (bluesky-social#1658)
* apply basic email validation to createAccount * format
- Loading branch information
1 parent
e07c299
commit cc045f5
Showing
4 changed files
with
45 additions
and
0 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 |
---|---|---|
|
@@ -76,6 +76,28 @@ describe('account', () => { | |
await expect(promise).rejects.toThrow('Input/handle must be a valid handle') | ||
}) | ||
|
||
describe('email validation', () => { | ||
it('succeeds on allowed emails', async () => { | ||
const promise = agent.api.com.atproto.server.createAccount({ | ||
email: '[email protected]', | ||
handle: 'ok-email.test', | ||
password: 'asdf', | ||
}) | ||
await expect(promise).resolves.toBeTruthy() | ||
}) | ||
|
||
it('fails on disallowed emails', async () => { | ||
const promise = agent.api.com.atproto.server.createAccount({ | ||
email: '[email protected]', | ||
handle: 'bad-email.test', | ||
password: 'asdf', | ||
}) | ||
await expect(promise).rejects.toThrow( | ||
'This email address is not supported, please use a different email.', | ||
) | ||
}) | ||
}) | ||
|
||
let did: string | ||
let jwt: string | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.