forked from riktar/jkanban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jkanban.spec.js
49 lines (40 loc) · 1.17 KB
/
jkanban.spec.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require('./jkanban');
const initializeDom = () => {
document.body.innerHTML = '<div id="test"></div>';
}
beforeEach(() => {
initializeDom();
})
const makeSut = (additionalParams) => {
let options = {
element: "#test"
}
if (additionalParams !== undefined) {
for (var prop in additionalParams) {
options[prop] = additionalParams[prop];
}
}
let jkanban = new jKanban(options);
return jkanban;
}
describe('jKanban TestCase', () => {
test('Should init jKanban', async () => {
const sut = makeSut()
const expected = document.createElement("div")
expected.setAttribute("id", "test")
expected.innerHTML = "<div class=\"kanban-container\"></div>"
expect(sut.element).toStrictEqual(expected);
})
test('Should add a board with no items', async () => {
const boardName = "test-board"
const sut = makeSut({
boards: [
{
"id": boardName
}
]
})
expect(sut.findBoard(boardName)).not.toBeUndefined()
expect(sut.getBoardElements(boardName).length).toEqual(0)
})
});