@objectstack/objectql 0.8.2 → 0.9.0
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/package.json +5 -5
- package/src/registry.test.ts +27 -0
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/objectql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Isomorphic ObjectQL Engine for ObjectStack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@objectstack/core": "0.
|
|
9
|
-
"@objectstack/spec": "0.
|
|
10
|
-
"@objectstack/types": "0.
|
|
8
|
+
"@objectstack/core": "0.9.0",
|
|
9
|
+
"@objectstack/spec": "0.9.0",
|
|
10
|
+
"@objectstack/types": "0.9.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"typescript": "^5.0.0",
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
|
-
"test": "
|
|
18
|
+
"test": "vitest run"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { SchemaRegistry } from './registry';
|
|
3
|
+
|
|
4
|
+
describe('SchemaRegistry', () => {
|
|
5
|
+
it('should register and retrieve an item', () => {
|
|
6
|
+
const item = { name: 'test_object', type: 'object' };
|
|
7
|
+
|
|
8
|
+
SchemaRegistry.registerItem('object', item, 'name');
|
|
9
|
+
|
|
10
|
+
const retrieved = SchemaRegistry.getItem('object', 'test_object');
|
|
11
|
+
expect(retrieved).toEqual(item);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should list items by type', () => {
|
|
15
|
+
const item1 = { name: 'obj1' };
|
|
16
|
+
const item2 = { name: 'obj2' };
|
|
17
|
+
|
|
18
|
+
SchemaRegistry.registerItem('object', item1, 'name');
|
|
19
|
+
SchemaRegistry.registerItem('object', item2, 'name');
|
|
20
|
+
|
|
21
|
+
const items = SchemaRegistry.listItems('object');
|
|
22
|
+
// Note: Registry is singleton, so it might contain previous test items or other items
|
|
23
|
+
expect(items.length).toBeGreaterThanOrEqual(2);
|
|
24
|
+
expect(items).toContainEqual(item1);
|
|
25
|
+
expect(items).toContainEqual(item2);
|
|
26
|
+
});
|
|
27
|
+
});
|