isRealWord now uses dictionary table
This commit is contained in:
parent
0f0e8a9b5d
commit
764be98422
|
@ -1,5 +1,5 @@
|
|||
import { isMisspelled } from "spellchecker"
|
||||
import logger from "../logger.mjs"
|
||||
import { wordExistsInDictionary } from "../database-calls/db.mjs"
|
||||
const sampleNote = {
|
||||
"id": "9id213fllx9y189f",
|
||||
"createdAt": "2023-08-13T13:37:09.537Z",
|
||||
|
@ -106,7 +106,7 @@ get isSingleWord() {
|
|||
}
|
||||
|
||||
get isRealWord(){
|
||||
return !isMisspelled(this.cleanText)
|
||||
return wordExistsInDictionary(this.cleanText)
|
||||
}
|
||||
|
||||
get author(){
|
||||
|
|
|
@ -119,20 +119,23 @@ describe("Testing Note getters", function () {
|
|||
expect(N1.isSingleWord).to.equal(true)
|
||||
done()
|
||||
})
|
||||
it("10. isRealWord should return true when text = 'word'", function (done) {
|
||||
it("10. isRealWord should return true when text = 'word'", async function () {
|
||||
N1.raw.text = "word"
|
||||
expect(N1.isRealWord).to.equal(true)
|
||||
done()
|
||||
const result = await N1.isRealWord
|
||||
expect(result).to.equal(true)
|
||||
|
||||
})
|
||||
it("11. isRealWord should return false when text = 'embiggensly'", function (done) {
|
||||
it("11. isRealWord should return false when text = 'embiggensly'", async function () {
|
||||
N1.raw.text = "embiggensly"
|
||||
expect(N1.isRealWord).to.equal(false)
|
||||
done()
|
||||
const result = await N1.isRealWord
|
||||
expect(result).to.equal(false)
|
||||
|
||||
})
|
||||
it("11.1 isRealWord should return false when text = 'awjfdihfeauigfieau'", function (done) {
|
||||
it("11.1 isRealWord should return false when text = 'awjfdihfeauigfieau'", async function () {
|
||||
N1.raw.text = "awjfdihfeauigfieau"
|
||||
expect(N1.isRealWord).to.equal(false)
|
||||
done()
|
||||
const result = await N1.isRealWord
|
||||
expect(result).to.equal(false)
|
||||
|
||||
})
|
||||
it("12. author should return a string", function (done) {
|
||||
expect(N1.author).is.a('string')
|
||||
|
|
Loading…
Reference in New Issue