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:
authorFatih Acet <acetfatih@gmail.com>2019-01-26 02:56:53 +0300
committerFatih Acet <acetfatih@gmail.com>2019-01-31 01:18:19 +0300
commitf00c6db83f1f8b0bbb35230cfede0cfddfc9f7da (patch)
tree03c01119725f3fef09ab38e47c33190024265e96 /spec/javascripts/issue_show
parent4e40d72acff087b80b8919c2d96707807a43ce4b (diff)
Add new spec for updateStoreState method
Diffstat (limited to 'spec/javascripts/issue_show')
-rw-r--r--spec/javascripts/issue_show/components/app_spec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js
index 863d15570a0..c3f624aebd3 100644
--- a/spec/javascripts/issue_show/components/app_spec.js
+++ b/spec/javascripts/issue_show/components/app_spec.js
@@ -140,6 +140,7 @@ describe('Issuable output', () => {
describe('updateIssuable', () => {
it('fetches new data after update', done => {
+ spyOn(vm, 'updateStoreState').and.callThrough();
spyOn(vm.service, 'getData').and.callThrough();
spyOn(vm.service, 'updateIssuable').and.callFake(
() =>
@@ -155,6 +156,7 @@ describe('Issuable output', () => {
vm.updateIssuable()
.then(() => {
+ expect(vm.updateStoreState).toHaveBeenCalled();
expect(vm.service.getData).toHaveBeenCalled();
})
.then(done)
@@ -452,4 +454,20 @@ describe('Issuable output', () => {
expect(vm.$el.querySelector('.title-container .note-action-button')).toBeDefined();
});
});
+
+ describe('updateStoreState', () => {
+ it('should make a request and update the state of the store', done => {
+ const data = { foo: 1 };
+ spyOn(vm.store, 'updateState');
+ spyOn(vm.service, 'getData').and.returnValue(Promise.resolve({ data }));
+
+ vm.updateStoreState()
+ .then(() => {
+ expect(vm.service.getData).toHaveBeenCalled();
+ expect(vm.store.updateState).toHaveBeenCalledWith(data);
+ })
+ .then(done)
+ .catch(done.fail);
+ });
+ });
});