All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m56s
32 lines
741 B
TypeScript
32 lines
741 B
TypeScript
import { expect, test, describe } from 'vitest';
|
|
|
|
/**
|
|
* 单元测试: companyProfileMapper
|
|
*/
|
|
describe('companyProfileMapper', () => {
|
|
test('convert raw data to CompanyProfileView correctly', () => {
|
|
const rawData: CompanyProfile = {
|
|
id: 1,
|
|
translations: [
|
|
{ id: 10, content: 'This is raw data of company profile' },
|
|
],
|
|
};
|
|
|
|
expect(toCompanyProfileView(rawData)).toEqual({
|
|
id: 1,
|
|
content: 'This is raw data of company profile',
|
|
});
|
|
});
|
|
test('convert raw data with missing translations', () => {
|
|
const rawData: CompanyProfile = {
|
|
id: 1,
|
|
translations: [],
|
|
};
|
|
|
|
expect(toCompanyProfileView(rawData)).toEqual({
|
|
id: 1,
|
|
content: '',
|
|
});
|
|
});
|
|
});
|