mswjs / data

Data modeling and relation library for testing JavaScript applications.
https://npm.im/@mswjs/data
MIT License
827 stars 52 forks source link

fix(rest-handlers): parse number primary keys from query params #155

Closed ruisaraiva19 closed 3 years ago

ruisaraiva19 commented 3 years ago

GitHub

Changes

kettanaito commented 3 years ago

I'll try to put this on my list in the upcoming days. Once again thank you for your work on this.

kettanaito commented 3 years ago

I've rebased the branch, removed the unnecessary usage of faker from the tests (we specify all the values anyway to assert them being returned from the handler). Also, split a single toRestHandlers.test.ts suite into 2 standalone test suites for readability. That'll help us manage any additional scenarios in the future.

I couldn't resolve the weak query type issue, TypeScript is right, the union type will be converted to StringQuery | NumberQuery which seems not to know what the actual type of id will be. I've cast id as string to prevent any usage of any.

ruisaraiva19 commented 3 years ago

@kettanaito I'm glad to provide value to the project!