mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-21 21:31:53 +02:00
28 lines
506 B
JavaScript
28 lines
506 B
JavaScript
|
|
/* IMPORT */
|
|
|
|
import {describe} from 'fava';
|
|
import {luminance} from '../../dist/index.js';
|
|
|
|
/* MAIN */
|
|
|
|
describe ( 'luminance', it => {
|
|
|
|
it ( 'gets the relative luminance of the color', t => {
|
|
|
|
const tests = [
|
|
['#000000', 0],
|
|
['#8a8a8a', .2541520943],
|
|
['#bbbbbb', .4969329951],
|
|
['#ffcc00', .6444573127],
|
|
['#e0e0e0', .7454042095],
|
|
['#ffffff', 1]
|
|
];
|
|
|
|
tests.forEach ( ([ color, output ]) => {
|
|
t.is ( luminance ( color ), output );
|
|
});
|
|
|
|
});
|
|
|
|
});
|