Skip to content

Conversation

michmitz
Copy link

@michmitz michmitz commented Dec 16, 2021

1. What this does:

  • Creates a class, UserAPI, with defined type interface
  • Creates stub CRUD functions with typed inputs/outputs
  • Creates stub tests for each UserAPI function

2. Ticket:
Discussed with Aron.

Copy link
Contributor

@ianandrewson ianandrewson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests for error handling are in order, but pretty solid all in all!

const users = new UserAPI()
const result = users.getUserById(10)

expect(result).toStrictEqual(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's best to have the returned result be a falsey value if no user is found?

src/index.ts Outdated

export class UserAPI {
users: ReadonlyArray<User>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aron is going to say this should be private.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants