Skip to content

Commit

Permalink
Update in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andresceballosm committed Aug 1, 2024
1 parent e42e69e commit e2d162e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/taco/test/conditions/base/json-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ describe('JSONPath Validation', () => {
const invalidPath = '$.store.book[?(@.price < ]';
const result = jsonPathSchema.safeParse(invalidPath);
expect(result.success).toBe(false);
expect(result.error!.errors[0].message).toBe('Invalid JSONPath expression');
});

it('Invalid JSONPath: Incorrect use of brackets', () => {
const invalidPath = '$[store][book]';
const result = jsonPathSchema.safeParse(invalidPath);
expect(result.success).toBe(false);
expect(result.error!.errors[0].message).toBe('Invalid JSONPath expression');
});

it('Invalid JSONPath: Unclosed wildcard asterisk', () => {
const invalidPath = '$.store.book[*';
const result = jsonPathSchema.safeParse(invalidPath);
expect(result.success).toBe(false);
expect(result.error!.errors[0].message).toBe('Invalid JSONPath expression');
});

it('Valid JSONPath expression', () => {
Expand Down

0 comments on commit e2d162e

Please sign in to comment.