Skip to content

Commit 8235a2d

Browse files
committed
Upgrades to Patternfly 6
1 parent 300b4be commit 8235a2d

File tree

122 files changed

+5212
-5983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+5212
-5983
lines changed

__mocks__/keycloak-js.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// __mocks__/keycloak-js.js
2+
3+
// Mock implementation of the Keycloak class
4+
const Keycloak = jest.fn(() => ({
5+
init: jest.fn().mockResolvedValue(true), // Mocks successful initialization
6+
login: jest.fn().mockResolvedValue(true), // Mocks successful login
7+
logout: jest.fn().mockResolvedValue(true), // Mocks successful logout
8+
authenticated: true, // Mocks that the user is authenticated
9+
accountManagement: jest.fn(), // Mocks account management
10+
token: 'mock-token', // Mocks a token
11+
updateToken: jest.fn().mockResolvedValue(true), // Mocks token refresh
12+
authServerUrl: 'http://mock-server-url', // Mocks the auth server URL
13+
realm: 'mock-realm', // Mocks the realm
14+
}));
15+
16+
// Export the mock class
17+
module.exports = Keycloak;

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ module.exports = {
2424
"@app/(.*)": '<rootDir>/src/app/$1',
2525
'@services/(.*)': '<rootDir>/src/services/$1',
2626
'@utils/(.*)': '<rootDir>/src/app/utils/$1',
27+
'^keycloak-js$': '<rootDir>/__mocks__/keycloak-js.js',
2728
},
2829

2930
// A preset that is used as a base for Jest's configuration
3031
preset: 'ts-jest/presets/js-with-ts',
3132
setupFilesAfterEnv: ['<rootDir>/test-setup.js'],
3233

34+
transformIgnorePatterns: ['/node_modules/(?!(react-syntax-highlighter)/)'],
35+
3336
// The test environment that will be used for testing.
34-
transformIgnorePatterns: ['/node_modules/(?!(react-syntax-highlighter|keycloak-js)/)'],
3537
testEnvironment: "jsdom",
3638
};

0 commit comments

Comments
 (0)