mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
more basic unit tests
This commit is contained in:
parent
d0ab7f6c14
commit
f1e15c9eda
@ -45,4 +45,53 @@ describe('OceanCompute', () => {
|
||||
assert(response.status === 6)
|
||||
})
|
||||
})
|
||||
|
||||
describe('#restart()', () => {
|
||||
it('should restart a job', async () => {
|
||||
spy.on(ocean.utils.fetch, 'put', () => responsify({ status: 6 }))
|
||||
spy.on(ocean.utils.fetch, 'post', () => responsify({ jobId: 'my-job-id' }))
|
||||
|
||||
const response = await compute.restart(account, 'xxx', 'xxx')
|
||||
assert(response.jobId === 'my-job-id')
|
||||
})
|
||||
})
|
||||
|
||||
describe('#delete()', () => {
|
||||
it('should delete a job', async () => {
|
||||
spy.on(ocean.utils.fetch, 'delete', () => responsify({ status: 8 }))
|
||||
|
||||
const response = await compute.delete(account, 'xxx', 'xxx')
|
||||
assert(response.status === 8)
|
||||
})
|
||||
})
|
||||
|
||||
describe('#status()', () => {
|
||||
it('should get the status of one job', async () => {
|
||||
spy.on(ocean.utils.fetch, 'get', () => responsify([{ status: 1 }]))
|
||||
|
||||
const response = await compute.status(account, 'xxx', 'xxx')
|
||||
assert(response.length === 1)
|
||||
assert(response[0].status === 1)
|
||||
})
|
||||
|
||||
it('should get the status of multiple jobs', async () => {
|
||||
spy.on(ocean.utils.fetch, 'get', () =>
|
||||
responsify([{ status: 1 }, { status: 1 }])
|
||||
)
|
||||
|
||||
const response = await compute.status(account, 'xxx')
|
||||
assert(response.length === 2)
|
||||
assert(response[0].status === 1)
|
||||
})
|
||||
|
||||
it('should get all jobs for one owner', async () => {
|
||||
spy.on(ocean.utils.fetch, 'get', () =>
|
||||
responsify([{ status: 1 }, { status: 1 }])
|
||||
)
|
||||
|
||||
const response = await compute.status(account)
|
||||
assert(response.length === 2)
|
||||
assert(response[0].status === 1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user