Skip to content

Commit

Permalink
Migrated Unit Tests on runtime-gateway-api package
Browse files Browse the repository at this point in the history
  • Loading branch information
Sara4994 committed Jul 31, 2023
1 parent bf06df9 commit 3bc2ebf
Show file tree
Hide file tree
Showing 4 changed files with 3,312 additions and 9,879 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const enzyme = require('enzyme');
const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
const { TextDecoder } = require('util');

global.TextDecoder = TextDecoder;
enzyme.configure({ adapter: new Adapter() });
53 changes: 53 additions & 0 deletions ui-packages/packages/runtime-gateway-api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed 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.
*/

module.exports = {
setupFiles: [
"./config/Jest-config/test-shim.js",
"./config/Jest-config/test-setup.js",
"core-js"
],
moduleFileExtensions: [
"ts",
"tsx",
"js"
],
coveragePathIgnorePatterns: [
"./src/static",
"./src/graphql",
"dist/"
],
coverageReporters: [
[
"lcov",
{
projectRoot: "../../"
}
]
],
transformIgnorePatterns: [],
transform: {
"^.+\.jsx?$": "./config/Jest-config/babel-jest-wrapper.js",
"^.+\.(ts|tsx)$": "ts-jest",
"\.(jpg|jpeg|png|svg)$": "./config/Jest-config/fileMocks.js"
},
testMatch: [
"**/tests/*.(ts|tsx|js)"
],
moduleNameMapper: {
"\.(scss|sass|css)$": "identity-obj-proxy"
}
}
45 changes: 1 addition & 44 deletions ui-packages/packages/runtime-gateway-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@
"@graphql-codegen/typescript-operations": "^2.5.13",
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
"@testing-library/jest-dom": "^5.16.5",
"@types/enzyme": "^3.10.13",
"@testing-library/react": "^11.2.6",
"@types/jest": "^26.0.24",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"babel-jest": "^25.5.1",
"copyfiles": "^2.4.1",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3",
"jest-junit": "^14.0.1",
Expand All @@ -60,46 +57,6 @@
"ts-jest": "^26.5.6",
"typescript": "^4.9.5"
},
"jest": {
"setupFiles": [
"./config/Jest-config/test-shim.js",
"./config/Jest-config/test-setup.js",
"core-js"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"coveragePathIgnorePatterns": [
"./src/static",
"./src/graphql",
"dist/"
],
"coverageReporters": [
[
"lcov",
{
"projectRoot": "../../"
}
]
],
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"transformIgnorePatterns": [],
"transform": {
"^.+\\.jsx?$": "./config/Jest-config/babel-jest-wrapper.js",
"^.+\\.(ts|tsx)$": "ts-jest",
"\\.(jpg|jpeg|png|svg)$": "./config/Jest-config/fileMocks.js"
},
"testMatch": [
"**/tests/*.(ts|tsx|js)"
],
"moduleNameMapper": {
"\\.(scss|sass|css)$": "identity-obj-proxy"
}
},
"lint-staged": {
"*.{ts,tsx}": [
"pnpm run format",
Expand Down
Loading

0 comments on commit 3bc2ebf

Please sign in to comment.