diff --git a/test/axios.test.js b/test/axios.test.js index e64940ef..0441febf 100644 --- a/test/axios.test.js +++ b/test/axios.test.js @@ -1341,49 +1341,6 @@ describe("Axios AuthHttpRequest class tests", function () { } }); - // - Interception should not happen when domain is not the one that they gave******* - it("test interception should not happen when domain is not the one that they gave", async function () { - await startST(5); - AuthHttpRequest.init({ - apiDomain: BASE_URL - }); - - await axios.get(`https://www.google.com`); - let verifyRequestState = await ProcessState.getInstance().waitForEvent( - PROCESS_STATE.CALLING_INTERCEPTION_REQUEST, - 100 - ); - let verifyResponseState = await ProcessState.getInstance().waitForEvent( - PROCESS_STATE.CALLING_INTERCEPTION_RESPONSE, - 100 - ); - - assert.strictEqual(verifyRequestState, undefined); - assert.strictEqual(verifyResponseState, undefined); - - let userId = "testing-supertokens-website"; - let loginResponse = await axios.post(`${BASE_URL}/login`, JSON.stringify({ userId }), { - headers: { - Accept: "application/json", - "Content-Type": "application/json" - } - }); - - assert.strictEqual(await loginResponse.data, userId); - - verifyRequestState = await ProcessState.getInstance().waitForEvent( - PROCESS_STATE.CALLING_INTERCEPTION_REQUEST, - 5000 - ); - verifyResponseState = await ProcessState.getInstance().waitForEvent( - PROCESS_STATE.CALLING_INTERCEPTION_RESPONSE, - 5000 - ); - - assert.notStrictEqual(verifyRequestState, undefined); - assert.notStrictEqual(verifyResponseState, undefined); - }); - it("test with axios interception should happen if api domain and website domain are the same and relative path is used", async function () { await startST(5); diff --git a/test/interception.basic1.test.js b/test/interception.basic1.test.js index cbef54db..8fb2bb55 100644 --- a/test/interception.basic1.test.js +++ b/test/interception.basic1.test.js @@ -1106,42 +1106,6 @@ addTestCases((name, transferMethod, setupFunc, setupArgs = []) => { }); }); - // // - Interception should not happen when domain is not the one that they gave******* - // it("test interception should not happen when domain is not the one that they gave", async function() { - // await startST(5); - // AuthHttpRequest.init({ - // apiDomain: BASE_URL, - // }); - // let userId = "testing-supertokens-website"; - - // // this is technically not doing interception, but it is equavalent to doing it since the inteceptor just calls the function below. - // await toTest({ url: `https://www.google.com` }); - - // let verifyRequestState = await ProcessState.getInstance().waitForEvent( - // PROCESS_STATE.CALLING_INTERCEPTION_REQUEST, - // 100, - // ); - - // assert.deepEqual(verifyRequestState, undefined); - - // let loginResponse = await toTest({ url: `${BASE_URL}/login`, - // method: "post", - // headers: { - // Accept: "application/json", - // "Content-Type": "application/json", - // }, - // body: JSON.stringify({ userId }), - // }); - - // assert.deepEqual(loginResponse.responseText, userId); - - // verifyRequestState = await ProcessState.getInstance().waitForEvent( - // PROCESS_STATE.CALLING_INTERCEPTION_REQUEST, - // 5000, - // ); - // assert.notDeepEqual(verifyRequestState, undefined); - // }); - it("test interception should happen if api domain and website domain are the same and relative path is used", async function () { await startST(5); await setup(); @@ -1194,7 +1158,7 @@ addTestCases((name, transferMethod, setupFunc, setupArgs = []) => { assert.strictEqual(loginResponse.responseText, userId); - assert.strictEqual(document.cookie, ""); + assert.strictEqual(await supertokens.doesSessionExist(), false); }); }); @@ -1218,7 +1182,7 @@ addTestCases((name, transferMethod, setupFunc, setupArgs = []) => { assert.strictEqual(loginResponse.responseText, userId); - assert.strictEqual(document.cookie, ""); + assert.strictEqual(await supertokens.doesSessionExist(), false); }); });