Skip to content

Commit 91cfa3f

Browse files
committed
isolate parsing tests
1 parent 56bae1b commit 91cfa3f

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

test/functional/editor.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ describe('Editor', function() {
3131
await this.page.waitFor(3000);
3232
expect(await this.page.$eval('#debugger-io', isVisible)).to.be.true;
3333
});
34-
35-
const token = 'eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.';
36-
['token', 'value', 'id_token', 'access_token'].forEach((key) => {
37-
[
38-
`/?${key}=${token}`,
39-
`/#${key}=${token}`,
40-
`/?foo=bar&${key}=${token}`,
41-
`/#foo=bar&${key}=${token}`,
42-
].forEach((structure, i) => {
43-
it(`Should parse ${key} from window.location.href [${i}]`, async function () {
44-
await this.page.goto(`http://localhost:8000${structure}${key}${i}`);
45-
expect(await this.page.evaluate(() => {
46-
return window.test.tokenEditor.getValue();
47-
})).to.equal(`${token}${key}${i}`);
48-
});
49-
})
50-
});
5134

5235
it('HS256 should be selected by default', async function() {
5336
const selected = await this.page.$eval('#algorithm-select', select => {
@@ -1168,4 +1151,23 @@ describe('Editor', function() {
11681151
}
11691152
);
11701153
});
1154+
1155+
describe('parsing tokens from window.location.href', () => {
1156+
const token = 'eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.';
1157+
['token', 'value', 'id_token', 'access_token'].forEach((key) => {
1158+
[
1159+
`/?${key}=${token}`,
1160+
`/#${key}=${token}`,
1161+
`/?foo=bar&${key}=${token}`,
1162+
`/#foo=bar&${key}=${token}`,
1163+
].forEach((structure, i) => {
1164+
it(`Should parse ${key} from window.location.href [${i}]`, async function () {
1165+
await this.page.goto(`http://localhost:8000${structure}${key}${i}`);
1166+
expect(await this.page.evaluate(() => {
1167+
return window.test.tokenEditor.getValue();
1168+
})).to.equal(`${token}${key}${i}`);
1169+
});
1170+
})
1171+
});
1172+
});
11711173
});

0 commit comments

Comments
 (0)