mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
feat: show formatted dates instead of epoch on results (#10268)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import {
|
||||
applyFormattingToTabularData,
|
||||
optionFromValue,
|
||||
prepareCopyToClipboardTabularData,
|
||||
NULL_STRING,
|
||||
@@ -57,4 +58,28 @@ describe('utils/common', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('applyFormattingToTabularData', () => {
|
||||
it('does not mutate empty array', () => {
|
||||
const data = [];
|
||||
expect(applyFormattingToTabularData(data)).toEqual(data);
|
||||
});
|
||||
it('does not mutate array without temporal column', () => {
|
||||
const data = [
|
||||
{ column1: 'lorem', column2: 'ipsum' },
|
||||
{ column1: 'dolor', column2: 'sit', column3: 'amet' },
|
||||
];
|
||||
expect(applyFormattingToTabularData(data)).toEqual(data);
|
||||
});
|
||||
it('changes formatting of temporal column', () => {
|
||||
const originalData = [
|
||||
{ __timestamp: 1594285437771, column1: 'lorem' },
|
||||
{ __timestamp: 1594285441675, column1: 'ipsum' },
|
||||
];
|
||||
const expectedData = [
|
||||
{ __timestamp: '2020-07-09 09:03:57', column1: 'lorem' },
|
||||
{ __timestamp: '2020-07-09 09:04:01', column1: 'ipsum' },
|
||||
];
|
||||
expect(applyFormattingToTabularData(originalData)).toEqual(expectedData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user