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/repository/commits_service_spec.js')
-rw-r--r--spec/frontend/repository/commits_service_spec.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/frontend/repository/commits_service_spec.js b/spec/frontend/repository/commits_service_spec.js
index 5fb683bd370..d779abcbfd6 100644
--- a/spec/frontend/repository/commits_service_spec.js
+++ b/spec/frontend/repository/commits_service_spec.js
@@ -14,7 +14,7 @@ describe('commits service', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
-
+ window.gon.features = { encodingLogsTree: true };
mock.onGet(url).reply(HTTP_STATUS_OK, [], {});
jest.spyOn(axios, 'get');
@@ -48,14 +48,27 @@ describe('commits service', () => {
});
it('encodes the path and ref', async () => {
- const encodedRef = encodeURIComponent(refWithSpecialCharMock);
- const encodedUrl = `/some-project/-/refs/${encodedRef}/logs_tree/with%20%24peci%40l%20ch%40rs%2F`;
+ const encodedRef = encodeURI(refWithSpecialCharMock);
+ const encodedUrl = `/some-project/-/refs/${encodedRef}/logs_tree/with%20$peci@l%20ch@rs/`;
await requestCommits(1, 'some-project', 'with $peci@l ch@rs/', refWithSpecialCharMock);
expect(axios.get).toHaveBeenCalledWith(encodedUrl, expect.anything());
});
+ describe('when encodingLogsTree FF is off', () => {
+ beforeEach(() => {
+ window.gon.features = {};
+ });
+
+ it('encodes the path and ref with encodeURIComponent', async () => {
+ const encodedRef = encodeURIComponent(refWithSpecialCharMock);
+ const encodedUrl = `/some-project/-/refs/${encodedRef}/logs_tree/with%20%24peci%40l%20ch%40rs%2F`;
+ await requestCommits(1, 'some-project', 'with $peci@l ch@rs/', refWithSpecialCharMock);
+ expect(axios.get).toHaveBeenCalledWith(encodedUrl, expect.anything());
+ });
+ });
+
it('calls axios get once per batch', async () => {
await Promise.all([requestCommits(0), requestCommits(1), requestCommits(23)]);