BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
15 / 18 · Module 18 — Interview Coding Scenarios · filtered: cheatsheet← prev⊞ allnext →

18.48The corresponding external test

test('customer and contact are linked in Salesforce', async ({ request }) => {
  const customerId = `AUTO-${crypto.randomUUID()}`;
  const contactId = `CONTACT-${crypto.randomUUID()}`;

  const response = await request.post('/customers', {
    data: {
      customerId,
      companyName: 'Acme',
      contacts: [{
        contactId,
        firstName: 'John',
        lastName: 'Smith'
      }]
    }
  });

  expect(response.ok()).toBeTruthy();

  const account =
    await salesforce.getAccountByExternalId(customerId);

  const contact =
    await salesforce.getContactByExternalId(contactId);

  expect(contact.AccountId).toBe(account.Id);
});

That's where you can leverage your strongest coding skill if the discussion moves toward test automation.