1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-09 21:30:05 +00:00

fix(poll-job-state): fixed checking session state

This commit is contained in:
Yury Shkoda
2023-09-15 08:51:39 +03:00
parent 3a186bc55c
commit 56e6131e5c
2 changed files with 16 additions and 11 deletions

View File

@@ -465,7 +465,7 @@ describe('doPoll', () => {
.spyOn(sessionManager as any, 'getSessionState')
.mockImplementation(() => {
return Promise.resolve({
result: SessionState.Running,
result: SessionState.Idle,
responseStatus: 200
})
})
@@ -533,9 +533,9 @@ describe('doPoll', () => {
)
})
it('should throw an error if session is not in running state', async () => {
it('should throw an error if session state is not healthy', async () => {
const filteredSessionStates = Object.values(SessionState).filter(
(state) => state !== SessionState.Running
(state) => state !== SessionState.Running && state !== SessionState.Idle
)
const randomSessionState =
filteredSessionStates[
@@ -580,7 +580,7 @@ describe('doPoll', () => {
new JobStatePollError(
mockJob.id,
new Error(
`Session state of the job is not 'running'. Session state is '${randomSessionState}'`
`Session state of the job is not 'running' or 'idle'. Session state is '${randomSessionState}'`
)
)
)