diff --git a/jest.config.js b/jest.config.js index cd98c2f3..56e2f71c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,17 +1,17 @@ module.exports = { - preset: 'ts-jest', + preset: 'jest-preset-angular', testEnvironment: 'jsdom', - transform: { - '^.+\\.tsx?$': 'ts-jest', + setupFilesAfterEnv: ['/src/setup-jest.ts'], + transformIgnorePatterns: [ + 'node_modules/(?!.*\\.mjs$)', + ], + moduleNameMapper: { + 'worker-loader!.*': '/test/mocks/workerMock.js', + 'pdfjs-dist/build/pdf.worker': '/test/mocks/workerMock.js', + "^src/environments/environment$": "/src/environments/environment.ts", }, - // moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - // transformIgnorePatterns: ['/node_modules/'], - // moduleNameMapper: { - // '^src/(.*)$': '/home/sujithsojan/Desktop/igot-jest/sunbird-cb-adminportal/src/$1', - // }, - // setupFiles: ['/home/sujithsojan/Desktop/igot-jest/sunbird-cb-adminportal/src/jest.setup.ts'], - coverageDirectory: './coverage', coverageReporters: ["clover", "json", "lcov", "text", "text-summary"], collectCoverage: true, - testResultsProcessor: "jest-sonar-reporter" -} + testResultsProcessor: "jest-sonar-reporter", + setupFiles: ['zone.js', ] +}; \ No newline at end of file diff --git a/package.json b/package.json index c9401425..fd3ddfa8 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "start:spv-dev": "node --max_old_space_size=12288 ./node_modules/@angular/cli/bin/ng serve --proxy-config proxy/spv-dev-ip.proxy.json -o", "analyse": "webpack-bundle-analyzer ./dist/www/ng serve --proxy-config proxy/localhost.proxy.json -o/stats-es5.json", "test": "jest", - "test-coverage": "./node_modules/jest/bin/jest.js --clearCache && node --max_old_space_size=1024 ./node_modules/jest/bin/jest.js --silent --ci --collectCoverage=true --coverageReporters=lcov --detectOpenHandles --forceExit=true", + "test-coverage": "./node_modules/jest/bin/jest.js --clearCache && node --max_old_space_size=8000 ./node_modules/jest/bin/jest.js --silent --ci --collectCoverage=true --coverageReporters=lcov --detectOpenHandles --forceExit=true", "lint": "ng lint", "lint:fix": "ng lint --fix", "e2e": "ng e2e", @@ -27,6 +27,7 @@ }, "private": true, "dependencies": { + "@angular-builders/jest": "^19.0.0", "@angular/animations": "^16.2.12", "@angular/cdk": "^16.2.14", "@angular/common": "^16.2.12", @@ -43,7 +44,7 @@ "@babel/core": "7.22.0", "@babel/preset-env": "7.25.4", "@project-sunbird/telemetry-sdk": "0.0.26", - "@sunbird-cb/collection": "1.0.49-ang-13-16", + "@sunbird-cb/collection": "1.0.53-ang-13-16", "@sunbird-cb/rain-dashboards": "0.0.36-ang-13-16", "@sunbird-cb/resolver": "1.0.0-ang-13-16", "@sunbird-cb/taxonomy-editor": "0.0.0-ang-13-16", @@ -61,7 +62,7 @@ "file-saver": "^2.0.2", "hammerjs": "^2.0.8", "husky": "^4.2.3", - "jest": "29.7.0", + "jest": "^29.7.0", "jest-preset-angular": "^14.2.4", "jquery": "^3.4.1", "jsoneditor": "^10.1.0", @@ -117,6 +118,7 @@ "jasmine-core": "~3.6.0", "jasmine-spec-reporter": "~5.0.0", "jest-sonar-reporter": "^2.0.0", + "jest-localstorage-mock": "^2.4.26", "karma": "~6.4.4", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.2", diff --git a/project/ws/app/src/lib/head/ui-admin-table/create-organisation/create-organisation.component.ts b/project/ws/app/src/lib/head/ui-admin-table/create-organisation/create-organisation.component.ts index ec7c7d53..1a60b66e 100644 --- a/project/ws/app/src/lib/head/ui-admin-table/create-organisation/create-organisation.component.ts +++ b/project/ws/app/src/lib/head/ui-admin-table/create-organisation/create-organisation.component.ts @@ -44,7 +44,6 @@ export class CreateOrganisationComponent implements OnInit, OnDestroy { uploadedLogoResponse!: IUploadedLogoresponse organizationNameList: string[] = [] ORG_NAME_PATTERN = /^[a-zA-Z0-9 ().,@\-\$\/\\:\[\]!\s]*$/ - rootOrgId: any untilDestroyed$ = new Subject(); isMatcompleteOpened = false @@ -57,7 +56,7 @@ export class CreateOrganisationComponent implements OnInit, OnDestroy { private snackBar: MatSnackBar, private createMDOService: CreateMDOService, private activatedRoute: ActivatedRoute, - private loaderService: LoaderService, + private loaderService: LoaderService ) { this.addOverflowHidden() @@ -218,8 +217,6 @@ export class CreateOrganisationComponent implements OnInit, OnDestroy { } onSubmitCreateOrganization() { - const userProfile = _.get(this.activatedRoute, 'snapshot.parent.data.configService.userProfile') - this.rootOrgId = userProfile.rootOrgId let payload: any = { orgName: this.controls['organisationName']?.value || "", channel: this.controls['organisationName']?.value || "", @@ -230,10 +227,8 @@ export class CreateOrganisationComponent implements OnInit, OnDestroy { logo: this.uploadedLogoResponse?.qrcodepath || "", description: this.controls['description']?.value || "", parentMapId: "", - sbRootOrgId: this.rootOrgId - } - // if (this.heirarchyObject && this.heirarchyObject.sbRootOrgId) { + // if (this.heirarchyObject.sbRootOrgId) { // payload['sbRootOrgId'] = this.heirarchyObject.sbRootOrgId // } if (this.controls['category']?.value === 'state') { diff --git a/project/ws/app/src/lib/head/ui-admin-table/directory-list/directory-table.component.html b/project/ws/app/src/lib/head/ui-admin-table/directory-list/directory-table.component.html index eae9aa95..ca813e44 100644 --- a/project/ws/app/src/lib/head/ui-admin-table/directory-list/directory-table.component.html +++ b/project/ws/app/src/lib/head/ui-admin-table/directory-list/directory-table.component.html @@ -14,14 +14,23 @@
-