code-chronicles-code / code-chronicles-code/leetcode-curriculum
Add tests for `numericIdZodType` utility
- 主要言語
- 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.
コントリビューションガイド
調査の方向性
workspaces/util/src/__tests__/numericIdZodType-test.tsを作成し、numericIdZodTypeとPR #288および#290のテストパターンを調査します。正の整数値とその文字列表現を使ってparse関数をテストし、負の値が拒否されることを確認します。utilityに記載された受け入れられる入力と拒否される入力がカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- testing-qa
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100