Skip to content

Commit

Permalink
Upgrades to Patternfly 6
Browse files Browse the repository at this point in the history
  • Loading branch information
karesti committed Nov 26, 2024
1 parent 778e943 commit 4ace149
Show file tree
Hide file tree
Showing 122 changed files with 5,206 additions and 5,981 deletions.
17 changes: 17 additions & 0 deletions __mocks__/keycloak-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// __mocks__/keycloak-js.js

// Mock implementation of the Keycloak class
const Keycloak = jest.fn(() => ({
init: jest.fn().mockResolvedValue(true), // Mocks successful initialization
login: jest.fn().mockResolvedValue(true), // Mocks successful login
logout: jest.fn().mockResolvedValue(true), // Mocks successful logout
authenticated: true, // Mocks that the user is authenticated
accountManagement: jest.fn(), // Mocks account management
token: 'mock-token', // Mocks a token
updateToken: jest.fn().mockResolvedValue(true), // Mocks token refresh
authServerUrl: 'http://mock-server-url', // Mocks the auth server URL
realm: 'mock-realm', // Mocks the realm
}));

// Export the mock class
module.exports = Keycloak;
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ module.exports = {
"@app/(.*)": '<rootDir>/src/app/$1',
'@services/(.*)': '<rootDir>/src/services/$1',
'@utils/(.*)': '<rootDir>/src/app/utils/$1',
'^keycloak-js$': '<rootDir>/__mocks__/keycloak-js.js',
},

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

transformIgnorePatterns: ['/node_modules/(?!(react-syntax-highlighter)/)'],

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

0 comments on commit 4ace149

Please sign in to comment.