typescript
typescript copied to clipboard
Exercise Word Count in Typescript. Tests are wrong
According with the instructions: Other than the apostrophe in a contraction all forms of punctuation are ignored
But for example in test:
it('includes punctuation', () => {
const expectedCounts = new Map(
Object.entries({
car: 1,
':': 2,
carpet: 1,
as: 1,
java: 1,
'javascript!!&@$%^&': 1,
})
)
expect(count('car : carpet as java : javascript!!&@$%^&')).toEqual(
expectedCounts
)
})
All the punctuation after the word javascript is not ignored The result should be:
{
car: 1,
carpet: 1,
as: 1,
java: 1,
javascript: 1,
}