feat: Add app config serializer

This commit is contained in:
Faruk AYDIN
2024-03-07 14:11:00 +01:00
parent 3d6847a3a2
commit 79a792ac62
3 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { createAppConfig } from '../../test/factories/app-config';
import appConfigSerializer from './app-config';
describe('appConfig serializer', () => {
let appConfig;
beforeEach(async () => {
appConfig = await createAppConfig();
});
it('should return app config data', async () => {
const expectedPayload = {
id: appConfig.id,
key: appConfig.key,
allowCustomConnection: appConfig.allowCustomConnection,
shared: appConfig.shared,
disabled: appConfig.disabled,
canConnect: appConfig.canConnect,
canCustomConnect: appConfig.canCustomConnect,
createdAt: appConfig.createdAt.getTime(),
updatedAt: appConfig.updatedAt.getTime(),
};
expect(appConfigSerializer(appConfig)).toEqual(expectedPayload);
});
});