feat: init and fork some code from angular-auth-oidc-client
Some checks are pending
Build, Lint & Test Lib / Built, Lint and Test Library (push) Waiting to run
Build, Lint & Test Lib / Angular latest (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest Standalone & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular 16 & RxJs 6 (push) Blocked by required conditions
Build, Lint & Test Lib / Angular V16 (push) Blocked by required conditions
Docs / Build and Deploy Docs Job (push) Waiting to run
Docs / Close Pull Request Job (push) Waiting to run
Some checks are pending
Build, Lint & Test Lib / Built, Lint and Test Library (push) Waiting to run
Build, Lint & Test Lib / Angular latest (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest Standalone & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular 16 & RxJs 6 (push) Blocked by required conditions
Build, Lint & Test Lib / Angular V16 (push) Blocked by required conditions
Docs / Build and Deploy Docs Job (push) Waiting to run
Docs / Close Pull Request Job (push) Waiting to run
This commit is contained in:
46
src/utils/redirect/redirect.service.spec.ts
Normal file
46
src/utils/redirect/redirect.service.spec.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { DOCUMENT } from '../../dom';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RedirectService } from './redirect.service';
|
||||
|
||||
describe('Redirect Service Tests', () => {
|
||||
let service: RedirectService;
|
||||
let myDocument: Document;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
RedirectService,
|
||||
{
|
||||
provide: DOCUMENT,
|
||||
useValue: {
|
||||
location: {
|
||||
get href(): string {
|
||||
return 'fakeUrl';
|
||||
},
|
||||
set href(_value) {
|
||||
// ...
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(RedirectService);
|
||||
myDocument = TestBed.inject(DOCUMENT);
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(service).toBeTruthy();
|
||||
expect(myDocument).toBeTruthy();
|
||||
});
|
||||
|
||||
it('redirectTo sets window location href', () => {
|
||||
const spy = spyOnProperty(myDocument.location, 'href', 'set');
|
||||
|
||||
service.redirectTo('anyurl');
|
||||
expect(spy).toHaveBeenCalledOnceWith('anyurl');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user