Skip to content

Commit

Permalink
Merge branch 'next' into feat/studio-manifests-cont
Browse files Browse the repository at this point in the history
  • Loading branch information
snorrees authored Oct 3, 2024
2 parents 6d05f49 + e7e7185 commit 3e80992
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ describe('stringOperators', () => {

it('should create a valid filter for stringMatches', () => {
const filter = stringOperators.stringMatches.groqFilter({fieldPath, value})
expect(filter).toEqual(`${fieldPath} match "${value}"`)
expect(filter).toEqual(`${fieldPath} match "*${value}*"`)
})

it('should create a valid filter for stringNotMatches', () => {
const filter = stringOperators.stringNotMatches.groqFilter({fieldPath, value})
expect(filter).toEqual(`!(${fieldPath} match "*${value}*")`)
})

it('should create a valid filter for stringNotEqual', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const stringOperators = {
nameKey: 'search.operator.string-contains.name',
descriptionKey: 'search.operator.string-contains.description',
groqFilter: ({fieldPath, value}) =>
value && fieldPath ? `${fieldPath} match ${toJSON(value)}` : null,
value && fieldPath ? `${fieldPath} match "*${value}*"` : null,
initialValue: null,
inputComponent: SearchFilterStringInput as SearchOperatorInput<string | number>,
type: 'stringMatches',
Expand All @@ -55,7 +55,7 @@ export const stringOperators = {
nameKey: 'search.operator.string-not-contains.name',
descriptionKey: 'search.operator.string-not-contains.description',
groqFilter: ({fieldPath, value}) =>
value && fieldPath ? `!(${fieldPath} match ${toJSON(value)})` : null,
value && fieldPath ? `!(${fieldPath} match "*${value}*")` : null,
initialValue: null,
inputComponent: SearchFilterStringInput as SearchOperatorInput<string | number>,
type: 'stringNotMatches',
Expand Down

0 comments on commit 3e80992

Please sign in to comment.