-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathwords-utility-tests.js
More file actions
45 lines (30 loc) · 1.53 KB
/
words-utility-tests.js
File metadata and controls
45 lines (30 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var theWords = "A Unit Test is a piece of code that is using your code, exercising some scenarios that it expects to work in a certain way. Unit tests are isolated from external dependencies unlike integration tests. We will focus on Unit Tests.";
QUnit.test( "test if words are counted correctly", function( assert ) {
var wordsUtility = new WordsUtility(theWords);
assert.equal(wordsUtility.countWords(), 41);
});
QUnit.test( "find the longest word", function( assert ) {
var wordsUtility = new WordsUtility(theWords);
assert.equal(wordsUtility.longestWord(), "dependencies");
});
QUnit.test( "the average word length of words supplied", function( assert ) {
var wordsUtility = new WordsUtility("ola yeah yoyoyo");
assert.equal(wordsUtility.averageWordLength(), "ola");
});
QUnit.test( "find words with the same length", function( assert ) {
var wordsUtility = new WordsUtility("ola yeah yoyoyo yoda");
var words = wordsUtility.wordsWithTheSameLength();
});
QUnit.test( "no words with the same length return nothing", function( assert ) {
var wordsUtility = new WordsUtility("ola yeah yoyoyo yoda");
assert.equal(0, wordsUtility.wordsWithTheSameLength().length);
});
QUnit.test( "find the shortest word", function( assert ) {
var wordsUtility = new WordsUtility(theWords);
assert.equal(wordsUtility.shortestWord(), "A");
});
QUnit.jUnitReport = function(report) {
console.log(report.xml);
};
//create a test for What letter does the most words start with
//create a test for What letter does the most words end with