test: app-wide TestBed defaults for the Angular projects; fix their stub specs (WIP)

Once the Angular suites loaded, most failures were CLI-generated
`should create` stubs that had never run, failing on the first injection
(TranslateService, NbToastrService, NbDialogRef, ActivatedRoute, the
translate pipe, the default icon pack).

- jest.angular-defaults.ts (setupFilesAfterEnv, after each project's
  test-setup): a top-level beforeEach adds what the app's root module
  provides - TranslateModule.forRoot, the Nebular forRoot modules,
  NgxPermissionsModule.forRoot, the Tabler/eva icon pack, HttpClient
  testing, router, noop animations, a NbDialogRef stub, GAUZY_ENV - and a
  matchMedia stand-in (jsdom has none). configureTestingModule merges, so a
  spec's own providers still win. It imports no ui-core/core: that would
  cache real modules a spec later jest.mock()s.
- jest.preset.js maps dayjs/esm (imported by ngx-daterangepicker-material's
  .mjs bundle) to dayjs's CommonJS build.
- Specs of non-standalone components import the NgModule that declares
  them, provide what the host feature module provides (EmployeesService,
  AuthService, NbAuthModule.forRoot, PipesModule), and set the inputs /
  route data / date-picker config the app always supplies before render.
- Two stubs imported classes their files do not export
  (GauzyRangePickerComponent, ViewComponent) and declared `undefined`.
- desktop-ui-lib's test-setup installs an inert `window.electronAPI`
  preload bridge of the shape apps/agent exposes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruslan Konviser
2026-09-27 22:57:14 +02:00
co-authored by Claude Opus 5.5
parent 02c4289f5f
commit d3d8687ac1
56 changed files with 424 additions and 57 deletions
+2 -1
View File
@@ -181,7 +181,8 @@
"^production",
"{workspaceRoot}/jest.preset.js",
"{workspaceRoot}/jest.resolver.js",
"{workspaceRoot}/jest.interop.js"
"{workspaceRoot}/jest.interop.js",
"{workspaceRoot}/jest.angular-defaults.ts"
],
"options": {
"passWithNoTests": true