Browse Source

ref(stores): Rename OrganizationActions.{fetchOrg -> reset} (#29246)

Evan Purkhiser 3 years ago
parent
commit
a239d5e10c

+ 1 - 1
static/app/actionCreators/organization.tsx

@@ -97,7 +97,7 @@ export async function fetchOrganizationDetails(
   isInitialFetch?: boolean
 ) {
   if (!silent) {
-    OrganizationActions.fetchOrg();
+    OrganizationActions.reset();
     ProjectActions.reset();
     GlobalSelectionActions.reset();
   }

+ 1 - 1
static/app/actions/organizationActions.tsx

@@ -1,3 +1,3 @@
 import Reflux from 'reflux';
 
-export default Reflux.createActions(['fetchOrg', 'fetchOrgError', 'update']);
+export default Reflux.createActions(['reset', 'fetchOrgError', 'update']);

+ 1 - 1
static/app/stores/organizationStore.tsx

@@ -31,7 +31,7 @@ const storeConfig: Reflux.StoreDefinition & OrganizationStoreInterface = {
   init() {
     this.reset();
     this.listenTo(OrganizationActions.update, this.onUpdate);
-    this.listenTo(OrganizationActions.fetchOrg, this.reset);
+    this.listenTo(OrganizationActions.reset, this.reset);
     this.listenTo(OrganizationActions.fetchOrgError, this.onFetchOrgError);
   },
 

+ 4 - 4
tests/js/spec/actionCreators/organization.spec.jsx

@@ -19,7 +19,7 @@ describe('OrganizationActionCreator', function () {
     MockApiClient.clearMockResponses();
     jest.spyOn(TeamActions, 'loadTeams');
     jest.spyOn(ProjectActions, 'loadProjects');
-    jest.spyOn(OrganizationActions, 'fetchOrg');
+    jest.spyOn(OrganizationActions, 'reset');
     jest.spyOn(OrganizationActions, 'update');
     jest.spyOn(OrganizationActions, 'fetchOrgError');
     jest.spyOn(OrganizationsActionCreator, 'setActiveOrganization');
@@ -47,7 +47,7 @@ describe('OrganizationActionCreator', function () {
     fetchOrganizationDetails(api, org.slug, false);
     await tick();
     await tick();
-    expect(OrganizationActions.fetchOrg).toHaveBeenCalled();
+    expect(OrganizationActions.reset).toHaveBeenCalled();
 
     expect(getOrgMock).toHaveBeenCalledWith(
       `/organizations/${org.slug}/`,
@@ -86,7 +86,7 @@ describe('OrganizationActionCreator', function () {
 
     fetchOrganizationDetails(api, org.slug, true, true);
     await tick();
-    expect(OrganizationActions.fetchOrg).not.toHaveBeenCalled();
+    expect(OrganizationActions.reset).not.toHaveBeenCalled();
 
     expect(getOrgMock).toHaveBeenCalledWith(
       `/organizations/${org.slug}/`,
@@ -116,7 +116,7 @@ describe('OrganizationActionCreator', function () {
 
     fetchOrganizationDetails(api, org.slug, false);
     await tick();
-    expect(OrganizationActions.fetchOrg).toHaveBeenCalled();
+    expect(OrganizationActions.reset).toHaveBeenCalled();
     expect(getOrgMock).toHaveBeenCalledWith(
       `/organizations/${org.slug}/`,
       expect.anything()