mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 17:15:24 +00:00
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import { describe, expect, it } from 'bun:test';
|
|
|
|
import { inferDefaultInputValuesFromObjectJSONSchema } from '../input-values';
|
|
|
|
describe('inferDefaultInputValuesFromObjectJSONSchema', () => {
|
|
it('should infer properly the default input value based on the JSON schema of an object', () => {
|
|
const defaultInputValues = inferDefaultInputValuesFromObjectJSONSchema({
|
|
type: 'object',
|
|
properties: {
|
|
claims: {
|
|
type: 'object',
|
|
properties: {
|
|
key: {
|
|
type: 'string',
|
|
},
|
|
flags: {
|
|
type: 'object',
|
|
properties: {
|
|
FLAG1: { type: 'string' },
|
|
FLAG2: { type: 'string' },
|
|
FLAG3: { type: 'string' },
|
|
},
|
|
},
|
|
isAlphaUser: {
|
|
type: 'boolean',
|
|
},
|
|
hello: {
|
|
type: 'string',
|
|
enum: ['enumValue1', 'enumValue2', 'enumValue3'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
expect(defaultInputValues).toMatchObject({
|
|
claims: {
|
|
key: 'default',
|
|
flags: {
|
|
FLAG1: 'default',
|
|
FLAG2: 'default',
|
|
FLAG3: 'default',
|
|
},
|
|
isAlphaUser: true,
|
|
hello: 'enumValue1',
|
|
},
|
|
});
|
|
});
|
|
});
|