diff --git a/test/utils/services/ColorGenerator.test.ts b/test/utils/services/ColorGenerator.test.ts index 990b268e..b2d435ce 100644 --- a/test/utils/services/ColorGenerator.test.ts +++ b/test/utils/services/ColorGenerator.test.ts @@ -44,4 +44,19 @@ describe('ColorGenerator', () => { expect(storageMock.set).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 + }); + }); });