|
1 | 1 | import { expect, test } from 'bun:test';
|
2 | 2 | import { validateRequest, ValidationError } from './gitbook.validate';
|
3 | 3 |
|
4 |
| -test('POST /spaces/1234/hive/token', () => { |
5 |
| - const result = validateRequest({ |
6 |
| - path: '/spaces/1234/hive/token', |
7 |
| - method: 'post', |
8 |
| - headers: { |
9 |
| - 'content-type': 'application/json', |
10 |
| - }, |
11 |
| - query: {}, |
12 |
| - }); |
13 |
| - expect(result).toMatchObject({ |
14 |
| - headers: { |
15 |
| - 'content-type': 'application/json', |
16 |
| - }, |
17 |
| - method: 'post', |
18 |
| - operationId: 'generateSpaceHiveReadAccessToken', |
19 |
| - params: { |
20 |
| - spaceId: '1234', |
21 |
| - }, |
22 |
| - path: '/spaces/1234/hive/token', |
23 |
| - query: {}, |
24 |
| - }); |
25 |
| -}); |
26 |
| - |
27 | 4 | test('POST orgs/appleId/custom-fields', () => {
|
28 | 5 | const result = validateRequest({
|
29 | 6 | path: '/orgs/appleId/custom-fields',
|
@@ -114,70 +91,6 @@ test('POST orgs/appleId/custom-fields', () => {
|
114 | 91 | });
|
115 | 92 | });
|
116 | 93 |
|
117 |
| -test('PUT orgs/apple/schemas/newType', () => { |
118 |
| - const result = validateRequest({ |
119 |
| - path: '/orgs/apple/schemas/newType', |
120 |
| - method: 'put', |
121 |
| - headers: { |
122 |
| - 'content-type': 'application/json', |
123 |
| - }, |
124 |
| - query: {}, |
125 |
| - body: { |
126 |
| - type: 'newType', |
127 |
| - title: { |
128 |
| - singular: 'New type', |
129 |
| - plural: 'New types', |
130 |
| - }, |
131 |
| - properties: [ |
132 |
| - { |
133 |
| - name: 'title', |
134 |
| - type: 'text', |
135 |
| - title: 'Title', |
136 |
| - }, |
137 |
| - ], |
138 |
| - }, |
139 |
| - }); |
140 |
| - expect(result).toMatchObject({ |
141 |
| - operationId: 'setEntitySchema', |
142 |
| - params: { |
143 |
| - organizationId: 'apple', |
144 |
| - entityType: 'newType', |
145 |
| - }, |
146 |
| - }); |
147 |
| -}); |
148 |
| - |
149 |
| -test('PUT orgs/apple/schemas/newType/entities', () => { |
150 |
| - const result = validateRequest({ |
151 |
| - path: '/orgs/apple/schemas/newType/entities', |
152 |
| - method: 'put', |
153 |
| - headers: { |
154 |
| - 'content-type': 'application/json', |
155 |
| - }, |
156 |
| - query: {}, |
157 |
| - body: { |
158 |
| - entities: [ |
159 |
| - { |
160 |
| - entityId: 'something', |
161 |
| - properties: { |
162 |
| - title: 'Updated lambda', |
163 |
| - description: 'the description', |
164 |
| - url: 'https://example.com', |
165 |
| - public_traffic: false, |
166 |
| - created_on: '2020-01-01T00:00:00.000Z', |
167 |
| - }, |
168 |
| - }, |
169 |
| - ], |
170 |
| - }, |
171 |
| - }); |
172 |
| - expect(result).toMatchObject({ |
173 |
| - operationId: 'upsertSchemaEntities', |
174 |
| - params: { |
175 |
| - organizationId: 'apple', |
176 |
| - entityType: 'newType', |
177 |
| - }, |
178 |
| - }); |
179 |
| -}); |
180 |
| - |
181 | 94 | test('POST orgs/apple/members/jony (invalid)', () => {
|
182 | 95 | const result = validateRequest({
|
183 | 96 | path: '/orgs/apple/members/jony',
|
@@ -327,7 +240,7 @@ test('GET spaces/space_iphone-doc/revisions/somerevision/files?limit=1000 (inval
|
327 | 240 | 'content-type': 'application/json',
|
328 | 241 | },
|
329 | 242 | query: {
|
330 |
| - limit: '1000', |
| 243 | + limit: '10000', |
331 | 244 | },
|
332 | 245 | });
|
333 | 246 | expect(result instanceof ValidationError ? result.path : null).toEqual(['query', 'limit']);
|
@@ -358,6 +271,5 @@ test('GET orgs/xxx/synced-blocks?ids=foo parsed as array', () => {
|
358 | 271 | ids: 'foo',
|
359 | 272 | },
|
360 | 273 | });
|
361 |
| - console.log(result); |
362 | 274 | expect(result.query).toEqual({ ids: ['foo'] });
|
363 | 275 | });
|
0 commit comments