Skip to content

Commit 4ce4d64

Browse files
committed
fix: apply gemini code review
1 parent 3f2b2b6 commit 4ce4d64

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

packages/express-cargo/tests/validator/isHash.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@ describe('isHash decorator', () => {
120120
})
121121
})
122122

123+
describe('crc32b', () => {
124+
const meta = classMeta.getFieldMetadata('crc32bHash')
125+
const rule = meta.getValidators()?.find(v => v.type === 'isHash')
126+
127+
it('should pass for valid crc32b hash', () => {
128+
expect(rule!.validate('00000000')).toBeNull()
129+
expect(rule!.validate('cbf43926')).toBeNull()
130+
})
131+
132+
it('should fail for invalid crc32b hash', () => {
133+
expect(rule!.validate('0000000')).toBeInstanceOf(CargoFieldError)
134+
expect(rule!.validate('cbf439260')).toBeInstanceOf(CargoFieldError)
135+
})
136+
})
137+
123138
it('should fail for non-string values', () => {
124139
const meta = classMeta.getFieldMetadata('md5Hash')
125140
const rule = meta.getValidators()?.find(v => v.type === 'isHash')

0 commit comments

Comments
 (0)