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:
authorPhil Hughes <me@iamphill.com>2019-07-01 13:40:29 +0300
committerPhil Hughes <me@iamphill.com>2019-07-01 13:40:29 +0300
commit12413158fddf093e9b2cc8d00d66f8c6833a260c (patch)
tree43145fa434253b12c382812e0477a55155a3346c /spec/frontend
parent8775e4a1faf13a01451e71ea9ef729dc52e6d3c1 (diff)
Fetch branch diverging counts from API
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/46139
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/branches/divergence_graph_spec.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/frontend/branches/divergence_graph_spec.js b/spec/frontend/branches/divergence_graph_spec.js
new file mode 100644
index 00000000000..4ed77c3a036
--- /dev/null
+++ b/spec/frontend/branches/divergence_graph_spec.js
@@ -0,0 +1,32 @@
+import MockAdapter from 'axios-mock-adapter';
+import axios from '~/lib/utils/axios_utils';
+import init from '~/branches/divergence_graph';
+
+describe('Divergence graph', () => {
+ let mock;
+
+ beforeEach(() => {
+ mock = new MockAdapter(axios);
+
+ mock.onGet('/-/diverging_counts').reply(200, {
+ master: { ahead: 1, behind: 1 },
+ });
+
+ jest.spyOn(axios, 'get');
+
+ document.body.innerHTML = `
+ <div class="js-branch-item" data-name="master"></div>
+ `;
+ });
+
+ afterEach(() => {
+ mock.restore();
+ });
+
+ it('calls axos get with list of branch names', () =>
+ init('/-/diverging_counts').then(() => {
+ expect(axios.get).toHaveBeenCalledWith('/-/diverging_counts', {
+ params: { names: ['master'] },
+ });
+ }));
+});