diff --git a/packages/elastic-analytics/src/shippers/fullstory/format_payload.test.ts b/packages/elastic-analytics/src/shippers/fullstory/format_payload.test.ts index 962241f24f3af..4751e6db490e1 100644 --- a/packages/elastic-analytics/src/shippers/fullstory/format_payload.test.ts +++ b/packages/elastic-analytics/src/shippers/fullstory/format_payload.test.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import moment from 'moment'; import { formatPayload } from './format_payload'; describe('formatPayload', () => { @@ -70,18 +69,6 @@ describe('formatPayload', () => { }); }); - test('appends `_date` to moment values', () => { - const payload = { - foo: moment(), - baz: [moment()], - }; - - expect(formatPayload(payload)).toEqual({ - foo_date: payload.foo, - baz_dates: payload.baz, - }); - }); - test('supports nested values', () => { const payload = { nested: { diff --git a/packages/elastic-analytics/src/shippers/fullstory/format_payload.ts b/packages/elastic-analytics/src/shippers/fullstory/format_payload.ts index 3d660684e337e..c55ed2409da50 100644 --- a/packages/elastic-analytics/src/shippers/fullstory/format_payload.ts +++ b/packages/elastic-analytics/src/shippers/fullstory/format_payload.ts @@ -51,14 +51,10 @@ function getFullStoryType(value: unknown) { // For arrays, make the decision based on the first element const isArray = Array.isArray(value); const v = isArray ? value[0] : value; - let type = ''; + let type: string; switch (typeof v) { case 'string': - if (moment(v, moment.ISO_8601, true).isValid()) { - type = 'date'; - break; - } - type = 'str'; + type = moment(v, moment.ISO_8601, true).isValid() ? 'date' : 'str'; break; case 'number': type = Number.isInteger(v) ? 'int' : 'real'; @@ -84,5 +80,5 @@ function isRecord(value: unknown): value is Record { } function isDate(value: unknown): value is Date { - return value instanceof Date || moment.isMoment(value); + return value instanceof Date; } diff --git a/packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.mocks.ts b/packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.test.mocks.ts similarity index 100% rename from packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.mocks.ts rename to packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.test.mocks.ts diff --git a/packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.test.ts b/packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.test.ts index c146a216fc5ac..67797a629c828 100644 --- a/packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.test.ts +++ b/packages/elastic-analytics/src/shippers/fullstory/fullstory_shipper.test.ts @@ -7,7 +7,7 @@ */ import { loggerMock } from '@kbn/logging-mocks'; -import { fullStoryApiMock } from './fullstory_shipper.mocks'; +import { fullStoryApiMock } from './fullstory_shipper.test.mocks'; import { FullStoryShipper } from './fullstory_shipper'; describe('FullStoryShipper', () => {