-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_CommitMapper.js
38 lines (32 loc) · 1.32 KB
/
test_CommitMapper.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
var assert = require('assert');
import {CommitMapper} from '../../js/domain/CommitMapper';
import {Commit} from '../../js/domain/Commit';
var dummyResponse = require('../data/dummyCommitResponse.json');
describe('CommitMapper', function () {
describe('mapAll', function () {
it('should map data to Commit objects', function () {
let mapper = new CommitMapper(dummyResponse);
mapper.mapAll();
assert.equal(mapper.objects.length, 4);
for (let obj of mapper.objects) {
assert.ok(obj instanceof Commit);
}
});
});
describe('map', function () {
it('should create a commit object from json data', function () {
let mapper = new CommitMapper(dummyResponse);
let commit = mapper.map({
"name": "b152859ca8d73f5c974c2264107fd0092af310d0",
"author": "John Doe",
"timestamp": 1485813773000,
"analyzed": true
});
assert.ok(commit instanceof Commit);
assert.equal(commit.getName(), 'b152859ca8d73f5c974c2264107fd0092af310d0');
assert.equal(commit.getAuthor(), 'John Doe');
assert.equal(commit.getTimestamp(), 1485813773000);
assert.equal(commit.getAnalyzed(), true);
});
});
});