Skip to content

Commit

Permalink
fix: add endpoint to text plain matchers (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo authored Nov 19, 2024
1 parent 39186d3 commit bc25458
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,18 @@ describe('isExpressionDescriptionValidation', () => {
})
).toBe(false)
})
it('returns true for a POST to "programIndicators/expression/description"', () => {
expect(
isExpressionDescriptionValidation('create', {
resource: 'programIndicators/expression/description',
})
).toBe(true)
})
it('retuns false for a POST to a different resource', () => {
expect(
isMetadataPackageInstallation('create', {
resource: 'programIndicators/expression/somethingelse',
})
).toBe(false)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ export const isMetadataPackageInstallation = (
{ resource }: ResolvedResourceQuery
): boolean => type === 'create' && resource === 'synchronization/metadataPull'

// POST to 'indicaators/expression/description' (validate an expression)
// POST to 'indicators/expression/description' or 'programIndicator/expression/description' (validate an expression)
export const isExpressionDescriptionValidation = (
type: FetchType,
{ resource }: ResolvedResourceQuery
): boolean =>
type === 'create' && resource === 'indicators/expression/description'
): boolean => {
const pattern = /^(indicators|programIndicators)\/expression\/description$/
return type === 'create' && pattern.test(resource)
}

0 comments on commit bc25458

Please sign in to comment.