mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-14 03:23:49 +00:00
Replaced most of the usages of moment with date-fns
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import moment from 'moment';
|
||||
import Moment from 'react-moment';
|
||||
import { assoc, toString } from 'ramda';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import { ExternalLink } from 'react-external-link';
|
||||
import { formatISO, parse } from 'date-fns';
|
||||
import createShortUrlsRow from '../../../src/short-urls/helpers/ShortUrlsRow';
|
||||
import Tag from '../../../src/tags/helpers/Tag';
|
||||
import ColorGenerator from '../../../src/utils/services/ColorGenerator';
|
||||
@@ -11,6 +10,7 @@ import { StateFlagTimeout } from '../../../src/utils/helpers/hooks';
|
||||
import { ShortUrl } from '../../../src/short-urls/data';
|
||||
import { ReachableServer } from '../../../src/servers/data';
|
||||
import { CopyToClipboardIcon } from '../../../src/utils/CopyToClipboardIcon';
|
||||
import { Time } from '../../../src/utils/Time';
|
||||
|
||||
describe('<ShortUrlsRow />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
@@ -27,7 +27,7 @@ describe('<ShortUrlsRow />', () => {
|
||||
shortCode: 'abc123',
|
||||
shortUrl: 'http://doma.in/abc123',
|
||||
longUrl: 'http://foo.com/bar',
|
||||
dateCreated: moment('2018-05-23 18:30:41').format(),
|
||||
dateCreated: formatISO(parse('2018-05-23 18:30:41', 'yyyy-MM-dd HH:mm:ss', new Date())),
|
||||
tags: [ 'nodejs', 'reactjs' ],
|
||||
visitsCount: 45,
|
||||
domain: null,
|
||||
@@ -62,9 +62,9 @@ describe('<ShortUrlsRow />', () => {
|
||||
|
||||
it('renders date in first column', () => {
|
||||
const col = wrapper.find('td').first();
|
||||
const moment = col.find(Moment);
|
||||
const date = col.find(Time);
|
||||
|
||||
expect(moment.html()).toContain('>2018-05-23 18:30</time>');
|
||||
expect(date.html()).toContain('>2018-05-23 18:30</time>');
|
||||
});
|
||||
|
||||
it('renders short URL in second row', () => {
|
||||
|
||||
Reference in New Issue
Block a user