Adam Mills a723c62f4f Separate more JS util logic to be unit tested (#705)
* Move featureClassNames to js util

* Add tests for featureClassNames

* Strip empty feature class names

* Move canToggleDomain to js util

* Add tests for canToggleDomain

* Refactor canToggleDomain to ensure boolean return

* Switch to chai assert for richer syntax options

* Move canToggleState to js util

* Tests for canToggleState

* Enable linting for mocha tests

* Move stateCardType to js util

* Add tests for stateCardType

* Move stateMoreInfoType to js util

* Tests for stateMoreInfoType

* Include mdn Array includes polyfill
2017-12-03 20:56:16 -08:00

21 lines
601 B
JavaScript

import { assert } from 'chai';
import formatDateTime from '../../../js/common/util/format_date_time';
describe('formatDateTime', () => {
const dateObj = new Date(
2017, 10, 18,
11, 12, 13, 1400,
);
it('Formats English date times', () => {
assert.strictEqual(formatDateTime(dateObj, 'en'), 'November 18, 2017, 11:12 AM');
});
// Node only contains intl support for english formats. This test at least ensures
// the fallback to a different locale
it('Formats other date times', () => {
assert.strictEqual(formatDateTime(dateObj, 'fr'), '2017 M11 18 11:12');
});
});