Skip to content

Commit 78d1444

Browse files
authored
fix: 12.0 test failures (#385)
* test: fix useridmapping tests * fix: 500 on token theft detected in hapi
1 parent c2b9d2b commit 78d1444

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

lib/build/framework/hapi/framework.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const plugin = {
180180
}
181181
});
182182
if (request.response.isBoom) {
183-
let err = request.response.data;
183+
let err = request.response.data || request.response;
184184
let req = new HapiRequest(request);
185185
let res = new HapiResponse(h);
186186
if (err !== undefined && err !== null) {

lib/ts/framework/hapi/framework.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const plugin: Plugin<{}> = {
185185
}
186186
});
187187
if ((request.response as Boom).isBoom) {
188-
let err = (request.response as Boom).data;
188+
let err = (request.response as Boom).data || request.response;
189189
let req = new HapiRequest(request);
190190
let res = new HapiResponse(h as ExtendedResponseToolkit);
191191
if (err !== undefined && err !== null) {

test/framework/hapi.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ describe(`Hapi: ${printPath("[test/framework/hapi.test.js]")}`, function () {
351351
"anti-csrf": res.antiCsrf,
352352
},
353353
});
354-
assert(res3.statusCode === 401);
354+
355+
assert.strictEqual(res3.statusCode, 401);
355356
assert.deepStrictEqual(res3.result, { message: "token theft detected" });
356357

357358
let cookies = extractInfoFromResponse(res3);

test/useridmapping/recipeTests/thirdpartyemailpassword.test.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { Querier } = require("../../../lib/build/querier");
88
const { maxVersion } = require("../../../lib/build/utils");
99

1010
describe(`userIdMapping with ThirdPartyEmailPassword: ${printPath(
11-
"[test/useridmapping/recipeTests/emailpassword.test.js]"
11+
"[test/useridmapping/recipeTests/thirdpartyemailpassword.test.js]"
1212
)}`, function () {
1313
beforeEach(async function () {
1414
await killAllST();
@@ -81,11 +81,7 @@ describe(`userIdMapping with ThirdPartyEmailPassword: ${printPath(
8181

8282
{
8383
// create a new ThirdParty user
84-
85-
let email = {
86-
87-
isVerified: true,
88-
};
84+
const email = "[email protected]";
8985

9086
let signUpResponse = await ThirdPartyEmailPasswordRecipe.thirdPartySignInUp("google", "tpId", email);
9187

@@ -103,7 +99,7 @@ describe(`userIdMapping with ThirdPartyEmailPassword: ${printPath(
10399
let response = await ThirdPartyEmailPasswordRecipe.getUserById(superTokensUserId);
104100
assert.ok(response !== undefined);
105101
assert.strictEqual(response.id, externalId);
106-
assert.strictEqual(response.email, email.id);
102+
assert.strictEqual(response.email, email);
107103
}
108104
}
109105
});

0 commit comments

Comments
 (0)