Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step 1 - Create UserAPI class with stub functions, tests #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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.test.ts Show resolved Hide resolved
src/index.test.ts Show resolved Hide resolved
src/index.test.ts Show resolved Hide resolved
src/index.test.ts Show resolved Hide resolved
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