code-chronicles-code / code-chronicles-code/leetcode-curriculum

Add tests for `numericIdZodType` utility

Open
#334 0 comments 0 reactions 0 assignees View on GitHub
good first issue tests
Dominant language
TypeScript
Stars
20
Forks
12
PR merge metrics
No merged PRs in 30d

Description

[Zod](https://zod.dev/) is a library for validating and parsing data. `numericIdZodType` is a utility we use to validate and parse numeric IDs, it accepts positive integers or the string representation of a positive integer.

This issue involves adding a file `workspaces/util/src/__tests__/numericIdZodType-test.ts`, for testing the `numericIdZodType` utility. Specifically, we care about testing the `parse` function, so stuff like:

```ts
expect(numericIdZodType.parse(123)).toBe(123);
expect(() => numericIdZodType.parse(-123)).toThrow(/* some error */);
```

To see some PRs that add tests, take a look at #288 and #290 for inspiration.

Contributor guide

Open the contributing guide

Research direction

Create workspaces/util/src/__tests__/numericIdZodType-test.ts and inspect numericIdZodType plus the test patterns in PRs #288 and #290. Exercise its parse function with positive integer numbers and string representations, and verify that negative values are rejected. Done means the utility's stated accepted and rejected inputs are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.