Skip to content

Commit

Permalink
test(filter.clean): add test cases for empty space passed to filter c…
Browse files Browse the repository at this point in the history
…lean method

this was refactored a bit as suggested by tsc when typing everything up, in turn i think this is
resolved based on the test cases added for this use-case.

#168
  • Loading branch information
web-mech committed Aug 17, 2024
1 parent cda7723 commit c7d4878
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,43 @@ test('clean: Should not replace anything of a single and not profane word', (t)
const filter = new Filter()
t.is(filter.clean('áéñóú'), 'áéñóú')
})

test('clean: Should not throw exceptions when nothing but whitespace passed to filter', (t) => {
const filter = new Filter()
const testString = `
`

const testString2 = `
Hello
`

const testString3 = `
Fuck
`
t.is(filter.clean(testString), testString)
t.is(filter.clean(testString2), testString2)
t.is(
filter.clean(testString3),
`
****
`,
)
t.is(filter.clean(''), '')
})

0 comments on commit c7d4878

Please sign in to comment.