1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-07 23:02:56 +03:00

Implementation of MSC3824 to add action= param on SSO login (#2398)

Co-authored-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Hugh Nimmo-Smith
2022-09-11 22:18:33 +01:00
committed by GitHub
parent 583e48086b
commit a57c430b09
3 changed files with 60 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import { SSOAction } from '../../src/@types/auth';
import { TestClient } from '../TestClient';
describe('Login request', function() {
@@ -22,3 +23,37 @@ describe('Login request', function() {
expect(client.client.getUserId()).toBe(response.user_id);
});
});
describe('SSO login URL', function() {
let client: TestClient;
beforeEach(function() {
client = new TestClient();
});
afterEach(function() {
client.stop();
});
describe('SSOAction', function() {
const redirectUri = "https://test.com/foo";
it('No action', function() {
const urlString = client.client.getSsoLoginUrl(redirectUri, undefined, undefined, undefined);
const url = new URL(urlString);
expect(url.searchParams.has('org.matrix.msc3824.action')).toBe(false);
});
it('register', function() {
const urlString = client.client.getSsoLoginUrl(redirectUri, undefined, undefined, SSOAction.REGISTER);
const url = new URL(urlString);
expect(url.searchParams.get('org.matrix.msc3824.action')).toEqual('register');
});
it('login', function() {
const urlString = client.client.getSsoLoginUrl(redirectUri, undefined, undefined, SSOAction.LOGIN);
const url = new URL(urlString);
expect(url.searchParams.get('org.matrix.msc3824.action')).toEqual('login');
});
});
});