Commit 7abb57d7 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'ph/fixLogsNotShowing' into 'master'

Fixes the file row not showing commits for certain projects

See merge request gitlab-org/gitlab!30647
parents 92ba74bc 7746467c
......@@ -3,6 +3,6 @@ import { normalizeData as normalizeDataFOSS } from '~/repository/utils/commit';
// eslint-disable-next-line import/prefer-default-export
export function normalizeData(data, path) {
return normalizeDataFOSS(data, path, d => ({
lockLabel: d.lock_label,
lockLabel: d.lock_label || false,
}));
}
---
title: Fixes file row commits not showing for certain projects
merge_request:
author:
type: fixed
......@@ -30,4 +30,23 @@ describe('normalizeData', () => {
},
]);
});
it('normalizes data into LogTreeCommit object with no lockLabel', () => {
const mock = [...mockData];
delete mock[0].lock_label;
expect(normalizeData(mock, '')).toEqual([
{
sha: '123',
message: 'testing message',
committedDate: '2019-01-01',
commitPath: 'https://test.com',
fileName: 'index.js',
filePath: '/index.js',
type: 'blob',
lockLabel: false,
__typename: 'LogTreeCommit',
},
]);
});
});
......@@ -86,16 +86,18 @@ describe('fetchLogsTree', () => {
it('calls entry resolver', () =>
fetchLogsTree(client, '', '0', resolver).then(() => {
expect(resolver.resolve).toHaveBeenCalledWith({
__typename: 'LogTreeCommit',
commitPath: 'https://test.com',
committedDate: '2019-01-01',
fileName: 'index.js',
filePath: '/index.js',
message: 'testing message',
sha: '123',
type: 'blob',
});
expect(resolver.resolve).toHaveBeenCalledWith(
expect.objectContaining({
__typename: 'LogTreeCommit',
commitPath: 'https://test.com',
committedDate: '2019-01-01',
fileName: 'index.js',
filePath: '/index.js',
message: 'testing message',
sha: '123',
type: 'blob',
}),
);
}));
it('writes query to client', () =>
......@@ -104,7 +106,7 @@ describe('fetchLogsTree', () => {
query: expect.anything(),
data: {
commits: [
{
expect.objectContaining({
__typename: 'LogTreeCommit',
commitPath: 'https://test.com',
committedDate: '2019-01-01',
......@@ -113,7 +115,7 @@ describe('fetchLogsTree', () => {
message: 'testing message',
sha: '123',
type: 'blob',
},
}),
],
},
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment