|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
769 bytes
|
| Line | |
|---|
| 1 | import test from 'tape';
|
|---|
| 2 |
|
|---|
| 3 | import { generateObjSchema, arraySchema, enumArraySchema } from '../../../src/util/schemas';
|
|---|
| 4 |
|
|---|
| 5 | test('schemas', (t) => {
|
|---|
| 6 | t.test('should generate an object schema with correct properties', (st) => {
|
|---|
| 7 | const schema = generateObjSchema({
|
|---|
| 8 | foo: 'bar',
|
|---|
| 9 | baz: arraySchema,
|
|---|
| 10 | });
|
|---|
| 11 | const properties = schema.properties || {};
|
|---|
| 12 |
|
|---|
| 13 | st.deepEqual(properties.foo, properties.foo, 'bar');
|
|---|
| 14 | st.deepEqual(properties.baz.type, 'array');
|
|---|
| 15 |
|
|---|
| 16 | st.end();
|
|---|
| 17 | });
|
|---|
| 18 |
|
|---|
| 19 | t.deepEqual(
|
|---|
| 20 | enumArraySchema(),
|
|---|
| 21 | {
|
|---|
| 22 | additionalItems: false,
|
|---|
| 23 | items: {
|
|---|
| 24 | enum: [],
|
|---|
| 25 | type: 'string',
|
|---|
| 26 | },
|
|---|
| 27 | minItems: 0,
|
|---|
| 28 | type: 'array',
|
|---|
| 29 | uniqueItems: true,
|
|---|
| 30 | },
|
|---|
| 31 | 'enumArraySchema works with no arguments',
|
|---|
| 32 | );
|
|---|
| 33 |
|
|---|
| 34 | t.end();
|
|---|
| 35 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.