-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into task/WP-78--v3-shared-workspaces-tests
- Loading branch information
Showing
14 changed files
with
178 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { expectSaga } from 'redux-saga-test-plan'; | ||
import { pushSystemKeys } from 'redux-saga/effects'; | ||
import { fetchUtil } from 'utils/fetchUtil'; | ||
import { vi } from 'vitest'; | ||
|
||
// Mocks the cross-fetch | ||
vi.mock('cross-fetch'); | ||
|
||
// Test the pushSystemKeys function | ||
describe('pushSystemKeys', () => { | ||
it('updates system data'), | ||
() => { | ||
// Create a mock form for the fetchUtil call | ||
const mockForm = { | ||
password: 'mockPassword', | ||
token: 'mockToken', | ||
hostname: 'mockHostname', | ||
}; | ||
expectSaga(pushSystemKeys, {}) | ||
// Sends the call to update the systems modal | ||
.put({ | ||
type: 'SYSTEMS_MODAL_UPDATE', | ||
payload: { | ||
operation: 'pushKeys', | ||
props: { submitting: true }, | ||
}, | ||
}) | ||
// Sends the form information to the API url indicated | ||
.call(fetchUtil, { | ||
url: `/api/accounts/systems/${action.payload.systemId}/keys/`, | ||
body: JSON.stringify({ mockForm, action: 'push' }), | ||
method: 'PUT', | ||
}) | ||
// Toggles the modal state when successful | ||
.put({ | ||
type: 'SYSTEMS_TOGGLE_MODAL', | ||
payload: { | ||
operation: 'pushKeys', | ||
props: {}, | ||
}, | ||
}); | ||
// Check for action.payload.onSuccess | ||
expect(action.payload).toBe(onSuccess); | ||
}; | ||
}); |
Oops, something went wrong.