Merge pull request #1604 from automatisch/test-role-serializer

test: Add tests for role serializer
This commit is contained in:
Ömer Faruk Aydın
2024-02-16 12:40:59 +01:00
committed by GitHub

View File

@@ -0,0 +1,25 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { createRole } from '../../test/factories/role';
import roleSerializer from './role';
describe('roleSerializer', () => {
let role;
beforeEach(async () => {
role = await createRole();
});
it('should return role data', async () => {
const expectedPayload = {
id: role.id,
name: role.name,
key: role.key,
description: role.description,
createdAt: role.createdAt,
updatedAt: role.updatedAt,
isAdmin: role.isAdmin,
};
expect(roleSerializer(role)).toEqual(expectedPayload);
});
});