SSR-1101 PR Changes
This commit is contained in:
parent
b0a053c48a
commit
ffaea18df7
2 changed files with 16 additions and 2 deletions
|
|
@ -4,8 +4,8 @@ import { updateOrCreateISSCookie } from '@/helpers/cookie-helper';
|
||||||
/*
|
/*
|
||||||
Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing
|
Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing
|
||||||
*/
|
*/
|
||||||
async function saveSessionHelper(store, options) {
|
async function saveSessionHelper(store, { submitAfterSave }) {
|
||||||
const savedSessionInfo = await store.saveSession(options);
|
const savedSessionInfo = await store.saveSession({ submitAfterSave });
|
||||||
if (savedSessionInfo) {
|
if (savedSessionInfo) {
|
||||||
store.setSaveSessionInfo(savedSessionInfo.data);
|
store.setSaveSessionInfo(savedSessionInfo.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -941,6 +941,20 @@ describe('Store', () => {
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
it('calls api with expected submitAfterSave', async () => {
|
||||||
|
// Arrange
|
||||||
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await store.saveSession({ submitAfterSave: true });
|
||||||
|
|
||||||
|
// Asserts
|
||||||
|
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
|
||||||
|
payload: expect.objectContaining({
|
||||||
|
submitAfterSave: true
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
});
|
||||||
it('api call throws exception', async () => {
|
it('api call throws exception', async () => {
|
||||||
expect.assertions(2);
|
expect.assertions(2);
|
||||||
const error = 'save session error';
|
const error = 'save session error';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue