-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fail validate for register email and add metrics
- Loading branch information
1 parent
788d3d9
commit 0916ba6
Showing
7 changed files
with
133 additions
and
3 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
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ import { | |
test, | ||
send, | ||
connection, | ||
validateEmail, | ||
register, | ||
} from './helpers/setup.js' | ||
import * as UCAN from '@ipld/dag-ucan' | ||
import { SigningAuthority } from '@ucanto/authority' | ||
|
@@ -86,6 +88,25 @@ test('should route correctly to identity/validate', async (t) => { | |
]) | ||
}) | ||
|
||
test('should fail to identity/validate with a know email', async (t) => { | ||
const kp = await SigningAuthority.generate() | ||
const con = connection(kp) | ||
|
||
const proof = await validateEmail(con, kp, '[email protected]') | ||
await register(con, kp, proof) | ||
|
||
try { | ||
await validateEmail(con, kp, '[email protected]') | ||
t.fail('should not validate') | ||
} catch (error) { | ||
t.deepEqual( | ||
// @ts-ignore | ||
error.message, | ||
'service handler {can: "identity/validate"} error: Email already registered.' | ||
) | ||
} | ||
}) | ||
|
||
// test('should route correctly to identity/validate and fail with proof', async (t) => { | ||
// const { mf } = t.context | ||
// const kp = await ucans.EdKeypair.create() | ||
|
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