diff --git a/social-interaction/Note.mjs b/social-interaction/Note.mjs index 223f95d..7911cbf 100644 --- a/social-interaction/Note.mjs +++ b/social-interaction/Note.mjs @@ -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(){ diff --git a/test/Note.test.mjs b/test/Note.test.mjs index 23027ad..cd347b7 100644 --- a/test/Note.test.mjs +++ b/test/Note.test.mjs @@ -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')