Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.

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

Open
michmitz wants to merge 4 commits into
masterfrom
ms-training
Open

michmitz wants to merge 4 commits into
masterfrom
ms-training

Conversation

@michmitz

@michmitz michmitz commented Dec 16, 2021 •

Copy link
Copy Markdown

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.

@ianandrewson ianandrewson left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread src/index.test.ts Outdated
const users = new UserAPI()
const result = users.getUserById(10)

expect(result).toStrictEqual(

Copy link
Copy Markdown
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?

Comment thread src/index.test.ts
Comment thread src/index.test.ts
Comment thread src/index.test.ts
Comment thread src/index.test.ts
Comment thread src/index.ts Outdated
}

export class UserAPI {
users: ReadonlyArray<User>

Copy link
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants