mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 05:47:38 -02:30
Update unit tests.
This commit is contained in:
@@ -33,7 +33,8 @@ describe('Output | StreamService', () => {
|
|||||||
[250, [1, 2, 5, 10, 25, 50, 125, 250]]
|
[250, [1, 2, 5, 10, 25, 50, 125, 250]]
|
||||||
];
|
];
|
||||||
|
|
||||||
params.forEach(([size, expected]) => expect(stream.calcFactors(size)).toEqual(expected));
|
params.forEach(([size, expected]) =>
|
||||||
|
expect(stream.calcFactors(size)).toEqual(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -50,23 +51,18 @@ describe('Output | StreamService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('isReadyToRender', () => {
|
describe('isReadyToRender', () => {
|
||||||
it('returns false', () => {
|
it("it's never ready to render unless the result of getReadyCount is greater than 0", () => {
|
||||||
const res = stream.isReadyToRender();
|
const params = [
|
||||||
expect(res).toBe(false);
|
[-1, false],
|
||||||
|
[0, false],
|
||||||
|
[1, true]
|
||||||
|
];
|
||||||
|
const spy = spyOn(stream, 'getReadyCount');
|
||||||
|
|
||||||
|
params.forEach(([readyCount, expected]) => {
|
||||||
|
spy.and.returnValue(readyCount);
|
||||||
|
expect(stream.isReadyToRender()).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns true', () => {
|
|
||||||
stream.counters.min = 1;
|
|
||||||
stream.counters.ready = 2;
|
|
||||||
stream.state.ending = true;
|
|
||||||
let res = stream.isReadyToRender();
|
|
||||||
expect(res).toBe(true);
|
|
||||||
|
|
||||||
stream.counters.total = 1;
|
|
||||||
stream.framesPerRender = 1;
|
|
||||||
|
|
||||||
res = stream.isReadyToRender();
|
|
||||||
expect(res).toBe(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,10 +87,10 @@ describe('Output | StreamService', () => {
|
|||||||
[6, 5, 2]
|
[6, 5, 2]
|
||||||
];
|
];
|
||||||
|
|
||||||
params.forEach(([x, y, z]) => {
|
params.forEach(([max, min, expected]) => {
|
||||||
stream.counters.ready = x;
|
stream.counters.ready = max;
|
||||||
stream.counters.min = y;
|
stream.counters.min = min;
|
||||||
expect(stream.getReadyCount()).toEqual(z);
|
expect(stream.getReadyCount()).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user