Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function (res) {
// We've POSTed a packet. Now try to delete it. Get the location
// out of the returned header
const packet_link = res.headers.get('location');
// Check its value
expect(packet_link).toEqual(packets_url + '/' + timestamp(0));
// Now delete it.
return frisby.del(packet_link)
.expect('status', 204)
.then(function (res) {
// Make sure it's truly deleted. This also tests getting a non-existent packet
return frisby.get(packet_link)
.expect('status', 404);
});
})
.done(doneFn);
it('DELETE existing recycle is forbidden', () => {
return frisby.del(API_URL + '/Recycles/1', { headers: authHeader })
.expect('status', 401)
})
})
it('DELETE existing privacy request is forbidden', () => {
return frisby.del(API_URL + '/PrivacyRequests/1', { headers: authHeader })
.expect('status', 401)
})
})
it('DELETE existing product is forbidden via public API', () => {
return frisby.del(API_URL + '/Products/1')
.expect('status', 401)
})
it('DELETE existing security question is forbidden via public API even when authenticated', () => {
return frisby.del(API_URL + '/SecurityQuestions/1', { headers: authHeader })
.expect('status', 401)
})
})
it('DELETE existing complaint is forbidden', () => {
return frisby.del(API_URL + '/Complaints/1', { headers: authHeader })
.expect('status', 401)
})
})
it('DELETE existing feedback is forbidden via public API', function (done) {
frisby.del(API_URL + '/Feedbacks/1')
.expect('status', 401)
.done(done)
})
it('DELETE existing challenge is forbidden via public API even when authenticated', () => {
return frisby.del(API_URL + '/Challenges/1', { headers: authHeader })
.expect('status', 401)
})
})
.then(({ json }) => {
return frisby.del(API_URL + '/BasketItems/' + json.data.id, { headers: authHeader })
.expect('status', 200)
})
})
it("should delete a measurement", function (doneFn) {
frisby.del(measurement_url)
.expect('status', 204)
.then(function () {
frisby.get(measurement_url)
.expect('status', 404);
})
.done(doneFn);
});
});