mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Added test covering ColorGenerator.isColorLightForKey
This commit is contained in:
parent
b727a704a6
commit
aca9218f9d
1 changed files with 15 additions and 0 deletions
|
@ -44,4 +44,19 @@ describe('ColorGenerator', () => {
|
||||||
expect(storageMock.set).toHaveBeenCalledTimes(1);
|
expect(storageMock.set).toHaveBeenCalledTimes(1);
|
||||||
expect(storageMock.get).toHaveBeenCalledTimes(1);
|
expect(storageMock.get).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isColorLightForKey', () => {
|
||||||
|
it.each([
|
||||||
|
[ '#4696e5', true ], // Shlink brand color
|
||||||
|
[ '#8A661C', false ],
|
||||||
|
[ '#F7BE05', true ],
|
||||||
|
[ '#5A02D8', false ],
|
||||||
|
[ '#202786', false ],
|
||||||
|
])('returns that the color for a key is light based on the color assigned to that key', (color, isLight) => {
|
||||||
|
colorGenerator.setColorForKey('foo', color);
|
||||||
|
|
||||||
|
expect(isLight).toEqual(colorGenerator.isColorLightForKey('foo'));
|
||||||
|
expect(isLight).toEqual(colorGenerator.isColorLightForKey('foo')); // To cover when color is already calculated
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue