Skip to content

Commit 449be6f

Browse files
Merge pull request #1306 from hbenyoussef/fix-method-naming
Fix method naming error
2 parents 0727a41 + 2636397 commit 449be6f

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

projects/angular-auth-oidc-client/src/lib/check-auth.service.spec.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe('CheckAuthService', () => {
145145
it(
146146
'returns isAuthenticated: false with error message when config is not valid',
147147
waitForAsync(() => {
148-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(false);
148+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(false);
149149
checkAuthService.checkAuth('configId').subscribe((result) =>
150150
expect(result).toEqual({
151151
isAuthenticated: false,
@@ -162,7 +162,7 @@ describe('CheckAuthService', () => {
162162
it(
163163
'returns null and sendMessageToMainWindow if currently in a popup',
164164
waitForAsync(() => {
165-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
165+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
166166
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
167167
spyOn(popUpService, 'isCurrentlyInPopup').and.returnValue(true);
168168
const popupSpy = spyOn(popUpService, 'sendMessageToMainWindow');
@@ -176,7 +176,7 @@ describe('CheckAuthService', () => {
176176
it(
177177
'returns isAuthenticated: false with error message in case handleCallbackAndFireEvents throws an error',
178178
waitForAsync(() => {
179-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
179+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
180180
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
181181
spyOn(callBackService, 'isCallback').and.returnValue(true);
182182
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -198,7 +198,7 @@ describe('CheckAuthService', () => {
198198
it(
199199
'calls callbackService.handlePossibleStsCallback with current url when callback is true',
200200
waitForAsync(() => {
201-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
201+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
202202
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
203203
spyOn(callBackService, 'isCallback').and.returnValue(true);
204204
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -213,7 +213,7 @@ describe('CheckAuthService', () => {
213213
it(
214214
'does NOT call handleCallbackAndFireEvents with current url when callback is false',
215215
waitForAsync(() => {
216-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
216+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
217217
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
218218
spyOn(callBackService, 'isCallback').and.returnValue(false);
219219
const spy = spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
@@ -227,7 +227,7 @@ describe('CheckAuthService', () => {
227227
it(
228228
'does fire the auth and user data events when it is not a callback from the security token service and is authenticated',
229229
waitForAsync(() => {
230-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
230+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
231231
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
232232
spyOn(callBackService, 'isCallback').and.returnValue(false);
233233
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -246,7 +246,7 @@ describe('CheckAuthService', () => {
246246
it(
247247
'does NOT fire the auth and user data events when it is not a callback from the security token service and is NOT authenticated',
248248
waitForAsync(() => {
249-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
249+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
250250
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
251251
spyOn(callBackService, 'isCallback').and.returnValue(false);
252252
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(false);
@@ -265,7 +265,7 @@ describe('CheckAuthService', () => {
265265
it(
266266
'if authenticated return true',
267267
waitForAsync(() => {
268-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
268+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
269269
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
270270
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
271271
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -279,7 +279,7 @@ describe('CheckAuthService', () => {
279279
it(
280280
'if authenticated set auth and fires event ',
281281
waitForAsync(() => {
282-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
282+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
283283
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
284284
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
285285
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -295,7 +295,7 @@ describe('CheckAuthService', () => {
295295
it(
296296
'if authenticated publishUserdataIfExists',
297297
waitForAsync(() => {
298-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
298+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
299299
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
300300
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
301301
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -315,7 +315,7 @@ describe('CheckAuthService', () => {
315315
authority: 'authority',
316316
tokenRefreshInSeconds: 7,
317317
};
318-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
318+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
319319
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue(config);
320320
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
321321
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -331,7 +331,7 @@ describe('CheckAuthService', () => {
331331
it(
332332
'if isCheckSessionConfigured call checkSessionService.start()',
333333
waitForAsync(() => {
334-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
334+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
335335
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
336336
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
337337
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -348,7 +348,7 @@ describe('CheckAuthService', () => {
348348
it(
349349
'if isSilentRenewConfigured call getOrCreateIframe()',
350350
waitForAsync(() => {
351-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
351+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
352352
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
353353
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
354354
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -365,7 +365,7 @@ describe('CheckAuthService', () => {
365365
it(
366366
'calls checkSavedRedirectRouteAndNavigate if authenticated',
367367
waitForAsync(() => {
368-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
368+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
369369
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
370370
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
371371
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -381,7 +381,7 @@ describe('CheckAuthService', () => {
381381
it(
382382
'does not call checkSavedRedirectRouteAndNavigate if not authenticated',
383383
waitForAsync(() => {
384-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
384+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
385385
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority', configId: 'configId' });
386386
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
387387
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(false);
@@ -398,7 +398,7 @@ describe('CheckAuthService', () => {
398398
it(
399399
'if isSilentRenewConfigured call getOrCreateIframe()',
400400
waitForAsync(() => {
401-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
401+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
402402
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
403403
spyOn(callBackService, 'handleCallbackAndFireEvents').and.returnValue(of(null));
404404
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(true);
@@ -415,7 +415,7 @@ describe('CheckAuthService', () => {
415415
it(
416416
'does forceRefreshSession get called and is NOT authenticated',
417417
waitForAsync(() => {
418-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
418+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
419419
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
420420
spyOn(callBackService, 'isCallback').and.returnValue(false);
421421
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(false);
@@ -440,7 +440,7 @@ describe('CheckAuthService', () => {
440440
it(
441441
'should start check session and validation after forceRefreshSession has been called and is authenticated after forcing with silentrenew',
442442
waitForAsync(() => {
443-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
443+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
444444
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
445445
spyOn(callBackService, 'isCallback').and.returnValue(false);
446446
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(false);
@@ -473,7 +473,7 @@ describe('CheckAuthService', () => {
473473
it(
474474
'should start check session and validation after forceRefreshSession has been called and is authenticated after forcing without silentrenew',
475475
waitForAsync(() => {
476-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
476+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
477477
spyOn(configurationProvider, 'getOpenIDConfiguration').and.returnValue({ authority: 'authority' });
478478
spyOn(callBackService, 'isCallback').and.returnValue(false);
479479
spyOn(authStateService, 'areAuthStorageTokensValid').and.returnValue(false);

projects/angular-auth-oidc-client/src/lib/check-auth.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class CheckAuthService {
111111
private checkAuthWithConfig(config: OpenIdConfiguration, url?: string): Observable<LoginResponse> {
112112
const { configId, authority } = config;
113113

114-
if (!this.configurationProvider.hasAsLeastOneConfig()) {
114+
if (!this.configurationProvider.hasAtLeastOneConfig()) {
115115
const errorMessage = 'Please provide at least one configuration before setting up the module';
116116
this.loggerService.logError(configId, errorMessage);
117117

projects/angular-auth-oidc-client/src/lib/config/provider/config.provider-mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class ConfigurationProviderMock {
88
return this.configInternal || DEFAULT_CONFIG;
99
}
1010

11-
hasAsLeastOneConfig() {
11+
hasAtLeastOneConfig() {
1212
return true;
1313
}
1414

projects/angular-auth-oidc-client/src/lib/config/provider/config.provider.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ describe('ConfigurationProviderTests', () => {
6060
});
6161
});
6262

63-
describe('hasAsLeastOneConfig', () => {
63+
describe('hasAtLeastOneConfig', () => {
6464
it('hasConfig is true if config is set', () => {
6565
configurationProvider.setConfig({ authority: 'hello' });
6666

67-
expect(configurationProvider.hasAsLeastOneConfig()).toBeTrue();
67+
expect(configurationProvider.hasAtLeastOneConfig()).toBeTrue();
6868
});
6969

7070
it('hasConfig is false if no config is set', () => {
71-
expect(configurationProvider.hasAsLeastOneConfig()).toBeFalse();
71+
expect(configurationProvider.hasAtLeastOneConfig()).toBeFalse();
7272
});
7373
});
7474

@@ -99,7 +99,7 @@ describe('ConfigurationProviderTests', () => {
9999
});
100100

101101
it('hasConfig is false if no config is set', () => {
102-
expect(configurationProvider.hasAsLeastOneConfig()).toBeFalse();
102+
expect(configurationProvider.hasAtLeastOneConfig()).toBeFalse();
103103
});
104104
});
105105
});

projects/angular-auth-oidc-client/src/lib/config/provider/config.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { OpenIdConfiguration } from '../openid-configuration';
55
export class ConfigurationProvider {
66
private configsInternal: Record<string, OpenIdConfiguration> = {};
77

8-
hasAsLeastOneConfig(): boolean {
8+
hasAtLeastOneConfig(): boolean {
99
return Object.keys(this.configsInternal).length > 0;
1010
}
1111

projects/angular-auth-oidc-client/src/lib/interceptor/auth.interceptor.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe(`AuthHttpInterceptor`, () => {
165165
waitForAsync(() => {
166166
const actionUrl = `https://jsonplaceholder.typicode.com/`;
167167

168-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(false);
168+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(false);
169169

170170
httpClient.get(actionUrl).subscribe((response) => {
171171
expect(response).toBeTruthy();
@@ -182,7 +182,7 @@ describe(`AuthHttpInterceptor`, () => {
182182
it(
183183
'should not add an Authorization header when no configured route is matching the request',
184184
waitForAsync(() => {
185-
spyOn(configurationProvider, 'hasAsLeastOneConfig').and.returnValue(true);
185+
spyOn(configurationProvider, 'hasAtLeastOneConfig').and.returnValue(true);
186186
const actionUrl = `https://jsonplaceholder.typicode.com/`;
187187

188188
spyOn(configurationProvider, 'getAllConfigurations').and.returnValue([{ secureRoutes: [actionUrl], configId: 'configId' }]);

projects/angular-auth-oidc-client/src/lib/interceptor/auth.interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class AuthInterceptor implements HttpInterceptor {
1616
) {}
1717

1818
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
19-
if (!this.configurationProvider.hasAsLeastOneConfig()) {
19+
if (!this.configurationProvider.hasAtLeastOneConfig()) {
2020
return next.handle(req);
2121
}
2222

0 commit comments

Comments
 (0)