fix(json-schema-2020-12-samples): use zero as default example value for int32 and int64 (#10230)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
const int32Generator = () => (2 ** 30) >>> 0
|
||||
const int32Generator = () => 0
|
||||
|
||||
export default int32Generator
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
const int64Generator = () => 2 ** 53 - 1
|
||||
const int64Generator = () => 0
|
||||
|
||||
export default int64Generator
|
||||
|
||||
@@ -79,12 +79,8 @@ describe("sampleFromSchema", () => {
|
||||
expect(sample({ type: "number", format: "float" })).toStrictEqual(0.1)
|
||||
expect(sample({ type: "number", format: "double" })).toStrictEqual(0.1)
|
||||
expect(sample({ type: "integer" })).toStrictEqual(0)
|
||||
expect(sample({ type: "integer", format: "int32" })).toStrictEqual(
|
||||
(2 ** 30) >>> 0
|
||||
)
|
||||
expect(sample({ type: "integer", format: "int64" })).toStrictEqual(
|
||||
2 ** 53 - 1
|
||||
)
|
||||
expect(sample({ type: "integer", format: "int32" })).toStrictEqual(0)
|
||||
expect(sample({ type: "integer", format: "int64" })).toStrictEqual(0)
|
||||
expect(sample({ type: "boolean" })).toStrictEqual(true)
|
||||
expect(sample({ type: "null" })).toStrictEqual(null)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user