-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_Commit.js
29 lines (23 loc) · 1.07 KB
/
test_Commit.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
var assert = require('assert');
import {CommitMapper} from '../../js/domain/CommitMapper';
import {Commit} from '../../js/domain/Commit';
var dummyResponse = require('../data/dummyCommitResponse.json');
describe('Commit', function () {
describe('setter and getter', function () {
it('should return correct data', function () {
let mapper = new CommitMapper(dummyResponse);
let commit = mapper.map({
"name": "b152859ca8d73f5c974c2264107fd0092af310d0",
"author": "John Doe",
"timestamp": 1485813773000,
"analyzed": true
});
assert.equal(commit.getName(), 'b152859ca8d73f5c974c2264107fd0092af310d0');
assert.equal(commit.getAuthor(), 'John Doe');
assert.equal(commit.getTimestamp(), 1485813773000);
assert.equal(commit.getAnalyzed(), true);
assert.equal(commit.getShortName().indexOf(commit.getName().substr(0, 7)), 0);
assert.equal(typeof commit.getFormattedDatetime(), 'string');
});
});
});