-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ed960d0
commit 83746ee
Showing
13 changed files
with
173 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) 2024 brittni and the polar bear LLC. | ||
* | ||
* This file is a part of brittni and the polar bear's Generative Art Library, | ||
* which is released under the GNU Affero General Public License, Version 3.0. | ||
* You may not use this file except in compliance with the license. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. See LICENSE or go to | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
*/ | ||
|
||
import {StringMap} from 'map'; | ||
import {Palette, PaletteColor} from 'palette'; | ||
import {ALL_PALETTES, MISCELLANEOUS_PALETTES} from 'palettes'; | ||
|
||
import { | ||
checkForPaletteInMap, | ||
checkForPaletteNameKeyMatch, | ||
checkForValidStringMap, | ||
checkForValidContrastMap | ||
} from 'unit-test/shared'; | ||
|
||
function getPaletteArray(map: StringMap<Palette>): {palette: Palette}[] { | ||
const palettes: Palette[] = Array.from(map.values); | ||
return palettes.map((p: Palette): {palette: Palette} => { | ||
return {palette: p} | ||
}); | ||
} | ||
|
||
const EXPECTED_PALETTES: {palette: Palette}[] = []; | ||
EXPECTED_PALETTES.push( | ||
...(getPaletteArray(MISCELLANEOUS_PALETTES)) | ||
); | ||
|
||
describe('all palettes tests', (): void => { | ||
test('valid string map: ALL_PALETTES', (): void => { | ||
checkForValidStringMap(ALL_PALETTES, EXPECTED_PALETTES.length); | ||
}); | ||
|
||
test.each( | ||
EXPECTED_PALETTES | ||
)('$# palette successfully added to map: $palette.NAME', | ||
({palette}): void => { | ||
checkForPaletteInMap(palette, ALL_PALETTES); | ||
} | ||
); | ||
|
||
test('all keys match associated palette name', (): void => { | ||
checkForPaletteNameKeyMatch(ALL_PALETTES); | ||
}); | ||
|
||
test.each( | ||
EXPECTED_PALETTES | ||
)('$# palette has valid contrast map: $palette.NAME', | ||
({palette}): void => { | ||
checkForValidContrastMap(palette); | ||
} | ||
); | ||
|
||
test('all palettes are unique', (): void => { | ||
const colorSets: Set<Set<string>> = new Set<Set<string>>(); | ||
|
||
for (const palette of ALL_PALETTES.values) { | ||
const hexStrings: string[] = palette.COLORS.map((color: PaletteColor): string => { | ||
return color.HEX; | ||
}); | ||
const hexSet: Set<string> = new Set<string>(hexStrings); | ||
|
||
expect(colorSets).not.toContainEqual(hexSet); | ||
colorSets.add(hexSet); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters