@takeshape/schema 11.72.0 → 11.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/models/runtime-schema.js +1 -0
  2. package/dist/project-schema/latest.d.ts +6 -1
  3. package/dist/project-schema/v3.48.0.d.ts +6 -1
  4. package/dist/project-schema/v3.49.0.d.ts +6 -1
  5. package/dist/project-schema/v3.50.0.d.ts +6 -1
  6. package/dist/project-schema/v3.51.0.d.ts +6 -1
  7. package/dist/project-schema/v3.52.0.d.ts +6 -1
  8. package/dist/project-schema/v3.53.0.d.ts +6 -1
  9. package/dist/project-schema/v3.54.0.d.ts +6 -1
  10. package/dist/schemas/project-schema/experimental.json +20 -0
  11. package/dist/util/expressions.js +2 -2
  12. package/package.json +6 -6
  13. package/dist/__tests__/_examples.test.d.ts +0 -1
  14. package/dist/__tests__/_examples.test.js +0 -77
  15. package/dist/__tests__/agents.test.d.ts +0 -1
  16. package/dist/__tests__/agents.test.js +0 -163
  17. package/dist/__tests__/api-version.test.d.ts +0 -1
  18. package/dist/__tests__/api-version.test.js +0 -24
  19. package/dist/__tests__/builtin-schema.test.d.ts +0 -1
  20. package/dist/__tests__/builtin-schema.test.js +0 -18
  21. package/dist/__tests__/content-schema-transform.test.d.ts +0 -1
  22. package/dist/__tests__/content-schema-transform.test.js +0 -522
  23. package/dist/__tests__/create-input-schema.test.d.ts +0 -1
  24. package/dist/__tests__/create-input-schema.test.js +0 -184
  25. package/dist/__tests__/enum.test.d.ts +0 -1
  26. package/dist/__tests__/enum.test.js +0 -36
  27. package/dist/__tests__/flatten-templates.test.d.ts +0 -1
  28. package/dist/__tests__/flatten-templates.test.js +0 -40
  29. package/dist/__tests__/get-is-leaf.test.d.ts +0 -1
  30. package/dist/__tests__/get-is-leaf.test.js +0 -50
  31. package/dist/__tests__/interfaces.test.d.ts +0 -1
  32. package/dist/__tests__/interfaces.test.js +0 -219
  33. package/dist/__tests__/migration.test.d.ts +0 -1
  34. package/dist/__tests__/migration.test.js +0 -34
  35. package/dist/__tests__/mocks.test.d.ts +0 -1
  36. package/dist/__tests__/mocks.test.js +0 -24
  37. package/dist/__tests__/refs.test.d.ts +0 -1
  38. package/dist/__tests__/refs.test.js +0 -813
  39. package/dist/__tests__/relationships.test.d.ts +0 -1
  40. package/dist/__tests__/relationships.test.js +0 -638
  41. package/dist/__tests__/schema-transform.test.d.ts +0 -1
  42. package/dist/__tests__/schema-transform.test.js +0 -205
  43. package/dist/__tests__/schema-util.test.d.ts +0 -1
  44. package/dist/__tests__/schema-util.test.js +0 -1731
  45. package/dist/__tests__/service-dependencies.test.d.ts +0 -1
  46. package/dist/__tests__/service-dependencies.test.js +0 -360
  47. package/dist/__tests__/unions.test.d.ts +0 -1
  48. package/dist/__tests__/unions.test.js +0 -44
  49. package/dist/__tests__/validate.test.d.ts +0 -1
  50. package/dist/__tests__/validate.test.js +0 -1980
  51. package/dist/__tests__/workflows.test.d.ts +0 -3
  52. package/dist/__tests__/workflows.test.js +0 -149
  53. package/dist/layers/__tests__/layers.test.d.ts +0 -1
  54. package/dist/layers/__tests__/layers.test.js +0 -38
  55. package/dist/migration/to/__tests__/v3.10.0.test.d.ts +0 -1
  56. package/dist/migration/to/__tests__/v3.10.0.test.js +0 -90
  57. package/dist/migration/to/__tests__/v3.12.3.test.d.ts +0 -1
  58. package/dist/migration/to/__tests__/v3.12.3.test.js +0 -103
  59. package/dist/migration/to/__tests__/v3.17.test.d.ts +0 -1
  60. package/dist/migration/to/__tests__/v3.17.test.js +0 -71
  61. package/dist/migration/to/__tests__/v3.34.0.test.d.ts +0 -1
  62. package/dist/migration/to/__tests__/v3.34.0.test.js +0 -240
  63. package/dist/migration/to/__tests__/v3.39.0.test.d.ts +0 -1
  64. package/dist/migration/to/__tests__/v3.39.0.test.js +0 -116
  65. package/dist/migration/to/__tests__/v3.46.0.test.d.ts +0 -1
  66. package/dist/migration/to/__tests__/v3.46.0.test.js +0 -59
  67. package/dist/models/__tests__/fixtures.d.ts +0 -15
  68. package/dist/models/__tests__/fixtures.js +0 -56
  69. package/dist/models/__tests__/query.test.d.ts +0 -1
  70. package/dist/models/__tests__/query.test.js +0 -19
  71. package/dist/models/__tests__/runtime-schema.test.d.ts +0 -1
  72. package/dist/models/__tests__/runtime-schema.test.js +0 -43
  73. package/dist/models/__tests__/shape.test.d.ts +0 -1
  74. package/dist/models/__tests__/shape.test.js +0 -24
  75. package/dist/resolvers/ai/__tests__/rag-query.test.d.ts +0 -1
  76. package/dist/resolvers/ai/__tests__/rag-query.test.js +0 -49
  77. package/dist/services/__tests__/services.test.d.ts +0 -1
  78. package/dist/services/__tests__/services.test.js +0 -113
  79. package/dist/template-shapes/__tests__/index.test.d.ts +0 -1
  80. package/dist/template-shapes/__tests__/index.test.js +0 -40
  81. package/dist/template-shapes/__tests__/names.test.d.ts +0 -1
  82. package/dist/template-shapes/__tests__/names.test.js +0 -19
  83. package/dist/template-shapes/__tests__/templates.test.d.ts +0 -1
  84. package/dist/template-shapes/__tests__/templates.test.js +0 -80
  85. package/dist/template-shapes/__tests__/where.test.d.ts +0 -1
  86. package/dist/template-shapes/__tests__/where.test.js +0 -218
  87. package/dist/types/__tests__/utils.test.d.ts +0 -1
  88. package/dist/types/__tests__/utils.test.js +0 -159
  89. package/dist/util/__tests__/api-indexing.test.d.ts +0 -1
  90. package/dist/util/__tests__/api-indexing.test.js +0 -129
  91. package/dist/util/__tests__/detect-cycles.test.d.ts +0 -1
  92. package/dist/util/__tests__/detect-cycles.test.js +0 -193
  93. package/dist/util/__tests__/expressions.test.d.ts +0 -1
  94. package/dist/util/__tests__/expressions.test.js +0 -172
  95. package/dist/util/__tests__/find-shape-at-path.test.d.ts +0 -1
  96. package/dist/util/__tests__/find-shape-at-path.test.js +0 -41
  97. package/dist/util/__tests__/form-config.test.d.ts +0 -1
  98. package/dist/util/__tests__/form-config.test.js +0 -196
  99. package/dist/util/__tests__/get-return-shape.test.d.ts +0 -1
  100. package/dist/util/__tests__/get-return-shape.test.js +0 -27
  101. package/dist/util/__tests__/has-args.test.d.ts +0 -1
  102. package/dist/util/__tests__/has-args.test.js +0 -46
  103. package/dist/util/__tests__/merge.test.d.ts +0 -1
  104. package/dist/util/__tests__/merge.test.js +0 -1074
  105. package/dist/util/__tests__/patch-schema.test.d.ts +0 -1
  106. package/dist/util/__tests__/patch-schema.test.js +0 -82
  107. package/dist/util/__tests__/shapes.test.d.ts +0 -1
  108. package/dist/util/__tests__/shapes.test.js +0 -30
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- import { expect, test } from 'vitest';
2
- import { isEnumLikeSchema } from "../enum.js";
3
- test('isEnumSchema', () => {
4
- expect(isEnumLikeSchema({ enum: ['a', 'b', 'c'] })).toBe(true);
5
- expect(isEnumLikeSchema({
6
- oneOf: [
7
- {
8
- title: 'A',
9
- enum: ['a']
10
- },
11
- {
12
- title: 'B',
13
- const: 'b'
14
- },
15
- {
16
- title: 'C',
17
- enum: ['c']
18
- }
19
- ]
20
- })).toBe(true);
21
- expect(isEnumLikeSchema({
22
- oneOf: [
23
- {
24
- type: 'string'
25
- },
26
- {
27
- title: 'B',
28
- const: 'b'
29
- },
30
- {
31
- title: 'C',
32
- enum: ['c']
33
- }
34
- ]
35
- })).toBe(false);
36
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,40 +0,0 @@
1
- import { DEFAULT_ENTITLEMENTS } from '@takeshape/util';
2
- import { expect, test } from 'vitest';
3
- import betzinoJson from '@/examples/latest/betzino.json';
4
- import shapeBooksSchemaJson from '@/examples/latest/shape-books.json';
5
- import { flattenTemplates } from "../flatten-templates.js";
6
- import { applyDefaultsToSchema, getAllRefs } from "../schema-util.js";
7
- import { validateSchema } from "../validate/validate.js";
8
- test('flattenTemplates', async () => {
9
- const flattened = flattenTemplates(shapeBooksSchemaJson);
10
- const { errors } = await validateSchema({
11
- entitlements: DEFAULT_ENTITLEMENTS
12
- }, flattened);
13
- expect(errors).toEqual(undefined);
14
- // All templates have been replaced with shapes
15
- const templateRefs = getAllRefs(flattened, (ref) => Boolean(ref.template));
16
- expect(templateRefs.length).toBe(0);
17
- });
18
- test('flattenTemplates - betzino', async () => {
19
- const projectSchema = applyDefaultsToSchema(betzinoJson);
20
- const flattened = flattenTemplates(projectSchema);
21
- const { errors } = await validateSchema({
22
- entitlements: DEFAULT_ENTITLEMENTS
23
- }, flattened);
24
- expect(errors).toEqual(undefined);
25
- // Verify that refs are rewritten to those of input shapes
26
- expect(flattened.shapes.UpdateLayoutInput).toBeTruthy();
27
- const updateLayoutInputSchema = flattened.shapes.UpdateLayoutInput.schema;
28
- expect(updateLayoutInputSchema.properties.items.items).toEqual({
29
- '@ref': 'local:LayoutItemsInput'
30
- });
31
- // Verify that TSRelationship doesn't get rewritten as an input shape
32
- expect(flattened.shapes.LayoutItemsInput).toBeTruthy();
33
- const layoutItemsInputSchema = flattened.shapes.LayoutItemsInput.schema;
34
- expect(layoutItemsInputSchema.properties.components.items).toEqual({
35
- '@ref': 'local:TSRelationship'
36
- });
37
- // All templates have been replaced with shapes
38
- const templateRefs = getAllRefs(flattened, (ref) => Boolean(ref.template));
39
- expect(templateRefs.length).toBe(0);
40
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,50 +0,0 @@
1
- import { expect, test } from 'vitest';
2
- import petOneOfSchemaJson from '@/examples/latest/pet-oneof-array.json';
3
- import shapeBooksSchemaJson from '@/examples/latest/shape-books.json';
4
- import userSchemaJson from '@/examples/latest/user-schema-with-defaults.json';
5
- import { getIsLeaf } from "../get-is-leaf.js";
6
- import { applyDefaultsToSchema } from "../schema-util.js";
7
- const userSchema = applyDefaultsToSchema(userSchemaJson);
8
- const petOneOfSchema = applyDefaultsToSchema(petOneOfSchemaJson);
9
- const shapeBooksSchema = applyDefaultsToSchema(shapeBooksSchemaJson);
10
- test('getIsLeaf - Post', () => {
11
- const bodyKey = 'rybsZhDU-';
12
- const featureImageKey = 'BybUznPIW';
13
- const titleKey = 'BkJDGhw8W';
14
- const isLeaf = getIsLeaf(shapeBooksSchema, shapeBooksSchema.shapes.Post.schema);
15
- expect(isLeaf(titleKey)).toBe(true);
16
- expect(isLeaf(featureImageKey)).toBe(true);
17
- expect(isLeaf(bodyKey)).toBe(true);
18
- expect(isLeaf(`${bodyKey}:es-mx`)).toBe(true);
19
- });
20
- test('getIsLeaf - Homepage', () => {
21
- const heroKey = 'ry4VnCD8W';
22
- const titleKey = 'BJfmu0OIZ';
23
- const heroImageKey = 'H1vBnAv8-';
24
- const isLeaf = getIsLeaf(shapeBooksSchema, shapeBooksSchema.shapes.Homepage.schema);
25
- expect(isLeaf(heroKey)).toBe(false);
26
- expect(isLeaf(titleKey)).toBe(true);
27
- expect(isLeaf(heroImageKey)).toBe(true);
28
- });
29
- test('getIsLeaf - User', () => {
30
- const isLeaf = getIsLeaf(userSchema, userSchema.shapes.User.schema);
31
- expect(isLeaf('emailId')).toBe(true);
32
- expect(isLeaf('locationsId')).toBe(false);
33
- expect(isLeaf('latId')).toBe(true);
34
- expect(isLeaf('lonId')).toBe(true);
35
- });
36
- test('getIsLeaf - oneOf', () => {
37
- const petStoreKey = 'aaa3LRPxC';
38
- const catNameKey = 'tbWPT2kvU';
39
- const catBreedKey = 'XuyPh7IHw';
40
- const dogNameKey = 'i7S3LRPxC';
41
- const dogRankKey = 'yOvol-ZPg';
42
- const dogIsBestFriendKey = 'bbbbb-ZPg';
43
- const isLeaf = getIsLeaf(petOneOfSchema, petOneOfSchema.shapes.PetStore.schema);
44
- expect(isLeaf(petStoreKey)).toBe(true);
45
- expect(isLeaf(catNameKey)).toBe(true);
46
- expect(isLeaf(catBreedKey)).toBe(true);
47
- expect(isLeaf(dogNameKey)).toBe(true);
48
- expect(isLeaf(dogRankKey)).toBe(true);
49
- expect(isLeaf(dogIsBestFriendKey)).toBe(true);
50
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,219 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import { getImplementationShapeMap, getImplementationShapeNameMap, getImplementingShapes, getPossibleShapeNames, interfaceToUnion, isInterfaceRef, isInterfaceShape, pruneUnusedInterfaces } from "../interfaces.js";
3
- import { createMockSchema } from "../mocks.js";
4
- import { createShape } from "../schema-util.js";
5
- const Node = createShape('Node', {
6
- type: 'object',
7
- properties: { id: { type: 'string', '@tag': 'id' } },
8
- required: ['id']
9
- }, { type: 'interface' });
10
- const petStoreSchema = createMockSchema('project-id', {
11
- queries: {
12
- getPetstore: {
13
- resolver: {
14
- name: 'graphql:query',
15
- service: 'petco',
16
- fieldName: 'getPetstore'
17
- },
18
- shape: 'Petco_PetStore'
19
- },
20
- search: {
21
- resolver: {
22
- name: 'graphql:query',
23
- service: 'petco',
24
- fieldName: 'search'
25
- },
26
- shape: 'Petco_SearchResponse'
27
- }
28
- },
29
- services: {
30
- petco: {
31
- id: 'petco',
32
- title: 'Petco',
33
- serviceType: 'graphql',
34
- provider: 'petco',
35
- authenticationType: 'none',
36
- namespace: 'Petco'
37
- }
38
- },
39
- shapes: {
40
- Node,
41
- Petco_SearchResponse: createShape('Petco_SearchResponse', {
42
- type: 'object',
43
- properties: {
44
- results: {
45
- type: 'array',
46
- items: {
47
- '@ref': 'petco:FuzzyFriend'
48
- },
49
- '@mapping': 'petco:SearchResponse.results'
50
- },
51
- total: {
52
- type: 'number',
53
- '@mapping': 'petco:SearchResponse.total'
54
- }
55
- },
56
- required: ['results', 'total']
57
- }),
58
- Petco_FuzzyFriend: createShape('Petco_FuzzyFriend', {
59
- type: 'object',
60
- properties: {
61
- name: {
62
- type: 'string',
63
- '@mapping': 'petco:FuzzyFriend.name'
64
- }
65
- },
66
- required: ['name']
67
- }, { type: 'interface' }),
68
- Petco_Undead: createShape('Petco_Undead', {
69
- type: 'object',
70
- properties: {
71
- lives: {
72
- type: 'integer',
73
- '@mapping': 'petco:Petco_Undead.lives'
74
- }
75
- },
76
- required: ['name']
77
- }, { type: 'interface' }),
78
- Petco_Dog: createShape('Petco_Dog', {
79
- type: 'object',
80
- properties: {
81
- id: {
82
- type: 'string',
83
- '@tag': 'id',
84
- '@mapping': 'petco:Cat.id'
85
- },
86
- name: {
87
- type: 'string',
88
- '@mapping': 'petco:Dog.name'
89
- },
90
- isBestFriend: {
91
- type: 'boolean',
92
- default: true,
93
- '@mapping': 'petco:Dog.isBestFriend'
94
- },
95
- catPal: {
96
- '@ref': 'petco:Cat',
97
- '@mapping': 'petco:Dog.catPal'
98
- }
99
- },
100
- required: ['id', 'name']
101
- }, { interfaces: ['Node', 'Petco_FuzzyFriend', 'Bogucci'] }),
102
- Petco_Cat: createShape('Petco_Cat', {
103
- type: 'object',
104
- properties: {
105
- id: {
106
- type: 'string',
107
- '@tag': 'id',
108
- '@mapping': 'petco:Cat.id'
109
- },
110
- name: {
111
- type: 'string',
112
- '@mapping': 'petco:Cat.name'
113
- },
114
- lives: {
115
- type: 'integer',
116
- default: 9,
117
- '@mapping': 'petco:Cat.lives'
118
- }
119
- },
120
- required: ['name']
121
- }, { interfaces: ['Node', 'Petco_FuzzyFriend', 'Petco_Undead'] })
122
- }
123
- });
124
- describe('isInterfaceShape', () => {
125
- test('undefined', () => {
126
- expect(isInterfaceShape()).toBe(false);
127
- });
128
- test('an actual interface shape', () => {
129
- expect(isInterfaceShape(Node)).toBe(true);
130
- });
131
- });
132
- describe('isInterfaceRef', () => {
133
- const { Petco_Dog, Petco_SearchResponse } = petStoreSchema.shapes;
134
- test('no', () => {
135
- expect(isInterfaceRef(petStoreSchema, Petco_Dog.schema.properties.catPal)).toBe(false);
136
- });
137
- test('yes', () => {
138
- expect(isInterfaceRef(petStoreSchema, Petco_SearchResponse.schema.properties.results.items)).toBe(true);
139
- });
140
- });
141
- describe('getImplementationShapeNameMap', () => {
142
- test('it works', () => {
143
- const map = getImplementationShapeNameMap(petStoreSchema.shapes);
144
- expect(map).toEqual({
145
- Bogucci: new Set(['Petco_Dog']),
146
- Node: new Set(['Petco_Dog', 'Petco_Cat']),
147
- Petco_FuzzyFriend: new Set(['Petco_Dog', 'Petco_Cat']),
148
- Petco_Undead: new Set(['Petco_Cat'])
149
- });
150
- });
151
- });
152
- describe('getImplementationShapeMap', () => {
153
- test('it works', () => {
154
- const map = getImplementationShapeMap(petStoreSchema.shapes);
155
- const { Petco_Dog, Petco_Cat } = petStoreSchema.shapes;
156
- expect(map).toEqual({
157
- Bogucci: new Set([Petco_Dog]),
158
- Node: new Set([Petco_Dog, Petco_Cat]),
159
- Petco_FuzzyFriend: new Set([Petco_Dog, Petco_Cat]),
160
- Petco_Undead: new Set([Petco_Cat])
161
- });
162
- });
163
- });
164
- describe('pruneUnusedInterfaces', () => {
165
- test('it works', () => {
166
- const pruned = pruneUnusedInterfaces(petStoreSchema, petStoreSchema.shapes);
167
- expect(pruned.Petco_Dog.interfaces).toEqual(['Node', 'Petco_FuzzyFriend']);
168
- });
169
- test('handles interfaces being refs', () => {
170
- const pruned = pruneUnusedInterfaces(petStoreSchema, {
171
- ...petStoreSchema.shapes,
172
- Petco_Dog: {
173
- ...petStoreSchema.shapes.Petco_Dog,
174
- interfaces: ['local:Node', 'petco:FuzzyFriend', 'local:Bogucci']
175
- }
176
- });
177
- expect(pruned.Petco_Dog.interfaces).toEqual(['local:Node', 'petco:FuzzyFriend']);
178
- });
179
- });
180
- describe('getImplementingShapes', () => {
181
- test('it works', () => {
182
- const shapes = new Set(getImplementingShapes(petStoreSchema, {
183
- typeName: 'FuzzyFriend',
184
- serviceKey: 'petco',
185
- isForeign: true,
186
- isValidService: true
187
- }));
188
- const { Petco_Dog, Petco_Cat } = petStoreSchema.shapes;
189
- expect(shapes).toEqual(new Set([Petco_Dog, Petco_Cat]));
190
- });
191
- });
192
- describe('interfaceToUnion', () => {
193
- test('it works', () => {
194
- expect(interfaceToUnion(petStoreSchema, {
195
- typeName: 'FuzzyFriend',
196
- serviceKey: 'petco',
197
- isForeign: true,
198
- isValidService: true
199
- })).toEqual({
200
- oneOf: [{ '@ref': 'petco:Dog' }, { '@ref': 'petco:Cat' }]
201
- });
202
- });
203
- });
204
- describe('getPossibleShapeNames', () => {
205
- test('normal shape', () => {
206
- expect(getPossibleShapeNames(petStoreSchema, petStoreSchema.shapes.Petco_Cat)).toEqual(['Petco_Cat']);
207
- });
208
- test('union', () => {
209
- expect(getPossibleShapeNames(petStoreSchema, createShape('Woo', {
210
- oneOf: [{ '@ref': 'petco:Dog' }, { '@ref': 'petco:Cat' }]
211
- }))).toEqual(['Petco_Dog', 'Petco_Cat']);
212
- });
213
- test('interface', () => {
214
- expect(getPossibleShapeNames(petStoreSchema, petStoreSchema.shapes.Petco_FuzzyFriend)).toEqual([
215
- 'Petco_Dog',
216
- 'Petco_Cat'
217
- ]);
218
- });
219
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { expect, test } from 'vitest';
4
- import { ensureLatest } from "../project-schema/migrate.js";
5
- const examplesPath = path.join(__dirname, '../../examples');
6
- const readSchema = (filePath) => JSON.parse(fs.readFileSync(path.join(examplesPath, filePath), 'utf-8'));
7
- const migrationContext = {
8
- encryptFn() {
9
- return 'abc';
10
- },
11
- decryptFn() {
12
- return { token: 'xyz' };
13
- },
14
- async generateDataKeyFn() {
15
- return 'supersecret';
16
- }
17
- };
18
- test('ensureLatest - v1', async () => {
19
- const projectSchema = readSchema('source/shape-books.json');
20
- const projectSchemaLatest = readSchema('latest/shape-books.json');
21
- const actual = await ensureLatest(migrationContext, projectSchema);
22
- expect(actual).toEqual(projectSchemaLatest);
23
- });
24
- test('ensureLatest - v3', async () => {
25
- const projectSchemaV3 = readSchema('source/shopify-lookbook.json');
26
- const projectSchemaLatest = readSchema('latest/shopify-lookbook.json');
27
- const actual = await ensureLatest(migrationContext, projectSchemaV3);
28
- expect(actual).toEqual(projectSchemaLatest);
29
- });
30
- test('ensureLatest - pass-through', async () => {
31
- const projectSchemaLatest = readSchema('latest/shape-books.json');
32
- const actual = await ensureLatest(migrationContext, projectSchemaLatest);
33
- expect(actual).toBe(projectSchemaLatest);
34
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { createMockSchema, createMockSchemaWithDefaults } from "../mocks.js";
3
- import { ensureValidLatestSchemaSyntax } from "../validate/validate.js";
4
- describe('createMockSchema', () => {
5
- it('creates a schema that validates', () => {
6
- const projectId = 'project-id';
7
- const mockSchema = createMockSchema(projectId);
8
- const projectSchema = ensureValidLatestSchemaSyntax(mockSchema);
9
- expect(projectSchema).toEqual(mockSchema);
10
- expect(projectSchema.projectId).toEqual(projectId);
11
- });
12
- });
13
- describe('createMockSchemaWithDefaults', () => {
14
- it('creates a schema that validates', () => {
15
- const projectId = 'project-id';
16
- const mockSchema = createMockSchemaWithDefaults(projectId);
17
- const projectSchema = ensureValidLatestSchemaSyntax(mockSchema);
18
- expect(projectSchema).toEqual(mockSchema);
19
- expect(projectSchema.projectId).toEqual(projectId);
20
- expect(Object.keys(projectSchema.queries).length).toEqual(4);
21
- expect(Object.keys(projectSchema.mutations).length).toEqual(8);
22
- expect(Object.keys(projectSchema.shapes).length).toEqual(6);
23
- });
24
- });
@@ -1 +0,0 @@
1
- export {};