|
@@ -3,18 +3,16 @@ import {ProjectFixture} from 'sentry-fixture/project';
|
|
|
import {TeamFixture} from 'sentry-fixture/team';
|
|
|
|
|
|
import {updateOnboardingTask} from 'sentry/actionCreators/onboardingTasks';
|
|
|
-import {updateOrganization} from 'sentry/actionCreators/organizations';
|
|
|
import ConfigStore from 'sentry/stores/configStore';
|
|
|
+import OrganizationStore from 'sentry/stores/organizationStore';
|
|
|
import {OnboardingTaskKey} from 'sentry/types';
|
|
|
|
|
|
-jest.mock('sentry/actionCreators/organizations', () => ({
|
|
|
- updateOrganization: jest.fn(),
|
|
|
-}));
|
|
|
-
|
|
|
describe('actionCreators/onboardingTasks', function () {
|
|
|
const api = new MockApiClient();
|
|
|
const user = ConfigStore.get('user');
|
|
|
|
|
|
+ jest.spyOn(OrganizationStore, 'onUpdate');
|
|
|
+
|
|
|
describe('updateOnboardingTask', function () {
|
|
|
it('Adds the task to the organization when task does not exists', async function () {
|
|
|
const detailedOrg = OrganizationFixture({
|
|
@@ -39,7 +37,7 @@ describe('actionCreators/onboardingTasks', function () {
|
|
|
|
|
|
expect(mockUpdate).toHaveBeenCalled();
|
|
|
|
|
|
- expect(updateOrganization).toHaveBeenCalledWith({
|
|
|
+ expect(OrganizationStore.onUpdate).toHaveBeenCalledWith({
|
|
|
onboardingTasks: [{...testTask, user}],
|
|
|
});
|
|
|
});
|
|
@@ -70,7 +68,7 @@ describe('actionCreators/onboardingTasks', function () {
|
|
|
|
|
|
// NOTE: user is not passed as it is already associated to the existing
|
|
|
// onboarding task.
|
|
|
- expect(updateOrganization).toHaveBeenCalledWith({
|
|
|
+ expect(OrganizationStore.onUpdate).toHaveBeenCalledWith({
|
|
|
onboardingTasks: [testTask],
|
|
|
});
|
|
|
});
|
|
@@ -95,7 +93,7 @@ describe('actionCreators/onboardingTasks', function () {
|
|
|
await tick();
|
|
|
|
|
|
expect(mockUpdate).not.toHaveBeenCalled();
|
|
|
- expect(updateOrganization).toHaveBeenCalledWith({
|
|
|
+ expect(OrganizationStore.onUpdate).toHaveBeenCalledWith({
|
|
|
onboardingTasks: [{...testTask, user}],
|
|
|
});
|
|
|
});
|