SSR-1101 PR Changes

This commit is contained in:
Josh Dassinger 2024-03-14 12:39:50 -05:00
parent b0a053c48a
commit ffaea18df7
2 changed files with 16 additions and 2 deletions

View file

@ -4,8 +4,8 @@ import { updateOrCreateISSCookie } from '@/helpers/cookie-helper';
/*
Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing
*/
async function saveSessionHelper(store, options) {
const savedSessionInfo = await store.saveSession(options);
async function saveSessionHelper(store, { submitAfterSave }) {
const savedSessionInfo = await store.saveSession({ submitAfterSave });
if (savedSessionInfo) {
store.setSaveSessionInfo(savedSessionInfo.data);
}

View file

@ -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 () => {
expect.assertions(2);
const error = 'save session error';