1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00
unleash.unleash/src/lib/util/serialize-dates.test.ts
olav fdebeef929
feat: add OpenAPI validation to a few endpoints (#1409)
* feat: add OpenAPI validation to a few endpoints (2)

* refactor: use package version as the OpenAPI version

* refactor: keep the existing OpenAPI page for now

* refactor: add snapshots tests for the OpenAPI output

* refactor: validate Content-Type by default

* refactor: update vulnerable deps

* refactor: fix documentation URL to match schema

* refactor: improve external type declaration

* refactor: remove unused package resolutions

* refactor: try express-openapi fork

* Update package.json

* Update src/lib/services/openapi-service.ts

* Update src/lib/types/openapi.d.ts

* Update src/lib/types/openapi.d.ts

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-04-25 14:17:59 +02:00

17 lines
457 B
TypeScript

import { serializeDates } from './serialize-dates';
test('serializeDates', () => {
const obj = {
a: 1,
b: '2',
c: new Date(),
d: { e: new Date() },
};
expect(serializeDates({})).toEqual({});
expect(serializeDates(obj).a).toEqual(1);
expect(serializeDates(obj).b).toEqual('2');
expect(typeof serializeDates(obj).c).toEqual('string');
expect(typeof serializeDates(obj).d.e).toEqual('object');
});