NIFI-13164: (#8760)

- Moving from jsdom to happy dom for test environment execution.
- Removing test for the Documentation component that was failing because it was attempting to load an iframe with the nifi documentation that wasn't available.

This closes #8760
This commit is contained in:
Matt Gilman 2024-05-07 11:33:58 -04:00 committed by GitHub
parent 9edea70713
commit 4bbe08fb55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 53 deletions

View File

@ -155,7 +155,7 @@ const config: Config = {
// snapshotSerializers: [],
// The test environment that will be used for testing
testEnvironment: 'jsdom',
testEnvironment: '@happy-dom/jest-environment',
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

View File

@ -46,6 +46,7 @@
"@angular-eslint/template-parser": "17.2.1",
"@angular/cli": "~17.1.3",
"@angular/compiler-cli": "^17.1.3",
"@happy-dom/jest-environment": "^14.10.1",
"@nx/angular": "18.1.3",
"@nx/jest": "^18.1.3",
"@nx/workspace": "18.1.3",
@ -60,6 +61,7 @@
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"happy-dom": "^14.10.1",
"jest": "^29.7.0",
"jest-preset-angular": "^14.0.3",
"nx": "18.1.3",
@ -4726,6 +4728,23 @@
"resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-5.0.13.tgz",
"integrity": "sha512-j61DHjsdUCKMXSdNLTOxcG701FWnF0jcqNNQi2iPCDxU8seN/sMxeh62dC++UiagCWq9ghTypX+Pcy7kX+QOeQ=="
},
"node_modules/@happy-dom/jest-environment": {
"version": "14.10.1",
"resolved": "https://registry.npmjs.org/@happy-dom/jest-environment/-/jest-environment-14.10.1.tgz",
"integrity": "sha512-lKSQWyWQZYKp6xOyaUvPbW1OMp5T+eMjjfQXi5+o66MVIxv6Ej90y+89AiGf9hPQS3ryE7cNAX+/jH2mIrZqgA==",
"dev": true,
"dependencies": {
"@jest/environment": "^29.4.0",
"@jest/fake-timers": "^29.4.0",
"@jest/types": "^29.4.0",
"happy-dom": "^14.10.1",
"jest-mock": "^29.4.0",
"jest-util": "^29.4.0"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.14",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
@ -15023,6 +15042,20 @@
"integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==",
"dev": true
},
"node_modules/happy-dom": {
"version": "14.10.1",
"resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-14.10.1.tgz",
"integrity": "sha512-GRbrZYIezi8+tTtffF4v2QcF8bk1h2loUTO5VYQz3GZdrL08Vk0fI+bwf/vFEBf4C/qVf/easLJ/MY1wwdhytA==",
"dev": true,
"dependencies": {
"entities": "^4.5.0",
"webidl-conversions": "^7.0.0",
"whatwg-mimetype": "^3.0.0"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/harmony-reflect": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.2.tgz",

View File

@ -54,6 +54,7 @@
"@angular-eslint/template-parser": "17.2.1",
"@angular/cli": "~17.1.3",
"@angular/compiler-cli": "^17.1.3",
"@happy-dom/jest-environment": "^14.10.1",
"@nx/angular": "18.1.3",
"@nx/jest": "^18.1.3",
"@nx/workspace": "18.1.3",
@ -68,6 +69,7 @@
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"happy-dom": "^14.10.1",
"jest": "^29.7.0",
"jest-preset-angular": "^14.0.3",
"nx": "18.1.3",

View File

@ -1,52 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Documentation } from './documentation.component';
import { RouterModule } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Component } from '@angular/core';
import { provideMockStore } from '@ngrx/store/testing';
import { initialState } from '../../../state/documentation/documentation.reducer';
describe('Documentation', () => {
let component: Documentation;
let fixture: ComponentFixture<Documentation>;
@Component({
selector: 'navigation',
standalone: true,
template: ''
})
class MockNavigation {}
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [Documentation],
imports: [RouterModule, RouterTestingModule, MockNavigation],
providers: [provideMockStore({ initialState })]
});
fixture = TestBed.createComponent(Documentation);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});