Skip to content

Commit 786616e

Browse files
author
Giuseppe Pennisi
committed
chore: changed test
1 parent 77ae1f5 commit 786616e

13 files changed

Lines changed: 2657 additions & 2622 deletions

File tree

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/* eslint-disable */
2-
const esModules = ['winbox', '@angular', '@ngrx'].join('|');
3-
export default {
2+
const esModules = [
3+
'winbox',
4+
'@angular',
5+
'@ngrx',
6+
'@ng-bootstrap/ng-bootstrap',
7+
'@fortawesome/angular-fontawesome',
8+
].join('|');
9+
module.exports = {
410
displayName: 'winbox-example-app',
511
preset: '../../jest.preset.js',
612
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
@@ -11,11 +17,10 @@ export default {
1117
},
1218
},
1319
coverageDirectory: '../../coverage/apps/winbox-example-app',
20+
transformIgnorePatterns: [`/node_modules/(?!${esModules}/)`],
1421
transform: {
15-
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
16-
[`(${esModules}).+\\.(js|jsx|mjs)$`]: 'ts-jest',
22+
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',
1723
},
18-
transformIgnorePatterns: [`/node_modules/(?!${esModules}/)`],
1924
snapshotSerializers: [
2025
'jest-preset-angular/build/serializers/no-ng-attributes',
2126
'jest-preset-angular/build/serializers/ng-snapshot',

apps/winbox-example-app/src/app/app.component.spec.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { AppComponent } from './app.component';
33
import { RouterTestingModule } from '@angular/router/testing';
44
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
55
import { SidebarComponent } from '@rbtechdev/angular-sidebar';
6+
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
67

78
describe('AppComponent', () => {
89
beforeEach(async () => {
910
await TestBed.configureTestingModule({
10-
imports: [RouterTestingModule, PerfectScrollbarModule],
11+
imports: [RouterTestingModule, PerfectScrollbarModule, NgbModalModule],
1112
declarations: [AppComponent, SidebarComponent],
1213
}).compileComponents();
1314
});
@@ -23,13 +24,4 @@ describe('AppComponent', () => {
2324
const app = fixture.componentInstance;
2425
expect(app.title).toEqual('winbox-example-app');
2526
});
26-
27-
it('should render title', () => {
28-
const fixture = TestBed.createComponent(AppComponent);
29-
fixture.detectChanges();
30-
const compiled = fixture.nativeElement as HTMLElement;
31-
expect(compiled.querySelector('h1')?.textContent).toContain(
32-
'Welcome winbox-example-app'
33-
);
34-
});
3527
});

apps/winbox-example-app/tsconfig.app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
},
77
"files": ["src/main.ts", "src/polyfills.ts"],
88
"include": ["src/**/*.d.ts"],
9-
"exclude": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts"]
9+
"exclude": [
10+
"jest.config.js", "**/*.test.ts", "**/*.spec.ts"]
1011
}

apps/winbox-example-app/tsconfig.spec.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"types": ["jest", "node"]
77
},
88
"files": ["src/test-setup.ts"],
9-
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
9+
"include": [
10+
"jest.config.js", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
1011
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { getJestProjects } = require('@nrwl/jest');
22

3-
export default {
3+
module.exports = {
44
projects: getJestProjects(),
55
};

jest.preset.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
const nxPreset = require('@nrwl/jest/preset');
1+
const nxPreset = require('@nrwl/jest/preset').default;
22

33
module.exports = {
4-
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
5-
resolver: '@nrwl/jest/plugins/resolver',
6-
moduleFileExtensions: ['ts', 'js', 'html'],
7-
coverageReporters: ['html'],
8-
testEnvironment: 'jsdom',
4+
...nxPreset,
95
transform: {
10-
'^.+\\.(ts|js|html)$': 'jest-preset-angular',
6+
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',
117
},
8+
transformIgnorePatterns: ['<rootDir>/node_modules/(?!.*\\.mjs$)'],
129
};

0 commit comments

Comments
 (0)