© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
D. IrvineBuild Your Own Test Frameworkhttps://doi.org/10.1007/978-1-4842-9247-1_15

15. Deep Equality and Constraining Matchers

Daniel Irvine1  
(1)
London, UK
 
JavaScript is one of many languages that makes it easy to create object-like map structures with expressive syntax:
{
  customerId: 123,
  order: {
    time: 234,
    value: 56.99,
    items: [
      { id: 345, unitPrice: 5.00, quantity: 2 },
      { id: 456, unitPrice: 46.99, quantity: 1 }
    }]
  }
}

Often, objects like this are returned from functions and API calls, which means it helps to have a matcher that can match the values within this entire structure.

Even more importantly, it helps to have a matcher that ...

Get Build Your Own Test Framework: A Practical Guide to Writing Better Automated Tests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.