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.

貢獻指南

開啟貢獻指南

研究方向

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.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
typescript
領域
testing-qa
Issue 類型
功能
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。