Skip to content

Commit 327c39b

Browse files
author
Rishabh
committed
adds a new test
1 parent 000c0dc commit 327c39b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

test/framework/fastify.test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,4 +1339,55 @@ describe(`Fastify: ${printPath("[test/framework/fastify.test.js]")}`, function (
13391339

13401340
assert(JSON.parse(response.body).custom);
13411341
});
1342+
1343+
it("generating email verification token without payload", async function () {
1344+
await startST();
1345+
SuperTokens.init({
1346+
framework: "fastify",
1347+
supertokens: {
1348+
connectionURI: "http://localhost:8080",
1349+
},
1350+
appInfo: {
1351+
apiDomain: "api.supertokens.io",
1352+
appName: "SuperTokens",
1353+
websiteDomain: "supertokens.io",
1354+
},
1355+
recipeList: [EmailPassword.init(), Session.init()],
1356+
});
1357+
1358+
await this.server.register(FastifyFramework.plugin);
1359+
1360+
// sign up a user first
1361+
let response = extractInfoFromResponse(
1362+
await this.server.inject({
1363+
method: "post",
1364+
url: "/auth/signup",
1365+
payload: {
1366+
formFields: [
1367+
{
1368+
id: "email",
1369+
1370+
},
1371+
{
1372+
id: "password",
1373+
value: "testPass123",
1374+
},
1375+
],
1376+
},
1377+
})
1378+
);
1379+
1380+
// send generate email verification token request
1381+
let res2 = await this.server.inject({
1382+
method: "post",
1383+
url: "/auth/user/email/verify/token",
1384+
payload: {},
1385+
headers: {
1386+
Cookie: `sAccessToken=${response.accessToken}; sIdRefreshToken=${response.idRefreshTokenFromCookie}`,
1387+
"Content-Type": "application/json",
1388+
},
1389+
});
1390+
1391+
assert(res2.statusCode === 200);
1392+
});
13421393
});

0 commit comments

Comments
 (0)