import { getProminentColor, rgbToHex } from './image.js' import { expect } from 'chai' import { describe } from 'mocha' import path from 'node:path' describe('image', function () { describe('getProminentColor', function () { it('should get a {String} hex code color', async function () { const color = await getProminentColor(path.join(import.meta.dirname, './fixtures/sample.webp')) expect(color).to.equal('#0878a8') }) }) describe('rgbToHex', function () { it('should convert color to hex {String} hexidecimal code', function () { const mulberry = [255, 87, 51] const screaminGreen = [77, 255, 106] const amaranth = [227, 64, 81] expect(rgbToHex(...mulberry)).to.equal('#ff5733') expect(rgbToHex(...screaminGreen)).to.equal('#4dff6a') expect(rgbToHex(...amaranth)).to.equal('#e34051') }) }) })