@tech4good/angular-schematics 18.0.4 → 18.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +10 -1
- package/src/init/files/README.md.template +6 -2
- package/src/init/files/angular.json.template +1 -1
- package/src/init/files/jest.config.ts.template +76 -0
- package/src/init/files/package.json.template +14 -10
- package/src/init/files/setup-jest.ts.template +10 -0
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +10 -3
- package/src/init/files/src/app/app.component.spec.ts.template +27 -0
- package/src/init/files/src/app/core/store/auth/auth.mock.ts.template +23 -0
- package/src/init/files/src/app/first-time/consent/consent.component.spec.ts.template +10 -3
- package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +13 -3
- package/src/init/files/src/app/first-time/landing/landing.component.spec.ts.template +10 -3
- package/src/init/files/src/app/first-time/login/login.component.spec.ts.template +10 -3
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +9 -1
- package/src/init/files/src/app/main/home/home.component.spec.ts.template +10 -3
- package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +9 -2
- package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +1 -1
- package/src/init/files/src/environments/environment.test.ts.template +12 -0
- package/src/init/files/tsconfig.app.json.template +1 -1
- package/src/init/files/tsconfig.spec.json.template +19 -0
package/package.json
CHANGED
package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
8
|
+
|
|
4
9
|
|
|
5
10
|
describe('<%= classify(name) %>Component', () => {
|
|
6
11
|
let component: <%= classify(name) %>Component;
|
|
@@ -8,7 +13,11 @@ describe('<%= classify(name) %>Component', () => {
|
|
|
8
13
|
|
|
9
14
|
beforeEach(waitForAsync(() => {
|
|
10
15
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
16
|
+
imports: [<%= classify(name) %>Component],
|
|
17
|
+
providers: [
|
|
18
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
19
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
20
|
+
],
|
|
12
21
|
})
|
|
13
22
|
.compileComponents();
|
|
14
23
|
}));
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<br>
|
|
7
7
|
</p>
|
|
8
8
|
<p align="center">
|
|
9
|
-
<a><strong><%= classify(project)
|
|
9
|
+
<a><strong><%= classify(project) %></strong> [Link TBD]</a> by <a><strong>[the creators]</strong></a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
[Project description and novelty]
|
|
21
21
|
|
|
22
|
-
Our platform uses the Angular framework along with Angular Material, RxJS, Typescript, and Sass. We use NgRx's Signal Store for frontend data management, Firebase for the backend, and
|
|
22
|
+
Our platform uses the Angular framework along with Angular Material, RxJS, Typescript, and Sass. We use NgRx's Signal Store for frontend data management, Firebase for the backend, and dotenv for environment variables.
|
|
23
23
|
|
|
24
24
|
<div align="center">
|
|
25
25
|
<img src="/public/favicon.ico" alt="Angular" width="40" height="40">
|
|
@@ -70,4 +70,8 @@ You can connect with us Lab through the following channels:
|
|
|
70
70
|
|
|
71
71
|
As can be clearly seen, our documents and the processes we aim to work towards are modeled after or directly taken from those of the [Angular team](https://github.com/angular/angular).
|
|
72
72
|
|
|
73
|
+
## Testing
|
|
74
|
+
|
|
75
|
+
If you want to run a testing file in the repo please run the command: npm test -- --silent=false {/$path_of_file_to_test}
|
|
76
|
+
|
|
73
77
|
**Love <%= classify(project) %>? Give our repo a star :star: :arrow_up:.**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Config } from 'jest';
|
|
2
|
+
import { createDefaultEsmPreset } from 'ts-jest'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Jest configuration for Angular + TypeScript using ESM mode.
|
|
6
|
+
*
|
|
7
|
+
* Key decisions:
|
|
8
|
+
* - Uses `jest.config.ts` (standard since Jest v29) with ESM support via `ts-jest`.
|
|
9
|
+
* - `jest-preset-angular` handles Angular-specific transforms.
|
|
10
|
+
* - Enables ESM mode with `extensionsToTreatAsEsm` and `transform.useESM`.
|
|
11
|
+
* - Supports `import.meta.env` via `ts-jest-mock-import-meta`.
|
|
12
|
+
* - Transforms `.html` files and avoids ESM parsing issues in node_modules.
|
|
13
|
+
*
|
|
14
|
+
* References:
|
|
15
|
+
* - ts-jest ESM guide: https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
|
|
16
|
+
* - jest-preset-angular (Angular 13+): https://thymikee.github.io/jest-preset-angular/docs/guides/angular-13+
|
|
17
|
+
*/
|
|
18
|
+
const config: Config = {
|
|
19
|
+
...createDefaultEsmPreset(),
|
|
20
|
+
// Required to handle ESM properly
|
|
21
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
22
|
+
transform: {
|
|
23
|
+
'^.+\\.(ts|js|html|mjs)$': [
|
|
24
|
+
'jest-preset-angular',
|
|
25
|
+
{
|
|
26
|
+
useESM: true,
|
|
27
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
28
|
+
stringifyContentPathRegex: '\\.html$',
|
|
29
|
+
astTransformers: {
|
|
30
|
+
before: [
|
|
31
|
+
{
|
|
32
|
+
path: 'ts-jest-mock-import-meta',
|
|
33
|
+
options: {
|
|
34
|
+
metaObjectReplacement: {
|
|
35
|
+
env: {
|
|
36
|
+
NG_APP_FIREBASE_API_KEY: 'mock-api-key',
|
|
37
|
+
NG_APP_FIREBASE_LOGS_API_KEY: 'mock-logs-api-key',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
transformIgnorePatterns: [
|
|
48
|
+
'node_modules/(?!.*\\.mjs$|@angular|@ngrx|rxjs|crypto-es)',
|
|
49
|
+
],
|
|
50
|
+
moduleNameMapper: {
|
|
51
|
+
'^src/(.*)$': '<rootDir>/src/$1',
|
|
52
|
+
'^app/(.*)$': '<rootDir>/src/app/$1',
|
|
53
|
+
'^.*environment$': '<rootDir>/src/environments/environment.test.ts',
|
|
54
|
+
'^.*environment.prod$': '<rootDir>/src/environments/environment.test.ts',
|
|
55
|
+
},
|
|
56
|
+
testEnvironment: 'jsdom',
|
|
57
|
+
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
|
|
58
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
59
|
+
testPathIgnorePatterns: ['/node_modules/', '/dist/', '<rootDir>/src/environments/environment.test.ts',],
|
|
60
|
+
collectCoverageFrom: [
|
|
61
|
+
'src/app/**/*.ts',
|
|
62
|
+
'!src/app/**/*.module.ts',
|
|
63
|
+
'!src/app/**/*.spec.ts',
|
|
64
|
+
],
|
|
65
|
+
coverageProvider: 'v8',
|
|
66
|
+
coverageThreshold: {
|
|
67
|
+
global: {
|
|
68
|
+
statements: 80,
|
|
69
|
+
branches: 80,
|
|
70
|
+
functions: 80,
|
|
71
|
+
lines: 80,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default config;
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"start": "ng serve",
|
|
8
8
|
"build": "ng build",
|
|
9
9
|
"watch": "ng build --watch --configuration development",
|
|
10
|
-
"test": "
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"test:watch": "jest --watch",
|
|
12
|
+
"test:coverage": "jest --coverage",
|
|
11
13
|
"lint": "ng lint",
|
|
12
14
|
"lintfix": "ng lint --fix"
|
|
13
15
|
},
|
|
@@ -46,19 +48,21 @@
|
|
|
46
48
|
"@angular/cli": "^18.0.7",
|
|
47
49
|
"@angular/compiler-cli": "^18.0.0",
|
|
48
50
|
"@ngx-env/builder": "^18.0.1",
|
|
49
|
-
"@tech4good/angular-schematics": "^18.0
|
|
51
|
+
"@tech4good/angular-schematics": "^18.1.0",
|
|
50
52
|
"@types/estree": "^1.0.0",
|
|
51
|
-
"@types/
|
|
53
|
+
"@types/jest": "^29.5.14",
|
|
52
54
|
"@types/node": "^18.19.47",
|
|
53
55
|
"@typescript-eslint/eslint-plugin": "6.10.0",
|
|
54
56
|
"@typescript-eslint/parser": "6.10.0",
|
|
57
|
+
"@testing-library/angular": "^17.3.6",
|
|
58
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
55
59
|
"eslint-config-google": "^0.14.0",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
60
|
+
"jest": "^29.7.0",
|
|
61
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
62
|
+
"jest-preset-angular": "^14.5.1",
|
|
63
|
+
"typescript": "~5.4.2",
|
|
64
|
+
"ts-jest": "^29.3.4",
|
|
65
|
+
"ts-jest-mock-import-meta": "^1.3.0",
|
|
66
|
+
"ts-node": "^10.9.2"
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
setupZoneTestEnv();
|
|
7
|
+
|
|
8
|
+
TestBed.configureTestingModule({
|
|
9
|
+
imports: [BrowserAnimationsModule]
|
|
10
|
+
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { AdminPanelComponent } from './admin-panel.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('AdminPanelComponent', () => {
|
|
6
10
|
let component: AdminPanelComponent;
|
|
@@ -8,9 +12,12 @@ describe('AdminPanelComponent', () => {
|
|
|
8
12
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
imports: [AdminPanelComponent],
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
beforeEach(() => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
8
|
+
import { LOG_SERVICE, LogInDevService } from './core/analytics/log.service';
|
|
9
|
+
|
|
10
|
+
describe('AppComponent', () => {
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await TestBed.configureTestingModule({
|
|
13
|
+
imports: [AppComponent],
|
|
14
|
+
providers: [
|
|
15
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
16
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
17
|
+
{ provide: LOG_SERVICE, useClass: LogInDevService },
|
|
18
|
+
],
|
|
19
|
+
}).compileComponents();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create the app', () => {
|
|
23
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
24
|
+
const app = fixture.componentInstance;
|
|
25
|
+
expect(app).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -18,3 +18,26 @@ export const AuthMockDB = signalStore(
|
|
|
18
18
|
},
|
|
19
19
|
})),
|
|
20
20
|
);
|
|
21
|
+
|
|
22
|
+
export const AuthLoggedInMockDB = signalStore(
|
|
23
|
+
{ providedIn: 'root' },
|
|
24
|
+
withState({ user: {
|
|
25
|
+
uid: USER_DB[0].__id,
|
|
26
|
+
email: USER_DB[0].email,
|
|
27
|
+
displayName: USER_DB[0].name,
|
|
28
|
+
photoURL: USER_DB[0].photoURL,
|
|
29
|
+
} }),
|
|
30
|
+
withMethods((store) => ({
|
|
31
|
+
login() {
|
|
32
|
+
patchState(store, { user: {
|
|
33
|
+
uid: USER_DB[0].__id,
|
|
34
|
+
email: USER_DB[0].email,
|
|
35
|
+
displayName: USER_DB[0].name,
|
|
36
|
+
photoURL: USER_DB[0].photoURL,
|
|
37
|
+
} });
|
|
38
|
+
},
|
|
39
|
+
logout() {
|
|
40
|
+
patchState(store, { user: null });
|
|
41
|
+
},
|
|
42
|
+
})),
|
|
43
|
+
);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { ConsentComponent } from './consent.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('ConsentComponent', () => {
|
|
6
10
|
let component: ConsentComponent;
|
|
@@ -8,9 +12,12 @@ describe('ConsentComponent', () => {
|
|
|
8
12
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
imports: [ConsentComponent],
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
beforeEach(() => {
|
package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { EarlyAccessComponent } from './early-access.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
8
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
9
|
+
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
4
10
|
|
|
5
11
|
describe('EarlyAccessComponent', () => {
|
|
6
12
|
let component: EarlyAccessComponent;
|
|
@@ -8,9 +14,13 @@ describe('EarlyAccessComponent', () => {
|
|
|
8
14
|
|
|
9
15
|
beforeEach(waitForAsync(() => {
|
|
10
16
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
imports: [EarlyAccessComponent],
|
|
18
|
+
providers: [
|
|
19
|
+
{ provide: AuthStore, useClass: AuthLoggedInMockDB }, // Needed to use `currentUser()`
|
|
20
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
21
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
22
|
+
],
|
|
23
|
+
}).compileComponents();
|
|
14
24
|
}));
|
|
15
25
|
|
|
16
26
|
beforeEach(() => {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { LandingComponent } from './landing.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('LandingComponent', () => {
|
|
6
10
|
let component: LandingComponent;
|
|
@@ -8,9 +12,12 @@ describe('LandingComponent', () => {
|
|
|
8
12
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
imports: [LandingComponent],
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
beforeEach(() => {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { LoginComponent } from './login.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('LoginComponent', () => {
|
|
6
10
|
let component: LoginComponent;
|
|
@@ -8,9 +12,12 @@ describe('LoginComponent', () => {
|
|
|
8
12
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
imports: [LoginComponent],
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
beforeEach(() => {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { OnboardingComponent } from './onboarding.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('OnboardingComponent', () => {
|
|
6
10
|
let component: OnboardingComponent;
|
|
@@ -8,7 +12,11 @@ describe('OnboardingComponent', () => {
|
|
|
8
12
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
15
|
+
imports: [OnboardingComponent],
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
12
20
|
})
|
|
13
21
|
.compileComponents();
|
|
14
22
|
}));
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { HomeComponent } from './home.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('HomeComponent', () => {
|
|
6
10
|
let component: HomeComponent;
|
|
@@ -8,9 +12,12 @@ describe('HomeComponent', () => {
|
|
|
8
12
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
imports: [HomeComponent],
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
beforeEach(() => {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { NavbarComponent } from './navbar.component';
|
|
4
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
5
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
6
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
8
|
|
|
5
9
|
describe('NavbarComponent', () => {
|
|
6
10
|
let component: NavbarComponent;
|
|
@@ -9,8 +13,11 @@ describe('NavbarComponent', () => {
|
|
|
9
13
|
beforeEach(waitForAsync(() => {
|
|
10
14
|
TestBed.configureTestingModule({
|
|
11
15
|
imports: [NavbarComponent],
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
providers: [
|
|
17
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
18
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
beforeEach(() => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "./tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"target": "ES2022",
|
|
7
|
+
"module": "ES2022",
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"types": ["jest", "node"],
|
|
13
|
+
"outDir": "./out-tsc/spec"
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"src/**/*.spec.ts",
|
|
17
|
+
"src/**/*.d.ts"
|
|
18
|
+
]
|
|
19
|
+
}
|