Skip to content

Commit 2ce0db1

Browse files
committed
add location parsing tests
1 parent 7a265d1 commit 2ce0db1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/functional/editor.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ 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+
});
3451

3552
it('HS256 should be selected by default', async function() {
3653
const selected = await this.page.$eval('#algorithm-select', select => {

0 commit comments

Comments
 (0)