Skip to content

Commit b6e0db4

Browse files
os-zhuangclaude
andcommitted
test(metadata-protocol): add self-contained public-surface smoke
`@objectstack/metadata-protocol` had a `test` script but no test files, so `vitest run` exited non-zero and failed CI's Test Core (`turbo run test`). Adds a smoke that imports the package and asserts its public exports + pure helpers without needing a data engine (protocol behavior is covered e2e by the objectql suite). Full `turbo run test` now green (126/126 tasks). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 82247fc commit b6e0db4

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
//
3+
// Self-contained smoke for @objectstack/metadata-protocol: the package must
4+
// import cleanly and expose its public surface without needing a data engine.
5+
// (Protocol behavior is exercised end-to-end by the @objectstack/objectql suite,
6+
// which injects a real engine.)
7+
8+
import { describe, it, expect } from 'vitest';
9+
import {
10+
ObjectStackProtocolImplementation,
11+
ConcurrentUpdateError,
12+
normalizeViewMetadata,
13+
SysMetadataRepository,
14+
resetEnvWritableMetadataTypes,
15+
computeMetadataDiagnostics,
16+
computeViewReferenceDiagnostics,
17+
decorateMetadataItem,
18+
SeedLoaderService,
19+
runBuildProbes,
20+
} from './index.js';
21+
22+
describe('@objectstack/metadata-protocol public surface', () => {
23+
it('exposes the protocol, repository, seed-loader and probe entry points', () => {
24+
expect(typeof ObjectStackProtocolImplementation).toBe('function');
25+
expect(typeof SysMetadataRepository).toBe('function');
26+
expect(typeof SeedLoaderService).toBe('function');
27+
expect(typeof runBuildProbes).toBe('function');
28+
expect(ConcurrentUpdateError.prototype).toBeInstanceOf(Error);
29+
});
30+
31+
it('exposes pure metadata helpers', () => {
32+
expect(typeof normalizeViewMetadata).toBe('function');
33+
expect(typeof computeMetadataDiagnostics).toBe('function');
34+
expect(typeof computeViewReferenceDiagnostics).toBe('function');
35+
expect(typeof decorateMetadataItem).toBe('function');
36+
expect(typeof resetEnvWritableMetadataTypes).toBe('function');
37+
});
38+
39+
it('normalizeViewMetadata passes a non-view item through without throwing', () => {
40+
const item = { name: 'acct', label: 'Account' };
41+
expect(() => normalizeViewMetadata('object', item, 'acct')).not.toThrow();
42+
});
43+
44+
it('resetEnvWritableMetadataTypes is callable (state reset, no engine needed)', () => {
45+
expect(() => resetEnvWritableMetadataTypes()).not.toThrow();
46+
});
47+
});

0 commit comments

Comments
 (0)