Skip to content

Commit

Permalink
Merge pull request #10985 from qmonmert/vueprettier2
Browse files Browse the repository at this point in the history
Vue: apply prettier
  • Loading branch information
murdos authored Sep 26, 2024
2 parents c7df29c + d76e382 commit faec05b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export type AuthenticatedUser = {
isAuthenticated: boolean;
username: AuthenticatedUserName;
token: AuthenticatedUserToken;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { inject } from '@/injections';
import { stubKeycloakHttp } from '../infrastructure/secondary/KeycloakHttpStub';

describe('AuthProvider', () => {
it('should define AUTH_REPOSITORY with the correct key', () => {
expect(AUTH_REPOSITORY.description).toBe('AuthRepository');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('KeycloakHttp', () => {
expect(result).toEqual({
isAuthenticated: true,
username: '',
token: 'test-token'
token: 'test-token',
});
});

Expand All @@ -89,7 +89,7 @@ describe('KeycloakHttp', () => {
expect(result).toEqual({
isAuthenticated: true,
username: 'test',
token: ''
token: '',
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@ import type { KeycloakHttp } from '@/auth/infrastructure/secondary/KeycloakHttp'
import type { AuthenticatedUser } from '@/auth/domain/AuthenticatedUser';

export interface KeycloakHttpStub extends KeycloakHttp {
currentUser: SinonStub;
login: SinonStub;
logout: SinonStub;
authenticated: SinonStub;
refreshToken: SinonStub;
getKeycloakInstance: SinonStub;
currentUser: SinonStub;
login: SinonStub;
logout: SinonStub;
authenticated: SinonStub;
refreshToken: SinonStub;
getKeycloakInstance: SinonStub;
}

export const stubKeycloakHttp = (): KeycloakHttpStub => ({
currentUser: sinon.stub(),
login: sinon.stub(),
logout: sinon.stub(),
authenticated: sinon.stub(),
refreshToken: sinon.stub(),
getKeycloakInstance: sinon.stub(),
}) as KeycloakHttpStub;
export const stubKeycloakHttp = (): KeycloakHttpStub =>
({
currentUser: sinon.stub(),
login: sinon.stub(),
logout: sinon.stub(),
authenticated: sinon.stub(),
refreshToken: sinon.stub(),
getKeycloakInstance: sinon.stub(),
}) as KeycloakHttpStub;

export const fakeAuthenticatedUser = (): AuthenticatedUser => ({
isAuthenticated: true,
username: 'testuser',
token: 'test-token'
isAuthenticated: true,
username: 'testuser',
token: 'test-token',
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@ import sinon from 'sinon';
import type{ SinonStub } from 'sinon';

export interface KeycloakStub extends Keycloak {
init: SinonStub;
login: SinonStub;
logout: SinonStub;
register: SinonStub;
accountManagement: SinonStub;
updateToken: SinonStub;
clearToken: SinonStub;
hasRealmRole: SinonStub;
hasResourceRole: SinonStub;
loadUserProfile: SinonStub;
loadUserInfo: SinonStub;
init: SinonStub;
login: SinonStub;
logout: SinonStub;
register: SinonStub;
accountManagement: SinonStub;
updateToken: SinonStub;
clearToken: SinonStub;
hasRealmRole: SinonStub;
hasResourceRole: SinonStub;
loadUserProfile: SinonStub;
loadUserInfo: SinonStub;
authenticated?: boolean;
token?: string;
tokenParsed?: { preferred_username?: string };
}

export const stubKeycloak = (): KeycloakStub => ({
init: sinon.stub(),
login: sinon.stub(),
logout: sinon.stub(),
register: sinon.stub(),
accountManagement: sinon.stub(),
updateToken: sinon.stub(),
clearToken: sinon.stub(),
hasRealmRole: sinon.stub(),
hasResourceRole: sinon.stub(),
loadUserProfile: sinon.stub(),
loadUserInfo: sinon.stub(),
authenticated: false,
token: undefined,
tokenParsed: undefined,
}) as KeycloakStub;
export const stubKeycloak = (): KeycloakStub =>
({
init: sinon.stub(),
login: sinon.stub(),
logout: sinon.stub(),
register: sinon.stub(),
accountManagement: sinon.stub(),
updateToken: sinon.stub(),
clearToken: sinon.stub(),
hasRealmRole: sinon.stub(),
hasResourceRole: sinon.stub(),
loadUserProfile: sinon.stub(),
loadUserInfo: sinon.stub(),
authenticated: false,
token: undefined,
tokenParsed: undefined,
}) as KeycloakStub;

0 comments on commit faec05b

Please sign in to comment.