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 Jan 7, 2025
1 parent 300b4be commit 593d2be
Show file tree
Hide file tree
Showing 123 changed files with 5,214 additions and 5,984 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;
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ Cypress.Commands.add('login', (username, password, url = '/') => {
password: password
}
});
cy.get('#nav-toggle').click();
cy.get('[data-cy=sideBarToggle]').click();
});
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 593d2be

Please sign in to comment.