updated itemDiary front unit test
This commit is contained in:
parent
14b85b874b
commit
d5e0d3beef
|
@ -40,10 +40,13 @@ describe('Item', () => {
|
||||||
|
|
||||||
describe('freeLineIndex()', () => {
|
describe('freeLineIndex()', () => {
|
||||||
it(`should call freeLineIndex() and return an index from line with alertLevel 0 and current date`, () => {
|
it(`should call freeLineIndex() and return an index from line with alertLevel 0 and current date`, () => {
|
||||||
|
let currentDate = new Date();
|
||||||
|
currentDate.setDate(currentDate.getDate() + 1);
|
||||||
|
|
||||||
controller.$scope.model = {data: [
|
controller.$scope.model = {data: [
|
||||||
{name: 'My item 1', alertLevel: 3, date: '2018-05-02'},
|
{name: 'My item 1', alertLevel: 3, date: '2018-05-02'},
|
||||||
{name: 'My item 2', alertLevel: 1, date: '2018-05-03'},
|
{name: 'My item 2', alertLevel: 1, date: '2018-05-03'},
|
||||||
{name: 'My item 3', alertLevel: 0, date: new Date()}]
|
{name: 'My item 3', alertLevel: 0, date: currentDate}]
|
||||||
};
|
};
|
||||||
let result = controller.freeLineIndex;
|
let result = controller.freeLineIndex;
|
||||||
|
|
||||||
|
@ -53,15 +56,17 @@ describe('Item', () => {
|
||||||
|
|
||||||
describe('onPreparationLineIndex()', () => {
|
describe('onPreparationLineIndex()', () => {
|
||||||
it(`should call onPreparationLineIndex() and return an index from line with alertLevel 1 and isPicked true`, () => {
|
it(`should call onPreparationLineIndex() and return an index from line with alertLevel 1 and isPicked true`, () => {
|
||||||
|
let currentDate = new Date();
|
||||||
|
currentDate.setDate(currentDate.getDate() + 1);
|
||||||
controller.$scope.model = {data: [
|
controller.$scope.model = {data: [
|
||||||
{name: 'My item 1', alertLevel: 3, isPicked: true, date: '2018-05-02'},
|
{name: 'My item 1', alertLevel: 3, isPicked: true, date: '2018-05-02'},
|
||||||
{name: 'My item 3', alertLevel: 1, isPicked: true, date: '2018-05-03'},
|
{name: 'My item 3', alertLevel: 1, isPicked: true, date: '2018-05-03'},
|
||||||
{name: 'My item 4', alertLevel: 1, isPicked: false, date: '2018-05-03'},
|
{name: 'My item 4', alertLevel: 1, isPicked: false, date: '2018-05-03'},
|
||||||
{name: 'My item 5', alertLevel: 0, isPicked: false, date: new Date()}]
|
{name: 'My item 5', alertLevel: 0, isPicked: false, date: currentDate}]
|
||||||
};
|
};
|
||||||
let result = controller.onPreparationLineIndex;
|
let result = controller.onPreparationLineIndex;
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue