Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vue_shared/components/source_viewer/source_viewer_new_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/source_viewer/source_viewer_new_spec.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/frontend/vue_shared/components/source_viewer/source_viewer_new_spec.js b/spec/frontend/vue_shared/components/source_viewer/source_viewer_new_spec.js
index 86dc9afaacc..745886161ce 100644
--- a/spec/frontend/vue_shared/components/source_viewer/source_viewer_new_spec.js
+++ b/spec/frontend/vue_shared/components/source_viewer/source_viewer_new_spec.js
@@ -42,6 +42,8 @@ describe('Source Viewer component', () => {
let wrapper;
let fakeApollo;
const CHUNKS_MOCK = [CHUNK_1, CHUNK_2];
+ const projectPath = 'test';
+ const currentRef = 'main';
const hash = '#L142';
const blameDataQueryHandlerSuccess = jest.fn().mockResolvedValue(BLAME_DATA_QUERY_RESPONSE_MOCK);
@@ -57,8 +59,8 @@ describe('Source Viewer component', () => {
propsData: {
blob: { ...blob, ...BLOB_DATA_MOCK },
chunks: CHUNKS_MOCK,
- projectPath: 'test',
- currentRef: 'main',
+ projectPath,
+ currentRef,
showBlame,
},
});
@@ -116,6 +118,18 @@ describe('Source Viewer component', () => {
expect(findBlameComponents().at(0).props()).toMatchObject({ blameInfo });
});
+ it('calls the blame data query', async () => {
+ await triggerChunkAppear();
+
+ expect(blameDataQueryHandlerSuccess).toHaveBeenCalledWith(
+ expect.objectContaining({
+ filePath: BLOB_DATA_MOCK.path,
+ fullPath: projectPath,
+ ref: currentRef,
+ }),
+ );
+ });
+
it('calls the query only once per chunk', async () => {
// We trigger the `appear` event multiple times here in order to simulate the user scrolling past the chunk more than once.
// In this scenario we only want to query the backend once.