Skip to content

Add mocking to unit tests #173

@jessicamcinchak

Description

@jessicamcinchak

Because some of our web components require an OS API key as a property, it means that our unit test references the existing environment variable and would fail with an invalid key.

In order to avoid making live requests during testing and making the tests more resiliant for users without an API key, we should add mocks of the expected responses (at least for OS Places API, we'll still have to think about how we deal with OS Vector Tiles etc).

https://vitest.dev/guide/mocking.html
See #139 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions