Skip to content

Commit 32ebed6

Browse files
committed
Fixed broken tests
Signed-off-by: James Cocker <james.s.earth@gmail.com>
1 parent fd6551c commit 32ebed6

File tree

3 files changed

+201
-35
lines changed

3 files changed

+201
-35
lines changed

galasa-ui/src/actions/runsAction.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const getCachedApiConfiguration = (): Configuration => {
2121
return cachedApiConfig;
2222
};
2323

24+
// Reset the cached API configuration (useful for testing)
25+
export const resetApiConfigCache = (): void => {
26+
cachedApiConfig = null;
27+
};
28+
2429
export const downloadArtifactFromServer = async (runId: string, artifactUrl: string) => {
2530
const apiConfig = getCachedApiConfiguration();
2631
const rasApiClient = new ResultArchiveStoreAPIApi(apiConfig);

galasa-ui/src/tests/actions/runActions.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
*
44
* SPDX-License-Identifier: EPL-2.0
55
*/
6-
import { downloadArtifactFromServer, updateRunTags } from '@/actions/runsAction';
6+
import {
7+
downloadArtifactFromServer,
8+
updateRunTags,
9+
resetApiConfigCache,
10+
} from '@/actions/runsAction';
711
import * as apiUtils from '@/utils/api';
812
import * as galasaapi from '@/generated/galasaapi';
913
import { CLIENT_API_VERSION } from '@/utils/constants/common';
@@ -30,6 +34,7 @@ describe('downloadArtifactFromServer', () => {
3034

3135
afterEach(() => {
3236
jest.resetAllMocks();
37+
resetApiConfigCache();
3338
});
3439

3540
it('parses valid JSON payload', async () => {
@@ -122,6 +127,7 @@ describe('updateRunTags', () => {
122127

123128
afterEach(() => {
124129
jest.resetAllMocks();
130+
resetApiConfigCache();
125131
});
126132

127133
it('successfully updates tags', async () => {

0 commit comments

Comments
 (0)