Skip to content

Commit

Permalink
test: removed obsolete test (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus authored Feb 1, 2023
1 parent 5d6d585 commit fc84b15
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 81 deletions.
43 changes: 0 additions & 43 deletions test/axios.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
40 changes: 2 additions & 38 deletions test/interception.basic1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1194,7 +1158,7 @@ addTestCases((name, transferMethod, setupFunc, setupArgs = []) => {

assert.strictEqual(loginResponse.responseText, userId);

assert.strictEqual(document.cookie, "");
assert.strictEqual(await supertokens.doesSessionExist(), false);
});
});

Expand All @@ -1218,7 +1182,7 @@ addTestCases((name, transferMethod, setupFunc, setupArgs = []) => {

assert.strictEqual(loginResponse.responseText, userId);

assert.strictEqual(document.cookie, "");
assert.strictEqual(await supertokens.doesSessionExist(), false);
});
});

Expand Down

0 comments on commit fc84b15

Please sign in to comment.