@luzzle/core 0.0.60 → 0.0.63
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.
- package/README.md +38 -8
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/pieces/Piece.js +2 -2
- package/dist/src/pieces/Piece.js.map +1 -1
- package/dist/src/pieces/index.d.ts +1 -0
- package/dist/src/pieces/index.js +1 -0
- package/dist/src/pieces/index.js.map +1 -1
- package/dist/src/pieces/utils/piece.d.ts +3 -2
- package/dist/src/pieces/utils/piece.js +17 -14
- package/dist/src/pieces/utils/piece.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +12 -11
- package/dist/src/database/NodeSqliteDialect.test.d.ts +0 -1
- package/dist/src/database/NodeSqliteDialect.test.js +0 -104
- package/dist/src/database/NodeSqliteDialect.test.js.map +0 -1
- package/dist/src/database/client.test.d.ts +0 -1
- package/dist/src/database/client.test.js +0 -36
- package/dist/src/database/client.test.js.map +0 -1
- package/dist/src/database/migrations.test.d.ts +0 -1
- package/dist/src/database/migrations.test.js +0 -19
- package/dist/src/database/migrations.test.js.map +0 -1
- package/dist/src/database/utils.test.d.ts +0 -1
- package/dist/src/database/utils.test.js +0 -9
- package/dist/src/database/utils.test.js.map +0 -1
- package/dist/src/index.test.d.ts +0 -1
- package/dist/src/index.test.js +0 -9
- package/dist/src/index.test.js.map +0 -1
- package/dist/src/lib/ajv.test.d.ts +0 -1
- package/dist/src/lib/ajv.test.js +0 -49
- package/dist/src/lib/ajv.test.js.map +0 -1
- package/dist/src/lib/frontmatter.test.d.ts +0 -1
- package/dist/src/lib/frontmatter.test.js +0 -37
- package/dist/src/lib/frontmatter.test.js.map +0 -1
- package/dist/src/lib/markdown.test.d.ts +0 -1
- package/dist/src/lib/markdown.test.js +0 -34
- package/dist/src/lib/markdown.test.js.map +0 -1
- package/dist/src/llm/google.test.d.ts +0 -1
- package/dist/src/llm/google.test.js +0 -253
- package/dist/src/llm/google.test.js.map +0 -1
- package/dist/src/pieces/Piece.test.d.ts +0 -1
- package/dist/src/pieces/Piece.test.js +0 -628
- package/dist/src/pieces/Piece.test.js.map +0 -1
- package/dist/src/pieces/Pieces.test.d.ts +0 -1
- package/dist/src/pieces/Pieces.test.js +0 -325
- package/dist/src/pieces/Pieces.test.js.map +0 -1
- package/dist/src/pieces/cache.test.d.ts +0 -1
- package/dist/src/pieces/cache.test.js +0 -72
- package/dist/src/pieces/cache.test.js.map +0 -1
- package/dist/src/pieces/item.test.d.ts +0 -1
- package/dist/src/pieces/item.test.js +0 -243
- package/dist/src/pieces/item.test.js.map +0 -1
- package/dist/src/pieces/items.test.d.ts +0 -1
- package/dist/src/pieces/items.test.js +0 -103
- package/dist/src/pieces/items.test.js.map +0 -1
- package/dist/src/pieces/json.schema.test.d.ts +0 -1
- package/dist/src/pieces/json.schema.test.js +0 -27
- package/dist/src/pieces/json.schema.test.js.map +0 -1
- package/dist/src/pieces/manager.test.d.ts +0 -1
- package/dist/src/pieces/manager.test.js +0 -55
- package/dist/src/pieces/manager.test.js.map +0 -1
- package/dist/src/pieces/utils/frontmatter.path.test.d.ts +0 -1
- package/dist/src/pieces/utils/frontmatter.path.test.js +0 -319
- package/dist/src/pieces/utils/frontmatter.path.test.js.map +0 -1
- package/dist/src/pieces/utils/frontmatter.test.d.ts +0 -1
- package/dist/src/pieces/utils/frontmatter.test.js +0 -335
- package/dist/src/pieces/utils/frontmatter.test.js.map +0 -1
- package/dist/src/pieces/utils/markdown.test.d.ts +0 -1
- package/dist/src/pieces/utils/markdown.test.js +0 -38
- package/dist/src/pieces/utils/markdown.test.js.map +0 -1
- package/dist/src/pieces/utils/piece.test.d.ts +0 -1
- package/dist/src/pieces/utils/piece.test.js +0 -348
- package/dist/src/pieces/utils/piece.test.js.map +0 -1
- package/dist/src/storage/fs.test.d.ts +0 -1
- package/dist/src/storage/fs.test.js +0 -212
- package/dist/src/storage/fs.test.js.map +0 -1
- package/dist/test/db.d.ts +0 -3
- package/dist/test/db.js +0 -19
- package/dist/test/db.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test, vi, afterEach } from 'vitest';
|
|
2
|
-
import * as frontmatter from './frontmatter.js';
|
|
3
|
-
import { makeSchema } from '../Piece.fixtures.js';
|
|
4
|
-
describe('pieces/utils/frontmatter.ts', () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
vi.resetAllMocks();
|
|
7
|
-
});
|
|
8
|
-
describe('getPieceFrontmatterSchemaFields', () => {
|
|
9
|
-
test('handles basic scalar fields', () => {
|
|
10
|
-
const schema = makeSchema({
|
|
11
|
-
field: { type: 'string' },
|
|
12
|
-
field2: {
|
|
13
|
-
type: 'string',
|
|
14
|
-
nullable: true,
|
|
15
|
-
format: 'date',
|
|
16
|
-
pattern: 'pattern',
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
schema.required = undefined;
|
|
20
|
-
const fields = frontmatter.getPieceFrontmatterSchemaFields(schema);
|
|
21
|
-
expect(fields).toContainEqual({ name: 'field', type: 'string', nullable: true });
|
|
22
|
-
expect(fields).toContainEqual({
|
|
23
|
-
name: 'field2',
|
|
24
|
-
type: 'string',
|
|
25
|
-
format: 'date',
|
|
26
|
-
pattern: 'pattern',
|
|
27
|
-
nullable: true,
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
test('handles required and nullable fields', () => {
|
|
31
|
-
const schema = makeSchema({
|
|
32
|
-
requiredField: { type: 'string' },
|
|
33
|
-
optionalField: { type: 'string', nullable: true },
|
|
34
|
-
defaultOptional: { type: 'string' },
|
|
35
|
-
});
|
|
36
|
-
schema.required = ['requiredField'];
|
|
37
|
-
const fields = frontmatter.getPieceFrontmatterSchemaFields(schema);
|
|
38
|
-
const requiredField = fields.find((f) => f.name === 'requiredField');
|
|
39
|
-
const optionalField = fields.find((f) => f.name === 'optionalField');
|
|
40
|
-
const defaultOptional = fields.find((f) => f.name === 'defaultOptional');
|
|
41
|
-
expect(optionalField?.nullable).toBe(true);
|
|
42
|
-
expect(requiredField?.nullable).toBe(false);
|
|
43
|
-
expect(defaultOptional?.nullable).toBe(true);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
describe('pieceFrontmatterValueToDatabaseValue', () => {
|
|
47
|
-
test('converts basic scalars', () => {
|
|
48
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue('2021-01-01', {
|
|
49
|
-
format: 'date',
|
|
50
|
-
type: 'string',
|
|
51
|
-
})).toBeTypeOf('number');
|
|
52
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue(true, { type: 'boolean' })).toBe(1);
|
|
53
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue(false, { type: 'boolean' })).toBe(0);
|
|
54
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue(10, { type: 'integer' })).toBe(10);
|
|
55
|
-
});
|
|
56
|
-
test('handles null and undefined', () => {
|
|
57
|
-
const prop = { type: 'string' };
|
|
58
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue(null, prop)).toBe(null);
|
|
59
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue(undefined, prop)).toBe(null);
|
|
60
|
-
});
|
|
61
|
-
test('handles unknown field type', () => {
|
|
62
|
-
const prop = { type: 'unknown' };
|
|
63
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue('val', prop)).toBe('val');
|
|
64
|
-
});
|
|
65
|
-
test('handles default string type', () => {
|
|
66
|
-
const prop = { type: 'string' };
|
|
67
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue('val', prop)).toBe('val');
|
|
68
|
-
});
|
|
69
|
-
test('handles null property in object', () => {
|
|
70
|
-
const prop = {
|
|
71
|
-
type: 'object',
|
|
72
|
-
properties: {
|
|
73
|
-
field: { type: 'string' },
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
const value = { field: null };
|
|
77
|
-
const result = frontmatter.pieceFrontmatterValueToDatabaseValue(value, prop);
|
|
78
|
-
expect(result.field).toBe(null);
|
|
79
|
-
});
|
|
80
|
-
test('converts comma-separated format', () => {
|
|
81
|
-
const prop = {
|
|
82
|
-
type: 'string',
|
|
83
|
-
format: 'comma-separated',
|
|
84
|
-
};
|
|
85
|
-
expect(frontmatter.pieceFrontmatterValueToDatabaseValue('a,b', prop)).toEqual(['a', 'b']);
|
|
86
|
-
});
|
|
87
|
-
test('converts arrays to native arrays (not CSV)', () => {
|
|
88
|
-
const prop = {
|
|
89
|
-
type: 'array',
|
|
90
|
-
items: { type: 'string' },
|
|
91
|
-
};
|
|
92
|
-
const value = ['a', 'b,withComma'];
|
|
93
|
-
const result = frontmatter.pieceFrontmatterValueToDatabaseValue(value, prop);
|
|
94
|
-
expect(result).toEqual(['a', 'b,withComma']);
|
|
95
|
-
expect(result).not.toBe('a,b,withComma');
|
|
96
|
-
});
|
|
97
|
-
test('converts objects recursively', () => {
|
|
98
|
-
const prop = {
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {
|
|
101
|
-
date: {
|
|
102
|
-
type: 'string',
|
|
103
|
-
format: 'date',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
const value = { date: '2023-01-01', extra: 'keep-me' };
|
|
108
|
-
const result = frontmatter.pieceFrontmatterValueToDatabaseValue(value, prop);
|
|
109
|
-
expect(result.date).toBeTypeOf('number');
|
|
110
|
-
expect(result.extra).toBe('keep-me');
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
describe('databaseValueToPieceFrontmatterValue', () => {
|
|
114
|
-
test('restores basic scalars', () => {
|
|
115
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(1609459200000, {
|
|
116
|
-
format: 'date',
|
|
117
|
-
type: 'string',
|
|
118
|
-
})).toBeTypeOf('string');
|
|
119
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(1, { type: 'boolean' })).toBe(true);
|
|
120
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(0, { type: 'boolean' })).toBe(false);
|
|
121
|
-
});
|
|
122
|
-
test('restores integers', () => {
|
|
123
|
-
const prop = { type: 'integer' };
|
|
124
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue('10', prop)).toBe(10);
|
|
125
|
-
});
|
|
126
|
-
test('restores arrays from native arrays', () => {
|
|
127
|
-
const prop = {
|
|
128
|
-
type: 'array',
|
|
129
|
-
items: { type: 'string' },
|
|
130
|
-
};
|
|
131
|
-
const value = ['a', 'b,withComma'];
|
|
132
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(value, prop)).toEqual(value);
|
|
133
|
-
});
|
|
134
|
-
test('restores arrays from legacy CSV strings', () => {
|
|
135
|
-
const prop = {
|
|
136
|
-
type: 'array',
|
|
137
|
-
items: { type: 'string' },
|
|
138
|
-
};
|
|
139
|
-
const value = 'a,b';
|
|
140
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(value, prop)).toEqual(['a', 'b']);
|
|
141
|
-
});
|
|
142
|
-
test('restores arrays recursively', () => {
|
|
143
|
-
const prop = {
|
|
144
|
-
type: 'array',
|
|
145
|
-
items: {
|
|
146
|
-
type: 'object',
|
|
147
|
-
properties: {
|
|
148
|
-
date: {
|
|
149
|
-
type: 'string',
|
|
150
|
-
format: 'date',
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
const value = [{ date: 1672531200000 }];
|
|
156
|
-
const result = frontmatter.databaseValueToPieceFrontmatterValue(value, prop);
|
|
157
|
-
expect(typeof result[0].date).toBe('string');
|
|
158
|
-
});
|
|
159
|
-
test('restores objects recursively', () => {
|
|
160
|
-
const prop = {
|
|
161
|
-
type: 'object',
|
|
162
|
-
properties: {
|
|
163
|
-
date: {
|
|
164
|
-
type: 'string',
|
|
165
|
-
format: 'date',
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
const value = { date: 1672531200000, extra: 'prop' };
|
|
170
|
-
const result = frontmatter.databaseValueToPieceFrontmatterValue(value, prop);
|
|
171
|
-
expect(typeof result.date).toBe('string');
|
|
172
|
-
expect(result.extra).toBe('prop');
|
|
173
|
-
});
|
|
174
|
-
test('handles null and undefined', () => {
|
|
175
|
-
const prop = { type: 'string' };
|
|
176
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(null, prop)).toBe(null);
|
|
177
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(undefined, prop)).toBe(null);
|
|
178
|
-
});
|
|
179
|
-
test('handles non-json comma-separated strings', () => {
|
|
180
|
-
const prop = {
|
|
181
|
-
type: 'string',
|
|
182
|
-
format: 'comma-separated',
|
|
183
|
-
};
|
|
184
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue('invalid', prop)).toBe('invalid');
|
|
185
|
-
});
|
|
186
|
-
test('handles default string type', () => {
|
|
187
|
-
const prop = { type: 'string' };
|
|
188
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue('val', prop)).toBe('val');
|
|
189
|
-
});
|
|
190
|
-
test('restores comma-separated from array', () => {
|
|
191
|
-
const prop = {
|
|
192
|
-
type: 'string',
|
|
193
|
-
format: 'comma-separated',
|
|
194
|
-
};
|
|
195
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue(['a', 'b'], prop)).toBe('a, b');
|
|
196
|
-
});
|
|
197
|
-
test('restores comma-separated from json string', () => {
|
|
198
|
-
const prop = {
|
|
199
|
-
type: 'string',
|
|
200
|
-
format: 'comma-separated',
|
|
201
|
-
};
|
|
202
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue('["a","b"]', prop)).toBe('a, b');
|
|
203
|
-
});
|
|
204
|
-
test('restores comma-separated from non-json string', () => {
|
|
205
|
-
const prop = {
|
|
206
|
-
type: 'string',
|
|
207
|
-
format: 'comma-separated',
|
|
208
|
-
};
|
|
209
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue('a,b', prop)).toBe('a,b');
|
|
210
|
-
});
|
|
211
|
-
test('handles unknown field type', () => {
|
|
212
|
-
const prop = { type: 'unknown' };
|
|
213
|
-
expect(frontmatter.databaseValueToPieceFrontmatterValue('val', prop)).toBe('val');
|
|
214
|
-
});
|
|
215
|
-
test('handles null property in objects', () => {
|
|
216
|
-
const prop = {
|
|
217
|
-
type: 'object',
|
|
218
|
-
properties: {
|
|
219
|
-
field: { type: 'string' },
|
|
220
|
-
},
|
|
221
|
-
};
|
|
222
|
-
const value = { field: null };
|
|
223
|
-
const result = frontmatter.databaseValueToPieceFrontmatterValue(value, prop);
|
|
224
|
-
expect(result.field).toBe(null);
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
describe('initializePieceFrontMatter', () => {
|
|
228
|
-
test('initializes empty required object', () => {
|
|
229
|
-
const property = {
|
|
230
|
-
type: 'object',
|
|
231
|
-
properties: {},
|
|
232
|
-
};
|
|
233
|
-
const result = frontmatter.initializePieceFrontMatterFromProperties({
|
|
234
|
-
obj: property,
|
|
235
|
-
}, ['obj'], true);
|
|
236
|
-
expect(result).toEqual({ obj: {} });
|
|
237
|
-
});
|
|
238
|
-
test('initializes nested objects', () => {
|
|
239
|
-
const schema = {
|
|
240
|
-
type: 'object',
|
|
241
|
-
properties: {
|
|
242
|
-
title: { type: 'string', examples: ['title'] },
|
|
243
|
-
metadata: {
|
|
244
|
-
type: 'object',
|
|
245
|
-
properties: {
|
|
246
|
-
author: { type: 'string', examples: ['Author'] },
|
|
247
|
-
tags: { type: 'array', items: { type: 'string', examples: ['b', 'a'] } }
|
|
248
|
-
},
|
|
249
|
-
required: ['author'],
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
required: ['title', 'metadata'],
|
|
253
|
-
};
|
|
254
|
-
const front = frontmatter.initializePieceFrontMatter(schema);
|
|
255
|
-
expect(front).toEqual({
|
|
256
|
-
title: 'title',
|
|
257
|
-
metadata: { author: 'Author', tags: ['b'] },
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
test('initializes empty object if required but no subfields initialized', () => {
|
|
261
|
-
const properties = {
|
|
262
|
-
metadata: {
|
|
263
|
-
type: 'object',
|
|
264
|
-
properties: {
|
|
265
|
-
author: { type: 'string' },
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
};
|
|
269
|
-
const schema = makeSchema(properties);
|
|
270
|
-
schema.required = ['title', 'metadata'];
|
|
271
|
-
const front = frontmatter.initializePieceFrontMatter(schema, true);
|
|
272
|
-
expect(front).toEqual({ title: 'title', metadata: {} });
|
|
273
|
-
});
|
|
274
|
-
test('honors minimal flag recursively', () => {
|
|
275
|
-
const schema = {
|
|
276
|
-
type: 'object',
|
|
277
|
-
properties: {
|
|
278
|
-
title: { type: 'string', examples: ['title'] },
|
|
279
|
-
metadata: {
|
|
280
|
-
type: 'object',
|
|
281
|
-
properties: {
|
|
282
|
-
author: { type: 'string', examples: ['Author'] },
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
required: ['title'],
|
|
287
|
-
};
|
|
288
|
-
const front = frontmatter.initializePieceFrontMatter(schema, true);
|
|
289
|
-
expect(front).toEqual({ title: 'title' });
|
|
290
|
-
});
|
|
291
|
-
test('fails if required field has no initial value', () => {
|
|
292
|
-
const schema = {
|
|
293
|
-
type: 'object',
|
|
294
|
-
properties: {
|
|
295
|
-
title: { type: 'string' },
|
|
296
|
-
},
|
|
297
|
-
required: ['title'],
|
|
298
|
-
};
|
|
299
|
-
expect(() => frontmatter.initializePieceFrontMatter(schema)).toThrow('can not initialize field "title"');
|
|
300
|
-
});
|
|
301
|
-
test('initializes with default value when present', () => {
|
|
302
|
-
const prop = {
|
|
303
|
-
field: { type: 'string', default: 'default-val' },
|
|
304
|
-
};
|
|
305
|
-
const result = frontmatter.initializePieceFrontMatterFromProperties(prop, [], false);
|
|
306
|
-
expect(result.field).toBe('default-val');
|
|
307
|
-
});
|
|
308
|
-
test('initializes with examples when default is missing', () => {
|
|
309
|
-
const schema = {
|
|
310
|
-
type: 'object',
|
|
311
|
-
properties: {
|
|
312
|
-
tags: { type: 'array', items: { type: 'string' } },
|
|
313
|
-
},
|
|
314
|
-
required: ['tags'],
|
|
315
|
-
};
|
|
316
|
-
expect(() => frontmatter.initializePieceFrontMatter(schema)).toThrow('can not initialize field "tags"');
|
|
317
|
-
});
|
|
318
|
-
test('initializes with examples when default is missing', () => {
|
|
319
|
-
const prop = {
|
|
320
|
-
field: { type: 'string', examples: ['example'] },
|
|
321
|
-
};
|
|
322
|
-
const result = frontmatter.initializePieceFrontMatterFromProperties(prop, [], false);
|
|
323
|
-
expect(result.field).toBe('example');
|
|
324
|
-
});
|
|
325
|
-
test('handles schema without required property', () => {
|
|
326
|
-
const schema = {
|
|
327
|
-
type: 'object',
|
|
328
|
-
properties: { title: { type: 'string', examples: ['t'] } },
|
|
329
|
-
};
|
|
330
|
-
const result = frontmatter.initializePieceFrontMatter(schema);
|
|
331
|
-
expect(result.title).toBe('t');
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
//# sourceMappingURL=frontmatter.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.test.js","sourceRoot":"","sources":["../../../../src/pieces/utils/frontmatter.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC9D,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAsB,MAAM,sBAAsB,CAAA;AAErE,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,SAAS,CAAC,GAAG,EAAE;QACd,EAAE,CAAC,aAAa,EAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAChD,IAAI,CAA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,CAAC,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CACnE,iCAAiC,CACjC,CAAA;QACF,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC9D,MAAM,IAAI,GAAyD;gBAClE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;aAChD,CAAA;YACD,MAAM,MAAM,GAAG,WAAW,CAAC,wCAAwC,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;YACpF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,0CAA0C,EAAE,GAAG,EAAE;YACrD,MAAM,MAAM,GAAG;gBACd,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;aACqB,CAAA;YAChF,MAAM,MAAM,GAAG,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAA;YAC7D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import { describe, expect, test, vi, afterEach } from 'vitest'\nimport * as frontmatter from './frontmatter.js'\nimport { makeSchema, MockSchemaProperty } from '../Piece.fixtures.js'\n\ndescribe('pieces/utils/frontmatter.ts', () => {\n\tafterEach(() => {\n\t\tvi.resetAllMocks()\n\t})\n\n\tdescribe('getPieceFrontmatterSchemaFields', () => {\n\t\ttest('handles basic scalar fields', () => {\n\t\t\tconst schema = makeSchema({\n\t\t\t\tfield: { type: 'string' },\n\t\t\t\tfield2: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tnullable: true,\n\t\t\t\t\tformat: 'date',\n\t\t\t\t\tpattern: 'pattern',\n\t\t\t\t} as unknown as MockSchemaProperty,\n\t\t\t})\n\t\t\tschema.required = undefined\n\t\t\tconst fields = frontmatter.getPieceFrontmatterSchemaFields(schema)\n\n\t\t\texpect(fields).toContainEqual({ name: 'field', type: 'string', nullable: true })\n\t\t\texpect(fields).toContainEqual({\n\t\t\t\tname: 'field2',\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'date',\n\t\t\t\tpattern: 'pattern',\n\t\t\t\tnullable: true,\n\t\t\t})\n\t\t})\n\n\t\ttest('handles required and nullable fields', () => {\n\t\t\tconst schema = makeSchema({\n\t\t\t\trequiredField: { type: 'string' },\n\t\t\t\toptionalField: { type: 'string', nullable: true },\n\t\t\t\tdefaultOptional: { type: 'string' },\n\t\t\t})\n\t\t\tschema.required = ['requiredField']\n\t\t\tconst fields = frontmatter.getPieceFrontmatterSchemaFields(schema)\n\n\t\t\tconst requiredField = fields.find((f) => f.name === 'requiredField')\n\t\t\tconst optionalField = fields.find((f) => f.name === 'optionalField')\n\t\t\tconst defaultOptional = fields.find((f) => f.name === 'defaultOptional')\n\n\t\t\texpect(optionalField?.nullable).toBe(true)\n\t\t\texpect(requiredField?.nullable).toBe(false)\n\t\t\texpect(defaultOptional?.nullable).toBe(true)\n\t\t})\n\t})\n\n\tdescribe('pieceFrontmatterValueToDatabaseValue', () => {\n\t\ttest('converts basic scalars', () => {\n\t\t\texpect(\n\t\t\t\tfrontmatter.pieceFrontmatterValueToDatabaseValue('2021-01-01', {\n\t\t\t\t\tformat: 'date',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t} as unknown as frontmatter.PieceFrontmatterProperty)\n\t\t\t).toBeTypeOf('number')\n\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue(true, { type: 'boolean' })).toBe(1)\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue(false, { type: 'boolean' })).toBe(0)\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue(10, { type: 'integer' })).toBe(10)\n\t\t})\n\n\t\ttest('handles null and undefined', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = { type: 'string' }\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue(null, prop)).toBe(null)\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue(undefined, prop)).toBe(null)\n\t\t})\n\n\t\ttest('handles unknown field type', () => {\n\t\t\tconst prop = { type: 'unknown' } as unknown as frontmatter.PieceFrontmatterProperty\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue('val', prop)).toBe('val')\n\t\t})\n\n\t\ttest('handles default string type', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = { type: 'string' }\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue('val', prop)).toBe('val')\n\t\t})\n\n\t\ttest('handles null property in object', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tfield: { type: 'string' },\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst value = { field: null }\n\t\t\tconst result = frontmatter.pieceFrontmatterValueToDatabaseValue(value, prop) as Record<\n\t\t\t\tstring,\n\t\t\t\tunknown\n\t\t\t>\n\t\t\texpect(result.field).toBe(null)\n\t\t})\n\n\t\ttest('converts comma-separated format', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'comma-separated',\n\t\t\t}\n\t\t\texpect(frontmatter.pieceFrontmatterValueToDatabaseValue('a,b', prop)).toEqual(['a', 'b'])\n\t\t})\n\n\t\ttest('converts arrays to native arrays (not CSV)', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'array',\n\t\t\t\titems: { type: 'string' },\n\t\t\t}\n\t\t\tconst value = ['a', 'b,withComma']\n\t\t\tconst result = frontmatter.pieceFrontmatterValueToDatabaseValue(value, prop)\n\n\t\t\texpect(result).toEqual(['a', 'b,withComma'])\n\t\t\texpect(result).not.toBe('a,b,withComma')\n\t\t})\n\n\t\ttest('converts objects recursively', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tdate: {\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tformat: 'date',\n\t\t\t\t\t} as unknown as frontmatter.PieceFrontmatterProperty,\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst value = { date: '2023-01-01', extra: 'keep-me' }\n\t\t\tconst result = frontmatter.pieceFrontmatterValueToDatabaseValue(value, prop) as Record<\n\t\t\t\tstring,\n\t\t\t\tunknown\n\t\t\t>\n\n\t\t\texpect(result.date).toBeTypeOf('number')\n\t\t\texpect(result.extra).toBe('keep-me')\n\t\t})\n\t})\n\n\tdescribe('databaseValueToPieceFrontmatterValue', () => {\n\t\ttest('restores basic scalars', () => {\n\t\t\texpect(\n\t\t\t\tfrontmatter.databaseValueToPieceFrontmatterValue(1609459200000, {\n\t\t\t\t\tformat: 'date',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t} as unknown as frontmatter.PieceFrontmatterProperty)\n\t\t\t).toBeTypeOf('string')\n\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(1, { type: 'boolean' })).toBe(true)\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(0, { type: 'boolean' })).toBe(false)\n\n\t\t})\n\n\t\ttest('restores integers', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = { type: 'integer' }\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue('10', prop)).toBe(10)\n\t\t})\n\n\t\ttest('restores arrays from native arrays', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'array',\n\t\t\t\titems: { type: 'string' },\n\t\t\t}\n\t\t\tconst value = ['a', 'b,withComma']\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(value, prop)).toEqual(value)\n\t\t})\n\n\t\ttest('restores arrays from legacy CSV strings', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'array',\n\t\t\t\titems: { type: 'string' },\n\t\t\t}\n\t\t\tconst value = 'a,b'\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(value, prop)).toEqual(['a', 'b'])\n\t\t})\n\n\t\ttest('restores arrays recursively', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'array',\n\t\t\t\titems: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\tformat: 'date',\n\t\t\t\t\t\t} as unknown as frontmatter.PieceFrontmatterProperty,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst value = [{ date: 1672531200000 }]\n\t\t\tconst result = frontmatter.databaseValueToPieceFrontmatterValue(value, prop) as unknown[]\n\t\t\texpect(typeof (result[0] as Record<string, unknown>).date).toBe('string')\n\t\t})\n\n\t\ttest('restores objects recursively', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tdate: {\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tformat: 'date',\n\t\t\t\t\t} as unknown as frontmatter.PieceFrontmatterProperty,\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst value = { date: 1672531200000, extra: 'prop' }\n\t\t\tconst result = frontmatter.databaseValueToPieceFrontmatterValue(value, prop) as Record<\n\t\t\t\tstring,\n\t\t\t\tunknown\n\t\t\t>\n\n\t\t\texpect(typeof result.date).toBe('string')\n\t\t\texpect(result.extra).toBe('prop')\n\t\t})\n\n\t\ttest('handles null and undefined', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = { type: 'string' }\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(null, prop)).toBe(null)\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(undefined, prop)).toBe(null)\n\t\t})\n\n\t\ttest('handles non-json comma-separated strings', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'comma-separated',\n\t\t\t}\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue('invalid', prop)).toBe('invalid')\n\t\t})\n\n\t\ttest('handles default string type', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = { type: 'string' }\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue('val', prop)).toBe('val')\n\t\t})\n\n\t\ttest('restores comma-separated from array', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'comma-separated',\n\t\t\t}\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue(['a', 'b'], prop)).toBe('a, b')\n\t\t})\n\n\t\ttest('restores comma-separated from json string', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'comma-separated',\n\t\t\t}\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue('[\"a\",\"b\"]', prop)).toBe('a, b')\n\t\t})\n\n\t\ttest('restores comma-separated from non-json string', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'comma-separated',\n\t\t\t}\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue('a,b', prop)).toBe('a,b')\n\t\t})\n\n\t\ttest('handles unknown field type', () => {\n\t\t\tconst prop = { type: 'unknown' } as unknown as frontmatter.PieceFrontmatterProperty\n\t\t\texpect(frontmatter.databaseValueToPieceFrontmatterValue('val', prop)).toBe('val')\n\t\t})\n\n\t\ttest('handles null property in objects', () => {\n\t\t\tconst prop: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tfield: { type: 'string' },\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst value = { field: null }\n\t\t\tconst result = frontmatter.databaseValueToPieceFrontmatterValue(value, prop) as Record<\n\t\t\t\tstring,\n\t\t\t\tunknown\n\t\t\t>\n\t\t\texpect(result.field).toBe(null)\n\t\t})\n\t})\n\n\tdescribe('initializePieceFrontMatter', () => {\n\t\ttest('initializes empty required object', () => {\n\t\t\tconst property: frontmatter.PieceFrontmatterProperty = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {},\n\t\t\t}\n\t\t\tconst result = frontmatter.initializePieceFrontMatterFromProperties(\n\t\t\t\t{\n\t\t\t\t\tobj: property,\n\t\t\t\t},\n\t\t\t\t['obj'],\n\t\t\t\ttrue\n\t\t\t)\n\t\t\texpect(result).toEqual({ obj: {} })\n\t\t})\n\t\ttest('initializes nested objects', () => {\n\t\t\tconst schema = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttitle: { type: 'string', examples: ['title'] },\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tauthor: { type: 'string', examples: ['Author'] },\n\t\t\t\t\t\t\ttags: { type: 'array', items: { type: 'string', examples: ['b', 'a'] } }\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequired: ['author'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trequired: ['title', 'metadata'],\n\t\t\t} as unknown as frontmatter.PieceFrontmatterSchema<frontmatter.PieceFrontmatter>\n\n\t\t\tconst front = frontmatter.initializePieceFrontMatter(schema)\n\t\t\texpect(front).toEqual({\n\t\t\t\ttitle: 'title',\n\t\t\t\tmetadata: { author: 'Author', tags: ['b'] },\n\t\t\t})\n\t\t})\n\n\t\ttest('initializes empty object if required but no subfields initialized', () => {\n\t\t\tconst properties: Record<string, MockSchemaProperty> = {\n\t\t\t\tmetadata: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tauthor: { type: 'string' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst schema = makeSchema(properties)\n\t\t\tschema.required = ['title', 'metadata']\n\n\t\t\tconst front = frontmatter.initializePieceFrontMatter(schema, true)\n\t\t\texpect(front).toEqual({ title: 'title', metadata: {} })\n\t\t})\n\n\t\ttest('honors minimal flag recursively', () => {\n\t\t\tconst schema = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttitle: { type: 'string', examples: ['title'] },\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tauthor: { type: 'string', examples: ['Author'] },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trequired: ['title'],\n\t\t\t} as unknown as frontmatter.PieceFrontmatterSchema<frontmatter.PieceFrontmatter>\n\n\t\t\tconst front = frontmatter.initializePieceFrontMatter(schema, true)\n\t\t\texpect(front).toEqual({ title: 'title' })\n\t\t})\n\n\t\ttest('fails if required field has no initial value', () => {\n\t\t\tconst schema = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttitle: { type: 'string' },\n\t\t\t\t},\n\t\t\t\trequired: ['title'],\n\t\t\t} as unknown as frontmatter.PieceFrontmatterSchema<frontmatter.PieceFrontmatter>\n\n\t\t\texpect(() => frontmatter.initializePieceFrontMatter(schema)).toThrow(\n\t\t\t\t'can not initialize field \"title\"'\n\t\t\t)\n\t\t})\n\n\t\ttest('initializes with default value when present', () => {\n\t\t\tconst prop: Record<string, frontmatter.PieceFrontmatterProperty> = {\n\t\t\t\tfield: { type: 'string', default: 'default-val' },\n\t\t\t}\n\t\t\tconst result = frontmatter.initializePieceFrontMatterFromProperties(prop, [], false)\n\t\t\texpect(result.field).toBe('default-val')\n\t\t})\n\n\t\ttest('initializes with examples when default is missing', () => {\n\t\t\tconst schema = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttags: { type: 'array', items: { type: 'string' } },\n\t\t\t\t},\n\t\t\t\trequired: ['tags'],\n\t\t\t} as unknown as frontmatter.PieceFrontmatterSchema<frontmatter.PieceFrontmatter>\n\n\t\t\texpect(() => frontmatter.initializePieceFrontMatter(schema)).toThrow(\n\t\t\t\t'can not initialize field \"tags\"'\n\t\t\t)\n\t\t})\n\n\t\ttest('initializes with examples when default is missing', () => {\n\t\t\tconst prop: Record<string, frontmatter.PieceFrontmatterProperty> = {\n\t\t\t\tfield: { type: 'string', examples: ['example'] },\n\t\t\t}\n\t\t\tconst result = frontmatter.initializePieceFrontMatterFromProperties(prop, [], false)\n\t\t\texpect(result.field).toBe('example')\n\t\t})\n\n\t\ttest('handles schema without required property', () => {\n\t\t\tconst schema = {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { title: { type: 'string', examples: ['t'] } },\n\t\t\t} as unknown as frontmatter.PieceFrontmatterSchema<frontmatter.PieceFrontmatter>\n\t\t\tconst result = frontmatter.initializePieceFrontMatter(schema)\n\t\t\texpect(result.title).toBe('t')\n\t\t})\n\t})\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test, vi, afterEach } from 'vitest';
|
|
2
|
-
import { addFrontMatter } from '../../lib/frontmatter.js';
|
|
3
|
-
import { makePieceMarkdown, makePieceMarkdownString } from './markdown.js';
|
|
4
|
-
vi.mock('ajv/dist/jtd.js');
|
|
5
|
-
vi.mock('../../lib/frontmatter.js');
|
|
6
|
-
const mocks = {
|
|
7
|
-
addFrontMatter: vi.mocked(addFrontMatter),
|
|
8
|
-
};
|
|
9
|
-
const spies = {};
|
|
10
|
-
describe('pieces/utils/markdown.ts', () => {
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
Object.values(mocks).forEach((mock) => {
|
|
13
|
-
mock.mockReset();
|
|
14
|
-
});
|
|
15
|
-
Object.keys(spies).forEach((key) => {
|
|
16
|
-
spies[key].mockRestore();
|
|
17
|
-
delete spies[key];
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
test('makePieceMarkdownOrThrow', async () => {
|
|
21
|
-
const note = 'a tale of two mark downs';
|
|
22
|
-
const path = 'path/to/some-piece.md';
|
|
23
|
-
const piece = 'books';
|
|
24
|
-
const frontmatter = { title: 'two', metadata: 'three' };
|
|
25
|
-
const md = makePieceMarkdown(path, piece, note, frontmatter);
|
|
26
|
-
expect(md).toEqual({
|
|
27
|
-
filePath: path,
|
|
28
|
-
piece,
|
|
29
|
-
frontmatter,
|
|
30
|
-
note,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
test('makePieceMardownString', () => {
|
|
34
|
-
makePieceMarkdownString({});
|
|
35
|
-
expect(mocks.addFrontMatter).toHaveBeenCalled();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=markdown.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.test.js","sourceRoot":"","sources":["../../../../src/pieces/utils/markdown.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAgB,MAAM,QAAQ,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAE1E,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAC1B,EAAE,CAAC,IAAI,CAAC,0BA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AA;IAChD,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import { describe, expect, test, vi, afterEach, MockInstance } from 'vitest'\nimport { addFrontMatter } from '../../lib/frontmatter.js'\nimport { PieceFrontmatter } from './frontmatter.js'\nimport { PieceMarkdown } from './markdown.js'\nimport { makePieceMarkdown, makePieceMarkdownString } from './markdown.js'\n\nvi.mock('ajv/dist/jtd.js')\nvi.mock('../../lib/frontmatter.js')\n\nconst mocks = {\n\taddFrontMatter: vi.mocked(addFrontMatter),\n}\n\nconst spies: { [key: string]: MockInstance } = {}\n\ndescribe('pieces/utils/markdown.ts', () => {\n\tafterEach(() => {\n\t\tObject.values(mocks).forEach((mock) => {\n\t\t\tmock.mockReset()\n\t\t})\n\n\t\tObject.keys(spies).forEach((key) => {\n\t\t\tspies[key].mockRestore()\n\t\t\tdelete spies[key]\n\t\t})\n\t})\n\n\ttest('makePieceMarkdownOrThrow', async () => {\n\t\tconst note = 'a tale of two mark downs'\n\t\tconst path = 'path/to/some-piece.md'\n\t\tconst piece = 'books'\n\t\tconst frontmatter = { title: 'two', metadata: 'three' }\n\n\t\tconst md = makePieceMarkdown(path, piece, note, frontmatter)\n\n\t\texpect(md).toEqual({\n\t\t\tfilePath: path,\n\t\t\tpiece,\n\t\t\tfrontmatter,\n\t\t\tnote,\n\t\t})\n\t})\n\n\ttest('makePieceMardownString', () => {\n\t\tmakePieceMarkdownString({} as unknown as PieceMarkdown<PieceFrontmatter>)\n\t\texpect(mocks.addFrontMatter).toHaveBeenCalled()\n\t})\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|