1
1
import { describe , it , expect } from 'vitest' ;
2
2
import { AttributeType , type AttributeTypeValue } from '../../core/attributes/types' ;
3
- import type { AttributeSchema , TypedEntity } from '../types/schema' ;
4
- import { TypedRuleEngine } from '../engine/rule-engine' ;
3
+ import type { AttributeSchema , Entity } from '../types/schema' ;
4
+ import { RuleEngine } from '../engine/rule-engine' ;
5
5
6
- describe ( 'TypedRuleEngine ' , ( ) => {
6
+ describe ( 'RuleEngine ' , ( ) => {
7
7
const CATEGORIES = [ 'electronics' , 'furniture' , 'clothing' ] as const ;
8
8
9
9
// Test schema definition
@@ -83,7 +83,7 @@ describe('TypedRuleEngine', () => {
83
83
price : number ,
84
84
inStock : boolean ,
85
85
tags : string [ ] = [ ] ,
86
- ) : TypedEntity < ProductSchema > => ( {
86
+ ) : Entity < ProductSchema > => ( {
87
87
id,
88
88
name : `Product ${ id } ` ,
89
89
attributes : {
@@ -96,7 +96,7 @@ describe('TypedRuleEngine', () => {
96
96
} ) ;
97
97
98
98
describe ( 'findMatchingFrom' , ( ) => {
99
- const engine = new TypedRuleEngine ( productSchema ) ;
99
+ const engine = new RuleEngine ( productSchema ) ;
100
100
101
101
it ( 'matches entities with simple attribute rules' , ( ) => {
102
102
const entities = [
@@ -201,7 +201,7 @@ describe('TypedRuleEngine', () => {
201
201
category : 'invalid' ,
202
202
__validated : true ,
203
203
} ,
204
- } as TypedEntity < ProductSchema > ,
204
+ } as Entity < ProductSchema > ,
205
205
] ;
206
206
207
207
const rules = [ { attributes : { category : { eq : 'electronics' } } } ] ;
@@ -213,7 +213,7 @@ describe('TypedRuleEngine', () => {
213
213
} ) ;
214
214
215
215
describe ( 'findMatchingTo' , ( ) => {
216
- const engine = new TypedRuleEngine ( productSchema ) ;
216
+ const engine = new RuleEngine ( productSchema ) ;
217
217
218
218
it ( 'finds matching target entities' , ( ) => {
219
219
const fromEntities = [ createProduct ( '1' , 'electronics' , 100 , true ) ] ;
0 commit comments