Creating Mock Widgets and People

Create mock data for an application that conforms to the new interfaces, IWidget and IPerson.

Before we dive into creating our first major functionality, a generic search, we should do some work to include data and some simple rendering in our application. The mock data will give us concrete values that make it easier to test the functions we write.

The benefits of creating mock data

So far, we’ve used relatively simple types in our generic TypeScript examples. But when writing complex functions, like generic searching, sorting and filtering, it’s important to have complex data to test them against.

Creating mock data to use has multiple benefits and helps us:

  • Run our code with concrete examples.
  • Visualize the results of our code.
  • Test locally without having to connect to external APIs or data providers.

Get hands-on with 1400+ tech skills courses.