I am trying to reuse the object literals for both async calls. At the end my expect should check the success of the deleteBucket call. Problem is I can't do this, or it says I've got dup variables defined:
it('can delete a bucket', async () => {
const options = { branch: '11' }
let { failure, success, payload } = await deployApi.createBucket(options)
let { failure, success, payload} = await deployApi.deleteBucket(options.branch)
expect(success).to.be.true
})
Someone told me I could put a () around the second, but that's bombing out giving me a TypeError: (0 , _context4.t0) is not a function
error:
it('can delete a bucket', async () => {
const options = { branch: '11' }
let { failure, success, payload } = await deployApi.createBucket(options)
({ failure, success, payload} = await deployApi.deleteBucket(options.branch))
expect(success).to.be.true
})
This does work, but requires me to change the names of the resolved objects which I do not want to do:
it('can delete a bucket', async () => {
const options = { branch: '11' }
let { failure, success, payload } = await deployApi.createBucket(options)
let { failure1, success1, payload1} = await deployApi.deleteBucket(options.branch)
expect(success1).to.be.true
})
UPDATE:
someone suggested I needed a semi colon after the const line. Didn't make any difference, I still get the same error when I run it:
You don't have to change the names. There's probably just something wrong somewhere else in your program
oh I see, you're missing a semicolon!
which explains the "TypeError:
(0 , _context4.t0)
is not a function" you were seeing – not much else you can do here; I know semicolons suck, but you'll have to use one in this specific scenario."It doesn't make a difference"
Yes it does; try running the exact same code snippet I had above, but without semicolons – you'll recognise the familiar
TypeError