2019-12-26 22:10:19 +05:30
|
|
|
import { normalizeData } from '~/repository/utils/commit';
|
|
|
|
|
|
|
|
const mockData = [
|
|
|
|
{
|
|
|
|
commit: {
|
|
|
|
id: '123',
|
|
|
|
message: 'testing message',
|
|
|
|
committed_date: '2019-01-01',
|
|
|
|
},
|
|
|
|
commit_path: `https://test.com`,
|
2020-05-24 23:13:21 +05:30
|
|
|
commit_title_html: 'testing message',
|
2019-12-26 22:10:19 +05:30
|
|
|
file_name: 'index.js',
|
|
|
|
type: 'blob',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
describe('normalizeData', () => {
|
|
|
|
it('normalizes data into LogTreeCommit object', () => {
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(normalizeData(mockData, '')).toEqual([
|
2019-12-26 22:10:19 +05:30
|
|
|
{
|
|
|
|
sha: '123',
|
|
|
|
message: 'testing message',
|
|
|
|
committedDate: '2019-01-01',
|
|
|
|
commitPath: 'https://test.com',
|
|
|
|
fileName: 'index.js',
|
2020-01-01 13:55:28 +05:30
|
|
|
filePath: '/index.js',
|
2019-12-26 22:10:19 +05:30
|
|
|
type: 'blob',
|
2020-05-24 23:13:21 +05:30
|
|
|
titleHtml: 'testing message',
|
2019-12-26 22:10:19 +05:30
|
|
|
__typename: 'LogTreeCommit',
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|