@atikk-co-jp/notion-mcp-server 0.7.0 → 0.8.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 (134) hide show
  1. package/README.ja.md +3 -2
  2. package/README.md +3 -2
  3. package/dist/src/converters/__tests__/block-to-markdown.test.js +482 -111
  4. package/dist/src/converters/__tests__/markdown-to-blocks.test.js +116 -13
  5. package/dist/src/converters/__tests__/page-to-markdown.test.js +83 -70
  6. package/dist/src/converters/__tests__/rich-text-to-markdown.test.js +23 -26
  7. package/dist/src/converters/block-to-markdown.d.ts +4 -13
  8. package/dist/src/converters/block-to-markdown.d.ts.map +1 -1
  9. package/dist/src/converters/block-to-markdown.js +117 -120
  10. package/dist/src/converters/index.d.ts +3 -3
  11. package/dist/src/converters/index.d.ts.map +1 -1
  12. package/dist/src/converters/index.js +1 -1
  13. package/dist/src/converters/markdown-to-blocks.d.ts +21 -7
  14. package/dist/src/converters/markdown-to-blocks.d.ts.map +1 -1
  15. package/dist/src/converters/markdown-to-blocks.js +56 -0
  16. package/dist/src/converters/page-to-markdown.d.ts +5 -20
  17. package/dist/src/converters/page-to-markdown.d.ts.map +1 -1
  18. package/dist/src/converters/page-to-markdown.js +47 -37
  19. package/dist/src/converters/rich-text-to-markdown.d.ts +3 -47
  20. package/dist/src/converters/rich-text-to-markdown.d.ts.map +1 -1
  21. package/dist/src/converters/rich-text-to-markdown.js +15 -14
  22. package/dist/src/notion-client.d.ts +5 -177
  23. package/dist/src/notion-client.d.ts.map +1 -1
  24. package/dist/src/notion-client.js +6 -172
  25. package/dist/src/schemas/descriptions/examples.d.ts +14 -0
  26. package/dist/src/schemas/descriptions/examples.d.ts.map +1 -0
  27. package/dist/src/schemas/descriptions/examples.js +87 -0
  28. package/dist/src/schemas/descriptions/fields.d.ts +146 -0
  29. package/dist/src/schemas/descriptions/fields.d.ts.map +1 -0
  30. package/dist/src/schemas/descriptions/fields.js +184 -0
  31. package/dist/src/schemas/descriptions/index.d.ts +3 -0
  32. package/dist/src/schemas/descriptions/index.d.ts.map +1 -0
  33. package/dist/src/schemas/descriptions/index.js +2 -0
  34. package/dist/src/schemas/index.d.ts +1 -5
  35. package/dist/src/schemas/index.d.ts.map +1 -1
  36. package/dist/src/schemas/index.js +2 -10
  37. package/dist/src/tools/__tests__/context-size.test.d.ts +2 -0
  38. package/dist/src/tools/__tests__/context-size.test.d.ts.map +1 -0
  39. package/dist/src/tools/__tests__/context-size.test.js +143 -0
  40. package/dist/src/tools/__tests__/error-handler.test.d.ts +2 -0
  41. package/dist/src/tools/__tests__/error-handler.test.d.ts.map +1 -0
  42. package/dist/src/tools/__tests__/error-handler.test.js +125 -0
  43. package/dist/src/tools/append-block-children.d.ts.map +1 -1
  44. package/dist/src/tools/append-block-children.js +8 -5
  45. package/dist/src/tools/append-blocks-simple.d.ts.map +1 -1
  46. package/dist/src/tools/append-blocks-simple.js +9 -13
  47. package/dist/src/tools/archive-database.d.ts.map +1 -1
  48. package/dist/src/tools/archive-database.js +3 -2
  49. package/dist/src/tools/archive-page.d.ts.map +1 -1
  50. package/dist/src/tools/archive-page.js +2 -1
  51. package/dist/src/tools/create-comment-simple.d.ts.map +1 -1
  52. package/dist/src/tools/create-comment-simple.js +5 -4
  53. package/dist/src/tools/create-comment.d.ts.map +1 -1
  54. package/dist/src/tools/create-comment.js +9 -6
  55. package/dist/src/tools/create-database.d.ts.map +1 -1
  56. package/dist/src/tools/create-database.js +19 -25
  57. package/dist/src/tools/create-page-simple.d.ts +1 -1
  58. package/dist/src/tools/create-page-simple.d.ts.map +1 -1
  59. package/dist/src/tools/create-page-simple.js +26 -27
  60. package/dist/src/tools/create-page.d.ts.map +1 -1
  61. package/dist/src/tools/create-page.js +10 -6
  62. package/dist/src/tools/delete-block.d.ts.map +1 -1
  63. package/dist/src/tools/delete-block.js +2 -1
  64. package/dist/src/tools/get-block-children.d.ts +1 -1
  65. package/dist/src/tools/get-block-children.d.ts.map +1 -1
  66. package/dist/src/tools/get-block-children.js +13 -27
  67. package/dist/src/tools/index.d.ts +2 -2
  68. package/dist/src/tools/index.d.ts.map +1 -1
  69. package/dist/src/tools/index.js +2 -2
  70. package/dist/src/tools/list-comments.d.ts +1 -1
  71. package/dist/src/tools/list-comments.d.ts.map +1 -1
  72. package/dist/src/tools/list-comments.js +11 -10
  73. package/dist/src/tools/list-users.d.ts.map +1 -1
  74. package/dist/src/tools/list-users.js +4 -3
  75. package/dist/src/tools/move-page.d.ts.map +1 -1
  76. package/dist/src/tools/move-page.js +5 -4
  77. package/dist/src/tools/query-data-source.d.ts +1 -1
  78. package/dist/src/tools/query-data-source.d.ts.map +1 -1
  79. package/dist/src/tools/query-data-source.js +23 -30
  80. package/dist/src/tools/retrieve-block.d.ts +1 -1
  81. package/dist/src/tools/retrieve-block.d.ts.map +1 -1
  82. package/dist/src/tools/retrieve-block.js +13 -10
  83. package/dist/src/tools/retrieve-bot-user.js +1 -1
  84. package/dist/src/tools/retrieve-data-source.d.ts +1 -1
  85. package/dist/src/tools/retrieve-data-source.d.ts.map +1 -1
  86. package/dist/src/tools/retrieve-data-source.js +15 -11
  87. package/dist/src/tools/retrieve-database.d.ts +1 -1
  88. package/dist/src/tools/retrieve-database.d.ts.map +1 -1
  89. package/dist/src/tools/retrieve-database.js +11 -6
  90. package/dist/src/tools/retrieve-page-property.d.ts.map +1 -1
  91. package/dist/src/tools/retrieve-page-property.js +6 -5
  92. package/dist/src/tools/retrieve-page.d.ts +1 -1
  93. package/dist/src/tools/retrieve-page.d.ts.map +1 -1
  94. package/dist/src/tools/retrieve-page.js +15 -20
  95. package/dist/src/tools/retrieve-user.d.ts.map +1 -1
  96. package/dist/src/tools/retrieve-user.js +2 -1
  97. package/dist/src/tools/search.d.ts.map +1 -1
  98. package/dist/src/tools/search.js +10 -17
  99. package/dist/src/tools/update-block-simple.d.ts +1 -1
  100. package/dist/src/tools/update-block-simple.d.ts.map +1 -1
  101. package/dist/src/tools/update-block-simple.js +14 -4
  102. package/dist/src/tools/update-block.d.ts.map +1 -1
  103. package/dist/src/tools/update-block.js +8 -5
  104. package/dist/src/tools/update-data-source.d.ts.map +1 -1
  105. package/dist/src/tools/update-data-source.js +7 -7
  106. package/dist/src/tools/update-database.d.ts.map +1 -1
  107. package/dist/src/tools/update-database.js +22 -32
  108. package/dist/src/tools/update-page.d.ts.map +1 -1
  109. package/dist/src/tools/update-page.js +11 -8
  110. package/dist/src/utils/error-handler.d.ts +16 -7
  111. package/dist/src/utils/error-handler.d.ts.map +1 -1
  112. package/dist/src/utils/error-handler.js +44 -17
  113. package/dist/src/utils/index.d.ts +1 -1
  114. package/dist/src/utils/index.d.ts.map +1 -1
  115. package/dist/src/utils/index.js +1 -1
  116. package/package.json +2 -1
  117. package/dist/src/schemas/block.d.ts +0 -3787
  118. package/dist/src/schemas/block.d.ts.map +0 -1
  119. package/dist/src/schemas/block.js +0 -402
  120. package/dist/src/schemas/common.d.ts +0 -638
  121. package/dist/src/schemas/common.d.ts.map +0 -1
  122. package/dist/src/schemas/common.js +0 -163
  123. package/dist/src/schemas/database.d.ts +0 -687
  124. package/dist/src/schemas/database.d.ts.map +0 -1
  125. package/dist/src/schemas/database.js +0 -258
  126. package/dist/src/schemas/filter.d.ts +0 -611
  127. package/dist/src/schemas/filter.d.ts.map +0 -1
  128. package/dist/src/schemas/filter.js +0 -222
  129. package/dist/src/schemas/page.d.ts +0 -2607
  130. package/dist/src/schemas/page.d.ts.map +0 -1
  131. package/dist/src/schemas/page.js +0 -328
  132. package/dist/src/schemas/schemas.test.d.ts +0 -2
  133. package/dist/src/schemas/schemas.test.d.ts.map +0 -1
  134. package/dist/src/schemas/schemas.test.js +0 -418
@@ -1,38 +1,51 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { pagePropertiesToObject, pagePropertiesToSimple, pagesToSimple, pageToSimple, } from '../page-to-markdown.js';
3
+ /**
4
+ * テスト用のプロパティをPageObjectResponse['properties']にキャストするヘルパー
5
+ * SDK型は多くの必須フィールドを要求するため、テストでは最小限のデータでキャスト
6
+ */
7
+ const asProperties = (props) => props;
8
+ /**
9
+ * テスト用のページをPageObjectResponseにキャストするヘルパー
10
+ */
11
+ const asPage = (page) => page;
12
+ /**
13
+ * テスト用のページ配列をPageObjectResponse[]にキャストするヘルパー
14
+ */
15
+ const asPages = (pages) => pages;
3
16
  describe('pagePropertiesToObject', () => {
4
17
  describe('text properties', () => {
5
18
  it('converts title property', () => {
6
- const properties = {
19
+ const properties = asProperties({
7
20
  Name: {
8
21
  type: 'title',
9
22
  title: [{ type: 'text', text: { content: 'My Page' }, plain_text: 'My Page' }],
10
23
  },
11
- };
24
+ });
12
25
  expect(pagePropertiesToObject(properties)).toEqual({
13
26
  Name: 'My Page',
14
27
  });
15
28
  });
16
29
  it('converts rich_text property', () => {
17
- const properties = {
30
+ const properties = asProperties({
18
31
  Description: {
19
32
  type: 'rich_text',
20
33
  rich_text: [
21
34
  { type: 'text', text: { content: 'Some description' }, plain_text: 'Some description' },
22
35
  ],
23
36
  },
24
- };
37
+ });
25
38
  expect(pagePropertiesToObject(properties)).toEqual({
26
39
  Description: 'Some description',
27
40
  });
28
41
  });
29
42
  it('handles empty rich_text', () => {
30
- const properties = {
43
+ const properties = asProperties({
31
44
  Description: {
32
45
  type: 'rich_text',
33
46
  rich_text: [],
34
47
  },
35
- };
48
+ });
36
49
  expect(pagePropertiesToObject(properties)).toEqual({
37
50
  Description: '',
38
51
  });
@@ -40,23 +53,23 @@ describe('pagePropertiesToObject', () => {
40
53
  });
41
54
  describe('number property', () => {
42
55
  it('converts number property', () => {
43
- const properties = {
56
+ const properties = asProperties({
44
57
  Count: {
45
58
  type: 'number',
46
59
  number: 42,
47
60
  },
48
- };
61
+ });
49
62
  expect(pagePropertiesToObject(properties)).toEqual({
50
63
  Count: 42,
51
64
  });
52
65
  });
53
66
  it('handles null number', () => {
54
- const properties = {
67
+ const properties = asProperties({
55
68
  Count: {
56
69
  type: 'number',
57
70
  number: null,
58
71
  },
59
- };
72
+ });
60
73
  expect(pagePropertiesToObject(properties)).toEqual({
61
74
  Count: null,
62
75
  });
@@ -64,29 +77,29 @@ describe('pagePropertiesToObject', () => {
64
77
  });
65
78
  describe('select properties', () => {
66
79
  it('converts select property', () => {
67
- const properties = {
80
+ const properties = asProperties({
68
81
  Status: {
69
82
  type: 'select',
70
83
  select: { id: '123', name: 'Done', color: 'green' },
71
84
  },
72
- };
85
+ });
73
86
  expect(pagePropertiesToObject(properties)).toEqual({
74
87
  Status: 'Done',
75
88
  });
76
89
  });
77
90
  it('handles null select', () => {
78
- const properties = {
91
+ const properties = asProperties({
79
92
  Status: {
80
93
  type: 'select',
81
94
  select: null,
82
95
  },
83
- };
96
+ });
84
97
  expect(pagePropertiesToObject(properties)).toEqual({
85
98
  Status: null,
86
99
  });
87
100
  });
88
101
  it('converts multi_select property', () => {
89
- const properties = {
102
+ const properties = asProperties({
90
103
  Tags: {
91
104
  type: 'multi_select',
92
105
  multi_select: [
@@ -94,29 +107,29 @@ describe('pagePropertiesToObject', () => {
94
107
  { id: '2', name: 'Feature', color: 'green' },
95
108
  ],
96
109
  },
97
- };
110
+ });
98
111
  expect(pagePropertiesToObject(properties)).toEqual({
99
112
  Tags: ['Bug', 'Feature'],
100
113
  });
101
114
  });
102
115
  it('handles empty multi_select', () => {
103
- const properties = {
116
+ const properties = asProperties({
104
117
  Tags: {
105
118
  type: 'multi_select',
106
119
  multi_select: [],
107
120
  },
108
- };
121
+ });
109
122
  expect(pagePropertiesToObject(properties)).toEqual({
110
123
  Tags: [],
111
124
  });
112
125
  });
113
126
  it('converts status property', () => {
114
- const properties = {
127
+ const properties = asProperties({
115
128
  Progress: {
116
129
  type: 'status',
117
130
  status: { id: '123', name: 'In Progress', color: 'blue' },
118
131
  },
119
- };
132
+ });
120
133
  expect(pagePropertiesToObject(properties)).toEqual({
121
134
  Progress: 'In Progress',
122
135
  });
@@ -124,34 +137,34 @@ describe('pagePropertiesToObject', () => {
124
137
  });
125
138
  describe('date property', () => {
126
139
  it('converts date property with start only', () => {
127
- const properties = {
140
+ const properties = asProperties({
128
141
  DueDate: {
129
142
  type: 'date',
130
143
  date: { start: '2024-01-15' },
131
144
  },
132
- };
145
+ });
133
146
  expect(pagePropertiesToObject(properties)).toEqual({
134
147
  DueDate: '2024-01-15',
135
148
  });
136
149
  });
137
150
  it('converts date property with start and end', () => {
138
- const properties = {
151
+ const properties = asProperties({
139
152
  Period: {
140
153
  type: 'date',
141
154
  date: { start: '2024-01-01', end: '2024-01-31' },
142
155
  },
143
- };
156
+ });
144
157
  expect(pagePropertiesToObject(properties)).toEqual({
145
158
  Period: '2024-01-01 → 2024-01-31',
146
159
  });
147
160
  });
148
161
  it('handles null date', () => {
149
- const properties = {
162
+ const properties = asProperties({
150
163
  DueDate: {
151
164
  type: 'date',
152
165
  date: null,
153
166
  },
154
- };
167
+ });
155
168
  expect(pagePropertiesToObject(properties)).toEqual({
156
169
  DueDate: null,
157
170
  });
@@ -159,23 +172,23 @@ describe('pagePropertiesToObject', () => {
159
172
  });
160
173
  describe('checkbox property', () => {
161
174
  it('converts checkbox true', () => {
162
- const properties = {
175
+ const properties = asProperties({
163
176
  Completed: {
164
177
  type: 'checkbox',
165
178
  checkbox: true,
166
179
  },
167
- };
180
+ });
168
181
  expect(pagePropertiesToObject(properties)).toEqual({
169
182
  Completed: true,
170
183
  });
171
184
  });
172
185
  it('converts checkbox false', () => {
173
- const properties = {
186
+ const properties = asProperties({
174
187
  Completed: {
175
188
  type: 'checkbox',
176
189
  checkbox: false,
177
190
  },
178
- };
191
+ });
179
192
  expect(pagePropertiesToObject(properties)).toEqual({
180
193
  Completed: false,
181
194
  });
@@ -183,34 +196,34 @@ describe('pagePropertiesToObject', () => {
183
196
  });
184
197
  describe('url/email/phone properties', () => {
185
198
  it('converts url property', () => {
186
- const properties = {
199
+ const properties = asProperties({
187
200
  Website: {
188
201
  type: 'url',
189
202
  url: 'https://example.com',
190
203
  },
191
- };
204
+ });
192
205
  expect(pagePropertiesToObject(properties)).toEqual({
193
206
  Website: 'https://example.com',
194
207
  });
195
208
  });
196
209
  it('converts email property', () => {
197
- const properties = {
210
+ const properties = asProperties({
198
211
  Email: {
199
212
  type: 'email',
200
213
  email: 'test@example.com',
201
214
  },
202
- };
215
+ });
203
216
  expect(pagePropertiesToObject(properties)).toEqual({
204
217
  Email: 'test@example.com',
205
218
  });
206
219
  });
207
220
  it('converts phone_number property', () => {
208
- const properties = {
221
+ const properties = asProperties({
209
222
  Phone: {
210
223
  type: 'phone_number',
211
224
  phone_number: '+1-234-567-8900',
212
225
  },
213
- };
226
+ });
214
227
  expect(pagePropertiesToObject(properties)).toEqual({
215
228
  Phone: '+1-234-567-8900',
216
229
  });
@@ -218,23 +231,23 @@ describe('pagePropertiesToObject', () => {
218
231
  });
219
232
  describe('relation property', () => {
220
233
  it('converts relation property', () => {
221
- const properties = {
234
+ const properties = asProperties({
222
235
  Related: {
223
236
  type: 'relation',
224
237
  relation: [{ id: 'page-1' }, { id: 'page-2' }],
225
238
  },
226
- };
239
+ });
227
240
  expect(pagePropertiesToObject(properties)).toEqual({
228
241
  Related: ['page-1', 'page-2'],
229
242
  });
230
243
  });
231
244
  it('handles empty relation', () => {
232
- const properties = {
245
+ const properties = asProperties({
233
246
  Related: {
234
247
  type: 'relation',
235
248
  relation: [],
236
249
  },
237
- };
250
+ });
238
251
  expect(pagePropertiesToObject(properties)).toEqual({
239
252
  Related: [],
240
253
  });
@@ -242,7 +255,7 @@ describe('pagePropertiesToObject', () => {
242
255
  });
243
256
  describe('people property', () => {
244
257
  it('converts people property with names', () => {
245
- const properties = {
258
+ const properties = asProperties({
246
259
  Assignees: {
247
260
  type: 'people',
248
261
  people: [
@@ -250,18 +263,18 @@ describe('pagePropertiesToObject', () => {
250
263
  { id: 'user-2', name: 'Jane' },
251
264
  ],
252
265
  },
253
- };
266
+ });
254
267
  expect(pagePropertiesToObject(properties)).toEqual({
255
268
  Assignees: ['John', 'Jane'],
256
269
  });
257
270
  });
258
271
  it('converts people property without names (uses id)', () => {
259
- const properties = {
272
+ const properties = asProperties({
260
273
  Assignees: {
261
274
  type: 'people',
262
275
  people: [{ id: 'user-1' }, { id: 'user-2' }],
263
276
  },
264
- };
277
+ });
265
278
  expect(pagePropertiesToObject(properties)).toEqual({
266
279
  Assignees: ['user-1', 'user-2'],
267
280
  });
@@ -269,7 +282,7 @@ describe('pagePropertiesToObject', () => {
269
282
  });
270
283
  describe('files property', () => {
271
284
  it('converts files property with names', () => {
272
- const properties = {
285
+ const properties = asProperties({
273
286
  Attachments: {
274
287
  type: 'files',
275
288
  files: [
@@ -277,7 +290,7 @@ describe('pagePropertiesToObject', () => {
277
290
  { name: 'image.png', file: { url: 'https://s3.amazonaws.com/image.png' } },
278
291
  ],
279
292
  },
280
- };
293
+ });
281
294
  expect(pagePropertiesToObject(properties)).toEqual({
282
295
  Attachments: ['doc.pdf', 'image.png'],
283
296
  });
@@ -285,23 +298,23 @@ describe('pagePropertiesToObject', () => {
285
298
  });
286
299
  describe('time properties', () => {
287
300
  it('converts created_time property', () => {
288
- const properties = {
301
+ const properties = asProperties({
289
302
  Created: {
290
303
  type: 'created_time',
291
304
  created_time: '2024-01-15T10:00:00.000Z',
292
305
  },
293
- };
306
+ });
294
307
  expect(pagePropertiesToObject(properties)).toEqual({
295
308
  Created: '2024-01-15T10:00:00.000Z',
296
309
  });
297
310
  });
298
311
  it('converts last_edited_time property', () => {
299
- const properties = {
312
+ const properties = asProperties({
300
313
  Updated: {
301
314
  type: 'last_edited_time',
302
315
  last_edited_time: '2024-01-15T10:00:00.000Z',
303
316
  },
304
- };
317
+ });
305
318
  expect(pagePropertiesToObject(properties)).toEqual({
306
319
  Updated: '2024-01-15T10:00:00.000Z',
307
320
  });
@@ -309,34 +322,34 @@ describe('pagePropertiesToObject', () => {
309
322
  });
310
323
  describe('formula property', () => {
311
324
  it('converts formula string result', () => {
312
- const properties = {
325
+ const properties = asProperties({
313
326
  Formula: {
314
327
  type: 'formula',
315
328
  formula: { type: 'string', string: 'result' },
316
329
  },
317
- };
330
+ });
318
331
  expect(pagePropertiesToObject(properties)).toEqual({
319
332
  Formula: 'result',
320
333
  });
321
334
  });
322
335
  it('converts formula number result', () => {
323
- const properties = {
336
+ const properties = asProperties({
324
337
  Formula: {
325
338
  type: 'formula',
326
339
  formula: { type: 'number', number: 100 },
327
340
  },
328
- };
341
+ });
329
342
  expect(pagePropertiesToObject(properties)).toEqual({
330
343
  Formula: 100,
331
344
  });
332
345
  });
333
346
  it('converts formula boolean result', () => {
334
- const properties = {
347
+ const properties = asProperties({
335
348
  Formula: {
336
349
  type: 'formula',
337
350
  formula: { type: 'boolean', boolean: true },
338
351
  },
339
- };
352
+ });
340
353
  expect(pagePropertiesToObject(properties)).toEqual({
341
354
  Formula: true,
342
355
  });
@@ -344,23 +357,23 @@ describe('pagePropertiesToObject', () => {
344
357
  });
345
358
  describe('unique_id property', () => {
346
359
  it('converts unique_id with prefix', () => {
347
- const properties = {
360
+ const properties = asProperties({
348
361
  ID: {
349
362
  type: 'unique_id',
350
363
  unique_id: { prefix: 'TASK', number: 123 },
351
364
  },
352
- };
365
+ });
353
366
  expect(pagePropertiesToObject(properties)).toEqual({
354
367
  ID: 'TASK-123',
355
368
  });
356
369
  });
357
370
  it('converts unique_id without prefix', () => {
358
- const properties = {
371
+ const properties = asProperties({
359
372
  ID: {
360
373
  type: 'unique_id',
361
374
  unique_id: { number: 456 },
362
375
  },
363
- };
376
+ });
364
377
  expect(pagePropertiesToObject(properties)).toEqual({
365
378
  ID: '456',
366
379
  });
@@ -377,7 +390,7 @@ describe('pagePropertiesToObject', () => {
377
390
  });
378
391
  describe('pagePropertiesToSimple', () => {
379
392
  it('returns array with name, type, and value', () => {
380
- const properties = {
393
+ const properties = asProperties({
381
394
  Name: {
382
395
  type: 'title',
383
396
  title: [{ type: 'text', text: { content: 'Test' }, plain_text: 'Test' }],
@@ -386,7 +399,7 @@ describe('pagePropertiesToSimple', () => {
386
399
  type: 'select',
387
400
  select: { id: '1', name: 'Done', color: 'green' },
388
401
  },
389
- };
402
+ });
390
403
  const result = pagePropertiesToSimple(properties);
391
404
  expect(result).toHaveLength(2);
392
405
  expect(result).toContainEqual({ name: 'Name', type: 'title', value: 'Test' });
@@ -395,7 +408,7 @@ describe('pagePropertiesToSimple', () => {
395
408
  });
396
409
  describe('pageToSimple', () => {
397
410
  it('converts page object to simple format', () => {
398
- const page = {
411
+ const page = asPage({
399
412
  id: 'page-123',
400
413
  url: 'https://notion.so/page-123',
401
414
  properties: {
@@ -408,7 +421,7 @@ describe('pageToSimple', () => {
408
421
  select: { id: '1', name: 'Active', color: 'green' },
409
422
  },
410
423
  },
411
- };
424
+ });
412
425
  const result = pageToSimple(page);
413
426
  expect(result).toEqual({
414
427
  id: 'page-123',
@@ -420,7 +433,7 @@ describe('pageToSimple', () => {
420
433
  });
421
434
  });
422
435
  it('handles missing url', () => {
423
- const page = {
436
+ const page = asPage({
424
437
  id: 'page-123',
425
438
  properties: {
426
439
  Name: {
@@ -428,14 +441,14 @@ describe('pageToSimple', () => {
428
441
  title: [{ type: 'text', text: { content: 'Test' }, plain_text: 'Test' }],
429
442
  },
430
443
  },
431
- };
444
+ });
432
445
  const result = pageToSimple(page);
433
446
  expect(result.url).toBe('');
434
447
  });
435
448
  });
436
449
  describe('pagesToSimple', () => {
437
450
  it('converts array of pages to simple format', () => {
438
- const pages = [
451
+ const pages = asPages([
439
452
  {
440
453
  id: 'page-1',
441
454
  url: 'https://notion.so/page-1',
@@ -456,7 +469,7 @@ describe('pagesToSimple', () => {
456
469
  },
457
470
  },
458
471
  },
459
- ];
472
+ ]);
460
473
  const result = pagesToSimple(pages);
461
474
  expect(result).toHaveLength(2);
462
475
  expect(result[0]).toEqual({
@@ -480,7 +493,7 @@ describe('pagesToSimple', () => {
480
493
  describe('real world data', () => {
481
494
  it('converts actual Notion page properties', () => {
482
495
  // 実際のNotionから取得したデータ形式
483
- const properties = {
496
+ const properties = asProperties({
484
497
  依存チケット: {
485
498
  id: '%3AF_%7C',
486
499
  type: 'relation',
@@ -550,7 +563,7 @@ describe('real world data', () => {
550
563
  },
551
564
  ],
552
565
  },
553
- };
566
+ });
554
567
  const result = pagePropertiesToObject(properties);
555
568
  expect(result).toEqual({
556
569
  依存チケット: ['2dea79a9-39bc-81ee-9871-da4f2ffc8ae8'],