Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Jan 10, 2025
1 parent 5c54086 commit fecc6b7
Show file tree
Hide file tree
Showing 34 changed files with 92 additions and 353 deletions.
15 changes: 2 additions & 13 deletions apps/datafeeder/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })
4 changes: 3 additions & 1 deletion apps/datahub/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

setupZoneTestEnv()

class ResizeObserverMock {
observe = jest.fn()
unobserve = jest.fn()
Expand Down
15 changes: 2 additions & 13 deletions apps/demo/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })
4 changes: 3 additions & 1 deletion apps/map-viewer/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

setupZoneTestEnv()
4 changes: 3 additions & 1 deletion apps/metadata-converter/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

setupZoneTestEnv()
9 changes: 6 additions & 3 deletions apps/metadata-editor/src/app/auth-guard.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { TestBed } from '@angular/core/testing'
import { of } from 'rxjs'
import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface'

Object.defineProperty(window, 'location', {
value: new URL('http://localhost'),
})
// window.location.href = 'http://localhost/'

// let currentUrl
// jest
// .spyOn(window.location, 'href', 'set')
// .mockImplementation((url) => (currentUrl = url))

describe('AuthGuardService', () => {
let service: AuthGuardService
Expand Down
14 changes: 2 additions & 12 deletions apps/metadata-editor/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

import { CommonModule } from '@angular/common'
import { getTestBed } from '@angular/core/testing'
import { BrowserModule } from '@angular/platform-browser'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'
import { RouterModule } from '@angular/router'
import { AvatarServiceInterface } from '@geonetwork-ui/api/repository'
import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface'
Expand All @@ -17,12 +12,7 @@ import { ngMocks } from 'ng-mocks'
import { BehaviorSubject, EMPTY } from 'rxjs'
import { TranslateModule } from '@ngx-translate/core'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv()

// ng-mocks global configuration
ngMocks.autoSpy('jest')
Expand Down
15 changes: 2 additions & 13 deletions apps/search/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })
15 changes: 2 additions & 13 deletions apps/webcomponents/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import {
elasticFullResponseFixture,
elasticHitsOnlyFixture,
Expand All @@ -15,6 +15,8 @@ import {
import { TranslateService } from '@ngx-translate/core'
import { Gn4Record } from '../gn4/types/metadata.model'

setupZoneTestEnv()

class MetadataUrlServiceMock {
translate = undefined
getUrl = (uuid) => `http://my.catalog.org/metadata/${uuid}`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import { TestBed } from '@angular/core/testing'
import { elasticLinkFixture } from '@geonetwork-ui/common/fixtures'
import { Gn4FieldMapper } from './gn4.field.mapper'
import { MetadataUrlService } from './metadata-url.service'
import { TranslateService } from '@ngx-translate/core'

setupZoneTestEnv()

class MetadataUrlServiceMock {
translate = undefined
getUrl = () => 'url'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import { TestBed } from '@angular/core/testing'
import { TranslateService } from '@ngx-translate/core'
import { MetadataUrlService } from './metadata-url.service'
import { Configuration } from '@geonetwork-ui/data-access/gn4'

setupZoneTestEnv()

const translateServiceMock = {
currentLang: 'en',
}
Expand Down
4 changes: 3 additions & 1 deletion libs/api/repository/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

setupZoneTestEnv()
15 changes: 2 additions & 13 deletions libs/feature/auth/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })
15 changes: 2 additions & 13 deletions libs/feature/catalog/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })
15 changes: 2 additions & 13 deletions libs/feature/dataviz/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })

class ResizeObserverMock {
observe = jest.fn()
Expand Down
15 changes: 2 additions & 13 deletions libs/feature/editor/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'
import { ngMocks } from 'ng-mocks'
import { CommonModule } from '@angular/common'
import { BrowserModule } from '@angular/platform-browser'
import { TranslateModule } from '@ngx-translate/core'
import { EditorFacade } from './lib/+state/editor.facade'
import { EMPTY } from 'rxjs'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })

// ng-mocks global configuration
ngMocks.autoSpy('jest')
Expand Down
15 changes: 2 additions & 13 deletions libs/feature/map/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })

class ResizeObserverMock {
observe = jest.fn()
Expand Down
15 changes: 2 additions & 13 deletions libs/feature/notifications/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
import 'jest-preset-angular/setup-jest'
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'
import '../../../../jest.setup'

import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
)
setupZoneTestEnv({ teardown: { destroyAfterEach: false } })

class ResizeObserverMock {
observe = jest.fn()
Expand Down
Loading

0 comments on commit fecc6b7

Please sign in to comment.