Commit b534a6c3 authored by Kushal Pandya's avatar Kushal Pandya

Add test for `updateIssueOrder`

parent c6d126b3
import RelatedIssuesStore from '~/issuable/related_issues/stores/related_issues_store';
const issuable1 = {
id: 200,
reference: 'foo/bar#123',
title: 'issue1',
path: '/foo/bar/issues/123',
state: 'opened',
relation_path: '/foo/bar/issues/123/related_issues/1',
};
const issuable2 = {
id: 201,
reference: 'foo/bar#124',
title: 'issue1',
path: '/foo/bar/issues/124',
state: 'opened',
relation_path: '/foo/bar/issues/124/related_issues/1',
};
import { issuable1, issuable2, issuable3, issuable4, issuable5 } from '../mock_data';
describe('RelatedIssuesStore', () => {
let store;
......@@ -58,6 +42,17 @@ describe('RelatedIssuesStore', () => {
});
});
describe('updateIssueOrder', () => {
it('updates issue order', () => {
const relatedIssues = [issuable1, issuable2, issuable3, issuable4, issuable5];
store.state.relatedIssues = relatedIssues;
expect(store.state.relatedIssues[3].id).toBe(issuable4.id);
store.updateIssueOrder(3, 0);
expect(store.state.relatedIssues[0].id).toBe(issuable4.id);
});
});
describe('setPendingReferences', () => {
it('defaults to empty array', () => {
expect(store.state.pendingReferences).toEqual([]);
......
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