Commit 4381eab6 authored by Bryce Johnson's avatar Bryce Johnson

Simplify approvals store initialization.

parent d89d0dcf
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
(() => { (() => {
let singleton; let singleton;
class ApprovalsStore { class MergeRequestApprovalsStore {
constructor(rootStore) { constructor(rootStore) {
if (!singleton) { if (!singleton) {
singleton = gl.ApprovalsStore = this; singleton = this;
this.init(rootStore); this.init(rootStore);
} }
return singleton; return singleton;
...@@ -63,6 +63,6 @@ ...@@ -63,6 +63,6 @@
return this.rootStore.assignToData(key, data); return this.rootStore.assignToData(key, data);
} }
} }
gl.ApprovalsStore = ApprovalsStore; gl.MergeRequestApprovalsStore = MergeRequestApprovalsStore;
})(); })(window.gl || (window.gl = {}));
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
} }
initApprovals() { initApprovals() {
gl.ApprovalsStore = new gl.ApprovalsStore(this); gl.ApprovalsStore = new gl.MergeRequestApprovalsStore(this);
this.assignToData('approvals', {}); this.assignToData('approvals', {});
} }
......
...@@ -8,9 +8,6 @@ $.rails = { ...@@ -8,9 +8,6 @@ $.rails = {
}; };
(() => { (() => {
// store constructor reference, to overwrite ApprovalStore singleton
gl.ApprovalsConstructor = gl.ApprovalsStore;
// stand in for promise returned by api calls // stand in for promise returned by api calls
const mockThenable = { const mockThenable = {
then() { then() {
...@@ -34,7 +31,7 @@ $.rails = { ...@@ -34,7 +31,7 @@ $.rails = {
describe('Approvals Store', function () { describe('Approvals Store', function () {
beforeEach(function () { beforeEach(function () {
this.rootStore = mockRootStore; this.rootStore = mockRootStore;
this.approvalsStore = new gl.ApprovalsConstructor(this.rootStore); this.approvalsStore = new gl.MergeRequestApprovalsStore(this.rootStore);
}); });
it('should define all needed approval api calls', function () { it('should define all needed approval api calls', function () {
......
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