Skip to content

Commit 2e5c9ce

Browse files
committed
test: update test files to use renamed v3 types
- Update index.test.ts to use RuleEngine instead of TypedRuleEngine - Update rule-engine.test.ts to use renamed types (RuleEngine, Entity) - Adjust import statements and test descriptions accordingly
1 parent 7d789e9 commit 2e5c9ce

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ describe('Package exports', () => {
4141

4242
describe('v3', () => {
4343
it('should export type-safe API', () => {
44-
expect(v3.TypedRuleEngine).toBeDefined();
44+
expect(v3.RuleEngine).toBeDefined();
4545
expect(v3.AttributeType).toBeDefined();
4646
});
4747

4848
it('should export schema types', () => {
49-
expect(v3.TypedComparisonOperators).toEqual({
49+
expect(v3.ComparisonOperators).toEqual({
5050
eq: 'eq',
5151
ne: 'ne',
5252
gt: 'gt',

src/v3/__tests__/rule-engine.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { describe, it, expect } from 'vitest';
22
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';
55

6-
describe('TypedRuleEngine', () => {
6+
describe('RuleEngine', () => {
77
const CATEGORIES = ['electronics', 'furniture', 'clothing'] as const;
88

99
// Test schema definition
@@ -83,7 +83,7 @@ describe('TypedRuleEngine', () => {
8383
price: number,
8484
inStock: boolean,
8585
tags: string[] = [],
86-
): TypedEntity<ProductSchema> => ({
86+
): Entity<ProductSchema> => ({
8787
id,
8888
name: `Product ${id}`,
8989
attributes: {
@@ -96,7 +96,7 @@ describe('TypedRuleEngine', () => {
9696
});
9797

9898
describe('findMatchingFrom', () => {
99-
const engine = new TypedRuleEngine(productSchema);
99+
const engine = new RuleEngine(productSchema);
100100

101101
it('matches entities with simple attribute rules', () => {
102102
const entities = [
@@ -201,7 +201,7 @@ describe('TypedRuleEngine', () => {
201201
category: 'invalid',
202202
__validated: true,
203203
},
204-
} as TypedEntity<ProductSchema>,
204+
} as Entity<ProductSchema>,
205205
];
206206

207207
const rules = [{ attributes: { category: { eq: 'electronics' } } }];
@@ -213,7 +213,7 @@ describe('TypedRuleEngine', () => {
213213
});
214214

215215
describe('findMatchingTo', () => {
216-
const engine = new TypedRuleEngine(productSchema);
216+
const engine = new RuleEngine(productSchema);
217217

218218
it('finds matching target entities', () => {
219219
const fromEntities = [createProduct('1', 'electronics', 100, true)];

0 commit comments

Comments
 (0)