mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-10 17:43:51 +00:00
Fix shlink-web-component tests
This commit is contained in:
@@ -1,23 +1,9 @@
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import { formatDate, formatIsoDate, isBeforeOrEqual, isBetween, parseDate } from '../../../../src/utils/dates/helpers/date';
|
||||
import { formatIsoDate, isBeforeOrEqual, isBetween, parseDate } from '../../../../src/utils/dates/helpers/date';
|
||||
|
||||
describe('date', () => {
|
||||
const now = new Date();
|
||||
|
||||
describe('formatDate', () => {
|
||||
it.each([
|
||||
[parseDate('2020-03-05 10:00:10', 'yyyy-MM-dd HH:mm:ss'), 'dd/MM/yyyy', '05/03/2020'],
|
||||
[parseDate('2020-03-05 10:00:10', 'yyyy-MM-dd HH:mm:ss'), 'yyyy-MM', '2020-03'],
|
||||
[parseDate('2020-03-05 10:00:10', 'yyyy-MM-dd HH:mm:ss'), undefined, '2020-03-05'],
|
||||
['2020-03-05 10:00:10', 'dd-MM-yyyy', '2020-03-05 10:00:10'],
|
||||
['2020-03-05 10:00:10', undefined, '2020-03-05 10:00:10'],
|
||||
[undefined, undefined, undefined],
|
||||
[null, undefined, null],
|
||||
])('formats date as expected', (date, format, expected) => {
|
||||
expect(formatDate(format)(date)).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatIsoDate', () => {
|
||||
it.each([
|
||||
[
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import type { LocalStorage } from '../../../../src/utils/services/LocalStorage';
|
||||
import { MAIN_COLOR } from '../../../../src/utils/theme';
|
||||
import { ColorGenerator } from '../../../src/utils/services/ColorGenerator';
|
||||
import type { LocalStorage } from '../../../src/utils/services/LocalStorage';
|
||||
|
||||
describe('ColorGenerator', () => {
|
||||
let colorGenerator: ColorGenerator;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import type { OrderDir } from '../../../../shlink-frontend-kit/src/ordering/ordering';
|
||||
import type { OrderDir } from '../../../../shlink-frontend-kit/src';
|
||||
import { TableOrderIcon } from '../../../src/utils/table/TableOrderIcon';
|
||||
|
||||
describe('<TableOrderIcon />', () => {
|
||||
|
||||
Reference in New Issue
Block a user