1
0

fix(natural language parser): parts of week days in other words

This commit is contained in:
kolaente
2021-09-26 15:00:11 +02:00
parent 403d77ce14
commit 4b64e27d2b
2 changed files with 35 additions and 2 deletions

View File

@ -247,6 +247,32 @@ describe('Parse Task Text', () => {
})
}
})
// This tests only standalone days are recognized and not things like "github", "monitor" or "renewed".
// We're not using real words here to generate tests for all days on the fly.
for (const d in days) {
it(`should not recognize ${d} with a space before it but none after it`, () => {
const text = `Lorem Ipsum ${d}ipsum`
const result = parseTaskText(text)
expect(result.text).toBe(text)
expect(result.date).toBeNull()
})
it(`should not recognize ${d} with a space after it but none before it`, () => {
const text = `Lorem ipsum${d} dolor`
const result = parseTaskText(text)
expect(result.text).toBe(text)
expect(result.date).toBeNull()
})
it(`should not recognize ${d} with no space before or after it`, () => {
const text = `Lorem Ipsum lorem${d}ipsum`
const result = parseTaskText(text)
expect(result.text).toBe(text)
expect(result.date).toBeNull()
})
}
})
describe('Parse date from text', () => {