Skip to content

Commit

Permalink
tests: switch to using toContain() to check for substring presence (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Nov 2, 2020
1 parent e0b8fcd commit 71010cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/tests/unit/tooltip.spec.js
Expand Up @@ -317,7 +317,7 @@ describe('Tooltip', () => {

expect(tooltipShown).toBeDefined()
expect(tooltipEl.getAttribute('aria-describedby')).toEqual(tooltipShown.getAttribute('id'))
expect(tooltipShown.getAttribute('id').indexOf('tooltip') !== -1).toEqual(true)
expect(tooltipShown.getAttribute('id')).toContain('tooltip')
done()
})

Expand Down
8 changes: 4 additions & 4 deletions js/tests/unit/util/sanitizer.spec.js
Expand Up @@ -20,7 +20,7 @@ describe('Sanitizer', () => {

const result = sanitizeHtml(template, DefaultAllowlist, null)

expect(result.indexOf('script') === -1).toEqual(true)
expect(result).not.toContain('script')
})

it('should allow aria attributes and safe attributes', () => {
Expand All @@ -32,8 +32,8 @@ describe('Sanitizer', () => {

const result = sanitizeHtml(template, DefaultAllowlist, null)

expect(result.indexOf('aria-pressed') !== -1).toEqual(true)
expect(result.indexOf('class="test"') !== -1).toEqual(true)
expect(result).toContain('aria-pressed')
expect(result).toContain('class="test"')
})

it('should remove tags not in allowlist', () => {
Expand All @@ -45,7 +45,7 @@ describe('Sanitizer', () => {

const result = sanitizeHtml(template, DefaultAllowlist, null)

expect(result.indexOf('<script>') === -1).toEqual(true)
expect(result).not.toContain('<script>')
})

it('should not use native api to sanitize if a custom function passed', () => {
Expand Down

0 comments on commit 71010cb

Please sign in to comment.