Skip to content

Commit 16242c6

Browse files
Copilothotlong
andcommitted
Fix test files for schema changes: dates to ISO strings, isolation levels to snake_case, dashboard name validation
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 1ff9a86 commit 16242c6

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

packages/spec/src/data/driver-sql.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe('SQLDriverConfigSchema', () => {
170170
bulkDelete: true,
171171
transactions: true,
172172
savepoints: true,
173-
isolationLevels: ['read-committed', 'repeatable-read', 'serializable'],
173+
isolationLevels: ['read_committed', 'repeatable_read', 'serializable'],
174174
queryFilters: true,
175175
queryAggregations: true,
176176
querySorting: true,

packages/spec/src/kernel/metadata-loader.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('MetadataLoaderProtocol', () => {
3333
it('should validate metadata statistics', () => {
3434
const stats = {
3535
size: 1024,
36-
modifiedAt: new Date('2026-01-31T00:00:00Z'),
36+
modifiedAt: '2026-01-31T00:00:00.000Z',
3737
etag: '"abc123"',
3838
format: 'json' as const,
3939
};
@@ -47,7 +47,7 @@ describe('MetadataLoaderProtocol', () => {
4747
it('should allow optional fields', () => {
4848
const stats = {
4949
size: 2048,
50-
modifiedAt: new Date(),
50+
modifiedAt: new Date().toISOString(),
5151
etag: '"xyz789"',
5252
format: 'yaml' as const,
5353
path: '/metadata/objects/customer.object.yaml',
@@ -62,7 +62,7 @@ describe('MetadataLoaderProtocol', () => {
6262
it('should reject negative size', () => {
6363
const stats = {
6464
size: -100,
65-
modifiedAt: new Date(),
65+
modifiedAt: new Date().toISOString(),
6666
etag: '"abc"',
6767
format: 'json' as const,
6868
};
@@ -85,7 +85,7 @@ describe('MetadataLoaderProtocol', () => {
8585
const options = {
8686
patterns: ['**/*.object.ts', '**/*.object.json'],
8787
ifNoneMatch: '"etag123"',
88-
ifModifiedSince: new Date('2026-01-01T00:00:00Z'),
88+
ifModifiedSince: '2026-01-01T00:00:00.000Z',
8989
validate: false,
9090
useCache: false,
9191
filter: '(item) => item.name.startsWith("sys_")',
@@ -222,7 +222,7 @@ describe('MetadataLoaderProtocol', () => {
222222
etag: '"abc123"',
223223
stats: {
224224
size: 512,
225-
modifiedAt: new Date(),
225+
modifiedAt: new Date().toISOString(),
226226
etag: '"abc123"',
227227
format: 'typescript' as const,
228228
},
@@ -273,21 +273,21 @@ describe('MetadataLoaderProtocol', () => {
273273
name: 'customer',
274274
path: '/objects/customer.object.ts',
275275
data: { name: 'customer' },
276-
timestamp: new Date(),
276+
timestamp: new Date().toISOString(),
277277
},
278278
{
279279
type: 'changed' as const,
280280
metadataType: 'view',
281281
name: 'customer_list',
282282
path: '/views/customer_list.view.ts',
283-
timestamp: new Date(),
283+
timestamp: new Date().toISOString(),
284284
},
285285
{
286286
type: 'deleted' as const,
287287
metadataType: 'app',
288288
name: 'old_app',
289289
path: '/apps/old_app.ts',
290-
timestamp: new Date(),
290+
timestamp: new Date().toISOString(),
291291
},
292292
];
293293

@@ -318,7 +318,7 @@ describe('MetadataLoaderProtocol', () => {
318318
count: 15,
319319
formats: ['yaml'] as const,
320320
totalSize: 51200,
321-
lastModified: new Date('2026-01-31T00:00:00Z'),
321+
lastModified: '2026-01-31T00:00:00.000Z',
322322
location: '/metadata/views',
323323
};
324324

packages/spec/src/system/object-storage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('ObjectMetadataSchema', () => {
135135
contentLanguage: 'en-US',
136136
cacheControl: 'max-age=3600',
137137
etag: '"abc123def456"',
138-
lastModified: new Date('2024-01-01'),
138+
lastModified: '2024-01-01T00:00:00.000Z',
139139
versionId: 'v1.0',
140140
storageClass: 'standard',
141141
encryption: {

packages/spec/src/ui/dashboard.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ describe('DashboardSchema', () => {
174174
});
175175

176176
it('should enforce snake_case for dashboard name', () => {
177-
const validNames = ['sales_dashboard', 'revenue_overview', 'my_metrics', '_internal'];
177+
const validNames = ['sales_dashboard', 'revenue_overview', 'my_metrics'];
178178
validNames.forEach(name => {
179179
expect(() => DashboardSchema.parse({ name, label: 'Test', widgets: [] })).not.toThrow();
180180
});
181181

182-
const invalidNames = ['salesDashboard', 'Sales-Dashboard', '123dashboard'];
182+
const invalidNames = ['salesDashboard', 'Sales-Dashboard', '123dashboard', '_internal'];
183183
invalidNames.forEach(name => {
184184
expect(() => DashboardSchema.parse({ name, label: 'Test', widgets: [] })).toThrow();
185185
});

0 commit comments

Comments
 (0)