code-chronicles-code/leetcode-curriculum

Add tests for `numericIdZodType` utility

開放

#334 建立於 2024年8月17日

 (0 則留言) (0 個反應) (0 位負責人)TypeScript (12 個分叉)auto 404
good first issuetests

倉庫指標

星標
 (19 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Zod 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:

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.

貢獻者指南