mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-13 06:13:03 -05:00
feat(challengestandalone): challenge standalone
This commit is contained in:
1
libs/module-to-standalone/core/service/src/index.ts
Normal file
1
libs/module-to-standalone/core/service/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/authorization.service';
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AuthorizationService {
|
||||
private isAuthorized = new BehaviorSubject<boolean>(true);
|
||||
isAuthorized$ = this.isAuthorized.asObservable();
|
||||
|
||||
authorize() {
|
||||
this.isAuthorized.next(true);
|
||||
}
|
||||
|
||||
forbid() {
|
||||
this.isAuthorized.next(false);
|
||||
}
|
||||
}
|
||||
8
libs/module-to-standalone/core/service/src/test-setup.ts
Normal file
8
libs/module-to-standalone/core/service/src/test-setup.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
||||
globalThis.ngJest = {
|
||||
testEnvironmentOptions: {
|
||||
errorOnUnknownElements: true,
|
||||
errorOnUnknownProperties: true,
|
||||
},
|
||||
};
|
||||
import 'jest-preset-angular/setup-jest';
|
||||
Reference in New Issue
Block a user