forked from kriskbx/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kriskbx#126: Feat: Add noteable title to record
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const moment = require('moment'); | ||
const Config = require('../../src/include/config'); | ||
const Time = require('./../../src/models/time'); | ||
const issue = require('../../src/models/issue'); | ||
const mergeRequest = require('../../src/models/mergeRequest'); | ||
const expect = require('chai').expect; | ||
|
||
describe('time class', () => { | ||
it('Returns title of parent Issue', () => { | ||
const config = new Config(); | ||
const parent = new issue(config, {title: "Test title"}) | ||
const time = new Time('1h', moment(), {}, parent, config); | ||
|
||
expect(time.title).to.be.equal("Test title"); | ||
}); | ||
|
||
it('Returns title of parent MergeRequest', () => { | ||
const config = new Config(); | ||
const parent = new mergeRequest(config, {title: "Test title"}) | ||
const time = new Time('1h', moment(), {}, parent, config); | ||
|
||
expect(time.title).to.be.equal("Test title"); | ||
}); | ||
|
||
it('Returns Null for missed title or parent', () => { | ||
const config = new Config(); | ||
const parent = new mergeRequest(config, {}); | ||
let time; | ||
time = new Time('1h', moment(), {}, parent, config); | ||
expect(time.title).to.be.equal(null); | ||
|
||
time = new Time('1h', moment(), {}, null, config); | ||
expect(time.title).to.be.equal(null); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters