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'; ...@@ -3,6 +3,6 @@ import { normalizeData as normalizeDataFOSS } from '~/repository/utils/commit';
// eslint-disable-next-line import/prefer-default-export // eslint-disable-next-line import/prefer-default-export
export function normalizeData(data, path) { export function normalizeData(data, path) {
return normalizeDataFOSS(data, path, d => ({ 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', () => { ...@@ -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', () => { ...@@ -86,16 +86,18 @@ describe('fetchLogsTree', () => {
it('calls entry resolver', () => it('calls entry resolver', () =>
fetchLogsTree(client, '', '0', resolver).then(() => { fetchLogsTree(client, '', '0', resolver).then(() => {
expect(resolver.resolve).toHaveBeenCalledWith({ expect(resolver.resolve).toHaveBeenCalledWith(
__typename: 'LogTreeCommit', expect.objectContaining({
commitPath: 'https://test.com', __typename: 'LogTreeCommit',
committedDate: '2019-01-01', commitPath: 'https://test.com',
fileName: 'index.js', committedDate: '2019-01-01',
filePath: '/index.js', fileName: 'index.js',
message: 'testing message', filePath: '/index.js',
sha: '123', message: 'testing message',
type: 'blob', sha: '123',
}); type: 'blob',
}),
);
})); }));
it('writes query to client', () => it('writes query to client', () =>
...@@ -104,7 +106,7 @@ describe('fetchLogsTree', () => { ...@@ -104,7 +106,7 @@ describe('fetchLogsTree', () => {
query: expect.anything(), query: expect.anything(),
data: { data: {
commits: [ commits: [
{ expect.objectContaining({
__typename: 'LogTreeCommit', __typename: 'LogTreeCommit',
commitPath: 'https://test.com', commitPath: 'https://test.com',
committedDate: '2019-01-01', committedDate: '2019-01-01',
...@@ -113,7 +115,7 @@ describe('fetchLogsTree', () => { ...@@ -113,7 +115,7 @@ describe('fetchLogsTree', () => {
message: 'testing message', message: 'testing message',
sha: '123', sha: '123',
type: 'blob', 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