import type { MatcherFunction } from 'expect'; // eslint-disable-next-line func-names export const toHaveDataDate: MatcherFunction<[dataDate: unknown]> = function (actual, dataDate) { if (!(actual instanceof HTMLElement)) { throw new TypeError('These must be HTMLElement!'); } const actualDataDate = actual.getAttribute('data-date'); const pass = this.equals(actualDataDate, dataDate); const message = () => `${this.utils.matcherHint('toHaveDataDate', 'element')}\n\n` + `Expected element to have data-date attribute:\n ${this.utils.printExpected(dataDate)}\n` + `Received:\n ${this.utils.printReceived(actualDataDate)}`; return { message, pass, }; };