Skip to content

Commit c4625c5

Browse files
committed
fix: add test
1 parent 4f0d6c4 commit c4625c5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

projects/common/src/color/color-palette.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,26 @@ describe('Color palette', () => {
3131
expect(() => new ColorPalette(['black'])).toThrow();
3232
expect(() => new ColorPalette(['white', 'black'])).not.toThrow();
3333
});
34+
35+
test('should return color combinations correctly', () => {
36+
const palette = new ColorPalette(['#fffbeb', '#140300']);
37+
expect(palette.getColorCombinations(2)).toEqual([
38+
{
39+
background: 'rgb(255, 251, 235)',
40+
foreground: '#080909',
41+
},
42+
{
43+
background: 'rgb(20, 3, 0)',
44+
foreground: '#FFFFFF',
45+
}
46+
]);
47+
})
48+
49+
test('should generate color for a string as expected from a limited set', () => {
50+
const palette = new ColorPalette(['#fffbeb', '#140300', '#789ab7']);
51+
expect(palette.getColorCombinationForId(2, 'test')).toEqual({
52+
background: 'rgb(255, 251, 235)',
53+
foreground: '#080909',
54+
});
55+
})
3456
});

0 commit comments

Comments
 (0)