return fetchLinkedContact().then((linkedContact) =>
ContactsDeleteHelpers.requestWithCookies(
'DELETE',
`http://localhost:8080/api/v1/contacts/${linkedContact.id}/`,
undefined,
{ failOnStatusCode: false },
).then((response) => {
let bodyPreview = '';
try {
const serialized = JSON.stringify(response.body ?? null);
bodyPreview = serialized ?? '';
} catch (error) {
bodyPreview = String(error);
}
Cypress.log({
name: 'deleteContact api',
message: `status ${response.status} body ${bodyPreview.slice(0, 500)}`,
});
expect(
response.status,
'DELETE should be blocked for linked contact (expected 403/409)',
).to.be.oneOf([403, 409]);
}),
);