Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/collections/password-reset-intents.subtest.js
Show All 36 Lines | with_running_app(async ({ app, base_url }) => { | ||||
return; | return; | ||||
} | } | ||||
throw new Error("it didn't throw"); | throw new Error("it didn't throw"); | ||||
})); | })); | ||||
it("allows anyone to create an intent, if the email exists", async () => | it("allows anyone to create an intent, if the email exists", async () => | ||||
with_running_app(async ({ app, base_url }) => { | with_running_app(async ({ app, base_url }) => { | ||||
await create_a_user(app); | await create_a_user(app); | ||||
const data = (await axios.post( | const { email, token } = (await axios.post( | ||||
`${base_url}/api/v1/collections/password-reset-intents`, | `${base_url}/api/v1/collections/password-reset-intents`, | ||||
{ | { | ||||
email: "user@example.com", | email: "user@example.com", | ||||
} | } | ||||
)).data; | )).data; | ||||
assert.deepEqual(data.body, { | assert.deepEqual( | ||||
{ email, token }, | |||||
{ | |||||
email: "user@example.com", | email: "user@example.com", | ||||
token: "it's a secret to everybody", | token: "it's a secret to everybody", | ||||
}); | } | ||||
); | |||||
})); | })); | ||||
it("tells you if the email address is malformed", async () => | it("tells you if the email address is malformed", async () => | ||||
with_running_app(async ({ base_url }) => { | with_running_app(async ({ base_url }) => { | ||||
try { | try { | ||||
await axios.post( | await axios.post( | ||||
`${base_url}/api/v1/collections/password-reset-intents`, | `${base_url}/api/v1/collections/password-reset-intents`, | ||||
{ | { | ||||
Show All 30 Lines |