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

Add tests for `numericIdZodType` utility

未关闭
#334 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
good first issue tests
主要语言
TypeScript
星标
20
派生
12
PR 合并指标
30 天内没有已合并 PR

描述

[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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。