Skip to content

Commit

Permalink
fix(schema): change count type from string to number in secret and va…
Browse files Browse the repository at this point in the history
…riable
  • Loading branch information
muntaxir4 committed Dec 4, 2024
1 parent f0b0f9d commit 3eb7088
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/schema/src/secret/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const RollBackSecretRequestSchema = z.object({
})

export const RollBackSecretResponseSchema = z.object({
count: z.string()
count: z.number()
})

export const GetAllSecretsOfProjectRequestSchema = PageRequestSchema.extend({
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/variable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const RollBackVariableRequestSchema = z.object({
})

export const RollBackVariableResponseSchema = z.object({
count: z.string()
count: z.number()
})

export const DeleteVariableRequestSchema = z.object({
Expand Down
4 changes: 2 additions & 2 deletions packages/schema/tests/secret.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ describe('Secret Schema Tests', () => {
describe('RollBackSecretResponseSchema Tests', () => {
it('should validate a valid RollBackSecretResponseSchema', () => {
const result = RollBackSecretResponseSchema.safeParse({
count: '1'
count: 1
})
expect(result.success).toBe(true)
})

it('should not validate an invalid RollBackSecretResponseSchema', () => {
const result = RollBackSecretResponseSchema.safeParse({
count: 1 // Should be a string
count: '1' // Should be a number
})
expect(result.success).toBe(false)
expect(result.error?.issues).toHaveLength(1)
Expand Down
4 changes: 2 additions & 2 deletions packages/schema/tests/variable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ describe('Variable Schema Tests', () => {
describe('RollBackVariableResponseSchema Tests', () => {
it('should validate a valid RollBackVariableResponseSchema', () => {
const result = RollBackVariableResponseSchema.safeParse({
count: '1'
count: 1
})
expect(result.success).toBe(true)
})

it('should not validate an invalid RollBackVariableResponseSchema', () => {
const result = RollBackVariableResponseSchema.safeParse({
count: 1 // Should be a string
count: '1' // Should be a number
})
expect(result.success).toBe(false)
expect(result.error?.issues).toHaveLength(1)
Expand Down

0 comments on commit 3eb7088

Please sign in to comment.