jessgschueler / text-analyzer-tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Describe: wordCounter()

Test: "It should return 1 if a passage has just one word." Code: const text = "hello"; wordCounter(text); Expected Output: 1

Test: "It should return 2 if a passage has two words." Code: const text = "hello there"; wordCounter(text); Expected Output: 2

Test: "It should return 0 for an empty string." Code: wordCounter(""); Expected Output: 0

Test: "It should return 0 for a string that is only spaces." Code: wordCounter(" "); Expected Output: 0

Test: "It should not count numbers as words." Code: wordCounter("hi there 77 19"); Expected Output: 2

Describe: numberOfOccurrencesInText()

Test: "It should return 0 occurrences of a word for an empty string." Code: const text = ""; const word = "red"; numberOfOccurrencesInText(word, text); Expected Output: 0

Test: "It should return 1 occurrence of a word when the word and the text are the same." Code: const text = "red"; const word = "red"; numberOfOccurrencesInText(word, text); Expected Output: 1

Test: "It should return 0 occurrences of a word when the word and the text are different." Code: const text = "red"; const word = "blue"; numberOfOccurrencesInText(word, text); Expected Output: 0

Test: "It should return the number of occurrences of a word." Code: const text = "red blue red red red green"; const word = "red"; numberOfOccurrencesInText(word, text); Expected Output: 4

Test: "It should return a word match regardless of case." Code: const text = "red RED Red green Green GREEN"; const word = "Red"; numberOfOccurrencesInText(word, text); Expected Output: 3

Test: "It should return a word match regardless of punctuation." Code: const text = "Red! Red. I like red, green, and yellow."; const word = "Red"; numberOfOccurrencesInText(word, text); Expected Output: 3

Test: "If an empty string is passed in as a word, it should return 0." Code: const word = ""; const text = "red RED Red!"; wordCounter(word, text); Expected Output: 0

Describe: boldPassage()

Test: "It should return a non-matching word in a p tag." Code: const word = "hello"; const text = "yo"; boldPassage(word, text); Expected Output: "

yo

"

Test: "It should return a matching word in a b tag." Code: const word = "hello"; const text = "hello"; boldPassage(word, text); Expected Output: "

hello

"

Test: "It should return a matching word in a b tag." Code: const word = "hello"; const text = "hellooooo"; boldPassage(word, text); Expected Output: "

hellooooo

"

Test: "It should return a matching word in a b tag." Code: const word = "boy"; const text = "bigboy"; boldPassage(word, text); Expected Output: "

bigboy

"

Describe: mostCommonWords()

Test:"It should count each word in a passage" code: const text "hello there hello" mostCommonWords(text); Expected Output: [hello 2, there 1];

Test:"It should sort them by frequency" code: const text "camp camp hello hello hello there crab" mostCommonWords(text); Expected Output: [hello 3, camp 2, there 1, crab 1]

Test: "It should display word followed by frequency in

    ." code: mostCommonWords(text); Expected Outcome: Hello: 3 Camp: 2 There: 1 Crab: 1

    Describe: noOffensiveWords ()

    Test: "It should identify one of the offensive words." code: noOffensiveWords("zoinks") Expected Outcome: "Please put a dollar in the swear jar!"

    Test: "It should identify 'zoinks' in a string." code: noOffensiveWords("zoinks in a string") Expected Outcome: "Please put a dollar in the swear jar!"

    Test: "It should identify different offensive words in strings." code: noOffensiveWords("My father is a muppeteer") Expected Outcome: "Please put a dollar in the swear jar!"

About


Languages

Language:JavaScript 67.9%Language:HTML 32.1%