-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
30 lines (24 loc) · 933 Bytes
/
test.js
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
var assert = require('assert');
var XO = require('./index');
describe('Basic Mocha String Test', () => {
it('should return true if the number of Xs and Os are equal', () => {
assert.equal(XO('ooxx'), true);
assert.equal(XO('XocnsXo'), true);
assert.equal(XO('XoooxxXo'), true);
assert.equal(XO('XoXo'), true);
});
it('should return false if the number of Xs and Os are not equal', () => {
assert.equal(XO('xxxOooooo'), false);
assert.equal(XO('xxxx000O'), false);
});
it('should return true if no Xs and Os are present', () => {
assert.equal(XO('wdjewfhkYU'), true);
assert.equal(XO(''), true);
});
it('should return an error if no argument is provided', () => {
assert.equal(XO(), 'Please pass in the word to be tested');
});
it('should return an error if input is not a string is not provided', () => {
assert.equal(XO(642), 'Argument should be a string');
});
});