groupingStore.spec.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. import * as GroupActionCreators from 'sentry/actionCreators/group';
  2. import GroupingStore from 'sentry/stores/groupingStore';
  3. describe('Grouping Store', function () {
  4. let trigger;
  5. beforeAll(function () {
  6. MockApiClient.asyncDelay = 1;
  7. });
  8. afterAll(function () {
  9. MockApiClient.asyncDelay = undefined;
  10. });
  11. beforeEach(function () {
  12. GroupingStore.init();
  13. trigger = jest.spyOn(GroupingStore, 'trigger');
  14. MockApiClient.addMockResponse({
  15. url: '/issues/groupId/hashes/',
  16. body: [
  17. {
  18. latestEvent: {
  19. eventID: 'event-1',
  20. },
  21. state: 'locked',
  22. id: '1',
  23. },
  24. {
  25. latestEvent: {
  26. eventID: 'event-2',
  27. },
  28. state: 'unlocked',
  29. id: '2',
  30. },
  31. {
  32. latestEvent: {
  33. eventID: 'event-3',
  34. },
  35. state: 'unlocked',
  36. id: '3',
  37. },
  38. {
  39. latestEvent: {
  40. eventID: 'event-4',
  41. },
  42. state: 'unlocked',
  43. id: '4',
  44. },
  45. {
  46. latestEvent: {
  47. eventID: 'event-5',
  48. },
  49. state: 'locked',
  50. id: '5',
  51. },
  52. ],
  53. });
  54. MockApiClient.addMockResponse({
  55. url: '/issues/groupId/similar/',
  56. body: [
  57. [
  58. {
  59. id: '274',
  60. },
  61. {
  62. 'exception:stacktrace:pairs': 0.375,
  63. 'exception:stacktrace:application-chunks': 0.175,
  64. 'message:message:character-shingles': 0.775,
  65. },
  66. ],
  67. [
  68. {
  69. id: '275',
  70. },
  71. {'exception:stacktrace:pairs': 1.0},
  72. ],
  73. [
  74. {
  75. id: '216',
  76. },
  77. {
  78. 'exception:stacktrace:application-chunks': 0.000235,
  79. 'exception:stacktrace:pairs': 0.001488,
  80. },
  81. ],
  82. [
  83. {
  84. id: '217',
  85. },
  86. {
  87. 'exception:message:character-shingles': null,
  88. 'exception:stacktrace:application-chunks': 0.25,
  89. 'exception:stacktrace:pairs': 0.25,
  90. 'message:message:character-shingles': 0.7,
  91. },
  92. ],
  93. ],
  94. });
  95. });
  96. afterEach(function () {
  97. MockApiClient.clearMockResponses();
  98. jest.resetAllMocks();
  99. jest.restoreAllMocks();
  100. });
  101. describe('onFetch()', function () {
  102. beforeEach(() => GroupingStore.init());
  103. it('initially gets called with correct state values', function () {
  104. GroupingStore.onFetch([]);
  105. expect(trigger).toHaveBeenCalled();
  106. expect(trigger).toHaveBeenCalledWith(
  107. expect.objectContaining({
  108. error: false,
  109. filteredSimilarItems: [],
  110. loading: true,
  111. mergeState: new Map(),
  112. mergedItems: [],
  113. mergedLinks: '',
  114. similarItems: [],
  115. similarLinks: '',
  116. unmergeState: new Map(),
  117. })
  118. );
  119. });
  120. it('fetches list of similar items', async function () {
  121. await GroupingStore.onFetch([
  122. {dataKey: 'similar', endpoint: '/issues/groupId/similar/'},
  123. ]);
  124. expect(trigger).toHaveBeenCalled();
  125. const calls = trigger.mock.calls;
  126. const arg: any = calls[calls.length - 1][0];
  127. expect(arg.filteredSimilarItems).toHaveLength(1);
  128. expect(arg.similarItems).toHaveLength(3);
  129. expect(arg).toMatchObject({
  130. loading: false,
  131. error: false,
  132. mergeState: new Map(),
  133. mergedItems: [],
  134. similarItems: [
  135. {
  136. isBelowThreshold: false,
  137. issue: {
  138. id: '274',
  139. },
  140. },
  141. {
  142. isBelowThreshold: false,
  143. issue: {
  144. id: '275',
  145. },
  146. },
  147. {
  148. isBelowThreshold: false,
  149. issue: {
  150. id: '217',
  151. },
  152. },
  153. ],
  154. filteredSimilarItems: [
  155. {
  156. isBelowThreshold: true,
  157. issue: {
  158. id: '216',
  159. },
  160. },
  161. ],
  162. unmergeState: new Map(),
  163. });
  164. });
  165. it('unsuccessfully fetches list of similar items', function () {
  166. MockApiClient.clearMockResponses();
  167. MockApiClient.addMockResponse({
  168. url: '/issues/groupId/similar/',
  169. statusCode: 500,
  170. body: {message: 'failed'},
  171. });
  172. const promise = GroupingStore.onFetch([
  173. {dataKey: 'similar', endpoint: '/issues/groupId/similar/'},
  174. ]);
  175. expect(trigger).toHaveBeenCalled();
  176. const calls = trigger.mock.calls;
  177. return promise.then(() => {
  178. const arg = calls[calls.length - 1][0];
  179. expect(arg).toMatchObject({
  180. loading: false,
  181. error: true,
  182. mergeState: new Map(),
  183. mergedItems: [],
  184. unmergeState: new Map(),
  185. });
  186. });
  187. });
  188. it('ignores null scores in aggregate', async function () {
  189. await GroupingStore.onFetch([
  190. {dataKey: 'similar', endpoint: '/issues/groupId/similar/'},
  191. ]);
  192. expect(trigger).toHaveBeenCalled();
  193. const calls = trigger.mock.calls;
  194. const arg: any = calls[calls.length - 1][0];
  195. const item = arg.similarItems.find(({issue}) => issue.id === '217');
  196. expect(item.aggregate.exception).toBe(0.25);
  197. expect(item.aggregate.message).toBe(0.7);
  198. });
  199. it('fetches list of hashes', function () {
  200. const promise = GroupingStore.onFetch([
  201. {dataKey: 'merged', endpoint: '/issues/groupId/hashes/'},
  202. ]);
  203. expect(trigger).toHaveBeenCalled();
  204. const calls = trigger.mock.calls;
  205. return promise.then(() => {
  206. const arg = calls[calls.length - 1][0];
  207. expect(arg.mergedItems).toHaveLength(5);
  208. expect(arg).toMatchObject({
  209. loading: false,
  210. error: false,
  211. similarItems: [],
  212. filteredSimilarItems: [],
  213. mergeState: new Map(),
  214. unmergeState: new Map([
  215. ['1', {busy: true}],
  216. ['2', {busy: false}],
  217. ['3', {busy: false}],
  218. ['4', {busy: false}],
  219. ['5', {busy: true}],
  220. ]),
  221. });
  222. });
  223. });
  224. it('unsuccessfully fetches list of hashes items', function () {
  225. MockApiClient.clearMockResponses();
  226. MockApiClient.addMockResponse({
  227. url: '/issues/groupId/hashes/',
  228. statusCode: 500,
  229. body: {message: 'failed'},
  230. });
  231. const promise = GroupingStore.onFetch([
  232. {dataKey: 'merged', endpoint: '/issues/groupId/hashes/'},
  233. ]);
  234. expect(trigger).toHaveBeenCalled();
  235. const calls = trigger.mock.calls;
  236. return promise.then(() => {
  237. const arg = calls[calls.length - 1][0];
  238. expect(arg).toMatchObject({
  239. loading: false,
  240. error: true,
  241. mergeState: new Map(),
  242. mergedItems: [],
  243. unmergeState: new Map(),
  244. });
  245. });
  246. });
  247. });
  248. describe('Similar Issues list (to be merged)', function () {
  249. let mergeList: (typeof GroupingStore)['state']['mergeList'];
  250. let mergeState: (typeof GroupingStore)['state']['mergeState'];
  251. beforeEach(function () {
  252. GroupingStore.init();
  253. mergeList = [];
  254. mergeState = new Map();
  255. GroupingStore.onFetch([{dataKey: 'similar', endpoint: '/issues/groupId/similar/'}]);
  256. });
  257. describe('onToggleMerge (checkbox state)', function () {
  258. // Attempt to check first item but its "locked" so should not be able to do anything
  259. it('can check and uncheck item', function () {
  260. GroupingStore.onToggleMerge('1');
  261. mergeList = ['1'];
  262. mergeState.set('1', {checked: true});
  263. expect(GroupingStore.getState().mergeList).toEqual(mergeList);
  264. expect(GroupingStore.getState().mergeState).toEqual(mergeState);
  265. // Uncheck
  266. GroupingStore.onToggleMerge('1');
  267. mergeList = mergeList.filter(item => item !== '1');
  268. mergeState.set('1', {checked: false});
  269. // Check all
  270. GroupingStore.onToggleMerge('1');
  271. GroupingStore.onToggleMerge('2');
  272. GroupingStore.onToggleMerge('3');
  273. mergeList = ['1', '2', '3'];
  274. mergeState.set('1', {checked: true});
  275. mergeState.set('2', {checked: true});
  276. mergeState.set('3', {checked: true});
  277. expect(GroupingStore.getState().mergeList).toEqual(mergeList);
  278. expect(GroupingStore.getState().mergeState).toEqual(mergeState);
  279. expect(trigger).toHaveBeenLastCalledWith({
  280. mergeDisabled: false,
  281. mergeList,
  282. mergeState,
  283. });
  284. });
  285. });
  286. describe('onMerge', function () {
  287. beforeEach(function () {
  288. MockApiClient.clearMockResponses();
  289. MockApiClient.addMockResponse({
  290. method: 'PUT',
  291. url: '/projects/orgId/projectId/issues/',
  292. });
  293. GroupingStore.init();
  294. });
  295. it('disables rows to be merged', async function () {
  296. const mergeMock = jest.spyOn(GroupActionCreators, 'mergeGroups');
  297. trigger.mockReset();
  298. GroupingStore.onToggleMerge('1');
  299. mergeList = ['1'];
  300. mergeState.set('1', {checked: true});
  301. expect(trigger).toHaveBeenLastCalledWith(
  302. expect.objectContaining({
  303. mergeDisabled: false,
  304. mergeList,
  305. mergeState,
  306. })
  307. );
  308. trigger.mockReset();
  309. // Everything is sync so trigger will have been called multiple times
  310. const promise = GroupingStore.onMerge({
  311. params: {
  312. orgId: 'orgId',
  313. groupId: 'groupId',
  314. },
  315. projectId: 'projectId',
  316. });
  317. mergeState.set('1', {checked: true, busy: true});
  318. expect(trigger).toHaveBeenCalledWith(
  319. expect.objectContaining({
  320. mergeDisabled: true,
  321. mergeList,
  322. mergeState,
  323. })
  324. );
  325. await promise;
  326. expect(mergeMock).toHaveBeenCalledWith(
  327. expect.anything(),
  328. {
  329. orgId: 'orgId',
  330. projectId: 'projectId',
  331. itemIds: ['1', 'groupId'],
  332. query: undefined,
  333. },
  334. {
  335. error: expect.any(Function),
  336. success: expect.any(Function),
  337. complete: expect.any(Function),
  338. }
  339. );
  340. // Should be removed from mergeList after merged
  341. mergeList = mergeList.filter(item => item !== '1');
  342. mergeState.set('1', {checked: false, busy: true});
  343. expect(trigger).toHaveBeenLastCalledWith(
  344. expect.objectContaining({
  345. mergeDisabled: false,
  346. mergeList,
  347. mergeState,
  348. })
  349. );
  350. });
  351. it('keeps rows in "busy" state and unchecks after successfully adding to merge queue', async function () {
  352. GroupingStore.onToggleMerge('1');
  353. mergeList = ['1'];
  354. mergeState.set('1', {checked: true});
  355. // Expect checked
  356. expect(trigger).toHaveBeenCalledWith(
  357. expect.objectContaining({
  358. mergeDisabled: false,
  359. mergeList,
  360. mergeState,
  361. })
  362. );
  363. trigger.mockReset();
  364. // Start unmerge
  365. const promise = GroupingStore.onMerge({
  366. params: {
  367. orgId: 'orgId',
  368. groupId: 'groupId',
  369. },
  370. projectId: 'projectId',
  371. });
  372. mergeState.set('1', {checked: true, busy: true});
  373. // Expect checked to remain the same, but is now busy
  374. expect(trigger).toHaveBeenCalledWith(
  375. expect.objectContaining({
  376. mergeDisabled: true,
  377. mergeList,
  378. mergeState,
  379. })
  380. );
  381. await promise;
  382. mergeState.set('1', {checked: false, busy: true});
  383. // After promise, reset checked to false, but keep busy
  384. expect(trigger).toHaveBeenLastCalledWith(
  385. expect.objectContaining({
  386. mergeDisabled: false,
  387. mergeList: [],
  388. mergeState,
  389. })
  390. );
  391. });
  392. it('resets busy state and has same items checked after error when trying to merge', async function () {
  393. MockApiClient.clearMockResponses();
  394. MockApiClient.addMockResponse({
  395. method: 'PUT',
  396. url: '/projects/orgId/projectId/issues/',
  397. statusCode: 500,
  398. body: {},
  399. });
  400. GroupingStore.onToggleMerge('1');
  401. mergeList = ['1'];
  402. mergeState.set('1', {checked: true});
  403. const promise = GroupingStore.onMerge({
  404. params: {
  405. orgId: 'orgId',
  406. groupId: 'groupId',
  407. },
  408. projectId: 'projectId',
  409. });
  410. mergeState.set('1', {checked: true, busy: true});
  411. expect(trigger).toHaveBeenCalledWith(
  412. expect.objectContaining({
  413. mergeDisabled: true,
  414. mergeList,
  415. mergeState,
  416. })
  417. );
  418. await promise;
  419. // Error state
  420. mergeState.set('1', {checked: true, busy: false});
  421. expect(trigger).toHaveBeenLastCalledWith(
  422. expect.objectContaining({
  423. mergeDisabled: false,
  424. mergeList,
  425. mergeState,
  426. })
  427. );
  428. });
  429. });
  430. });
  431. describe('Hashes list (to be unmerged)', function () {
  432. let unmergeList: (typeof GroupingStore)['state']['unmergeList'];
  433. let unmergeState: (typeof GroupingStore)['state']['unmergeState'];
  434. beforeEach(async function () {
  435. GroupingStore.init();
  436. unmergeList = new Map();
  437. unmergeState = new Map();
  438. await GroupingStore.onFetch([
  439. {dataKey: 'merged', endpoint: '/issues/groupId/hashes/'},
  440. ]);
  441. trigger.mockClear();
  442. unmergeState = new Map([...GroupingStore.getState().unmergeState]);
  443. });
  444. // WARNING: all the tests in this describe block are not running in isolated state.
  445. // There is a good chance that moving them around will break them. To simulate an isolated state,
  446. // add a beforeEach(() => GroupingStore.init())
  447. describe('onToggleUnmerge (checkbox state for hashes)', function () {
  448. // Attempt to check first item but its "locked" so should not be able to do anything
  449. it('can not check locked item', function () {
  450. GroupingStore.onToggleUnmerge('1');
  451. expect(GroupingStore.getState().unmergeList).toEqual(unmergeList);
  452. expect(GroupingStore.getState().unmergeState).toEqual(unmergeState);
  453. expect(trigger).not.toHaveBeenCalled();
  454. });
  455. it('can check and uncheck unlocked items', function () {
  456. // Check
  457. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  458. unmergeList.set('2', 'event-2');
  459. unmergeState.set('2', {busy: false, checked: true});
  460. expect(GroupingStore.getState().unmergeList).toEqual(unmergeList);
  461. expect(GroupingStore.getState().unmergeState).toEqual(unmergeState);
  462. // Uncheck
  463. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  464. unmergeList.delete('2');
  465. unmergeState.set('2', {busy: false, checked: false});
  466. expect(GroupingStore.getState().unmergeList).toEqual(unmergeList);
  467. expect(GroupingStore.getState().unmergeState).toEqual(unmergeState);
  468. // Check
  469. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  470. unmergeList.set('2', 'event-2');
  471. unmergeState.set('2', {busy: false, checked: true});
  472. expect(GroupingStore.getState().unmergeList).toEqual(unmergeList);
  473. expect(GroupingStore.getState().unmergeState).toEqual(unmergeState);
  474. expect(trigger).toHaveBeenLastCalledWith(
  475. expect.objectContaining({
  476. enableFingerprintCompare: false,
  477. unmergeLastCollapsed: false,
  478. unmergeDisabled: false,
  479. unmergeList,
  480. unmergeState,
  481. })
  482. );
  483. });
  484. it('should have Compare button enabled only when two fingerprints are checked', function () {
  485. expect(GroupingStore.getState().enableFingerprintCompare).toBe(false);
  486. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  487. GroupingStore.onToggleUnmerge(['3', 'event-3']);
  488. expect(GroupingStore.getState().enableFingerprintCompare).toBe(true);
  489. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  490. expect(GroupingStore.getState().enableFingerprintCompare).toBe(false);
  491. });
  492. it('selecting all available checkboxes should disable the unmerge button and re-enable when unchecking', function () {
  493. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  494. GroupingStore.onToggleUnmerge(['3', 'event-3']);
  495. GroupingStore.onToggleUnmerge(['4', 'event-4']);
  496. unmergeList.set('2', 'event-2');
  497. unmergeList.set('3', 'event-3');
  498. unmergeList.set('4', 'event-4');
  499. unmergeState.set('2', {busy: false, checked: true});
  500. unmergeState.set('3', {busy: false, checked: true});
  501. unmergeState.set('4', {busy: false, checked: true});
  502. expect(GroupingStore.getState().unmergeList).toEqual(unmergeList);
  503. expect(GroupingStore.getState().unmergeState).toEqual(unmergeState);
  504. expect(GroupingStore.getState().unmergeDisabled).toBe(true);
  505. // Unchecking
  506. GroupingStore.onToggleUnmerge(['4', 'event-4']);
  507. unmergeList.delete('4');
  508. unmergeState.set('4', {busy: false, checked: false});
  509. expect(GroupingStore.getState().unmergeList).toEqual(unmergeList);
  510. expect(GroupingStore.getState().unmergeState).toEqual(unmergeState);
  511. expect(GroupingStore.getState().unmergeDisabled).toBe(false);
  512. expect(trigger).toHaveBeenLastCalledWith({
  513. enableFingerprintCompare: true,
  514. unmergeLastCollapsed: false,
  515. unmergeDisabled: false,
  516. unmergeList,
  517. unmergeState,
  518. });
  519. });
  520. });
  521. // WARNING: all the tests in this describe block are not running in isolated state.
  522. // There is a good chance that moving them around will break them. To simulate an isolated state,
  523. // add a beforeEach(() => GroupingStore.init())
  524. describe('onUnmerge', function () {
  525. beforeEach(function () {
  526. MockApiClient.clearMockResponses();
  527. MockApiClient.addMockResponse({
  528. method: 'DELETE',
  529. url: '/organizations/org-slug/issues/groupId/hashes/',
  530. });
  531. });
  532. it('can not toggle unmerge for a locked item', function () {
  533. // Event 1 is locked
  534. GroupingStore.onToggleUnmerge(['1', 'event-1']);
  535. unmergeState.set('1', {busy: true});
  536. // trigger does NOT get called because an item returned via API is in a "locked" state
  537. expect(trigger).not.toHaveBeenCalled();
  538. GroupingStore.onUnmerge({
  539. orgSlug: 'org-slug',
  540. groupId: 'groupId',
  541. });
  542. expect(trigger).toHaveBeenCalledWith({
  543. enableFingerprintCompare: false,
  544. unmergeLastCollapsed: false,
  545. unmergeDisabled: true,
  546. unmergeList,
  547. unmergeState,
  548. });
  549. });
  550. it('disables rows to be merged', async function () {
  551. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  552. unmergeList.set('2', 'event-2');
  553. unmergeState.set('2', {checked: true, busy: false});
  554. // trigger does NOT get called because an item returned via API is in a "locked" state
  555. expect(trigger).toHaveBeenCalledWith({
  556. enableFingerprintCompare: false,
  557. unmergeLastCollapsed: false,
  558. unmergeDisabled: false,
  559. unmergeList,
  560. unmergeState,
  561. });
  562. const promise = GroupingStore.onUnmerge({
  563. orgSlug: 'org-slug',
  564. groupId: 'groupId',
  565. });
  566. unmergeState.set('2', {checked: false, busy: true});
  567. expect(trigger).toHaveBeenCalledWith({
  568. enableFingerprintCompare: false,
  569. unmergeLastCollapsed: false,
  570. unmergeDisabled: true,
  571. unmergeList,
  572. unmergeState,
  573. });
  574. await promise;
  575. // Success
  576. unmergeState.set('2', {checked: false, busy: true});
  577. unmergeList.delete('2');
  578. expect(trigger).toHaveBeenLastCalledWith({
  579. enableFingerprintCompare: false,
  580. unmergeLastCollapsed: false,
  581. unmergeDisabled: false,
  582. unmergeList,
  583. unmergeState,
  584. });
  585. });
  586. it('keeps rows in "busy" state and unchecks after successfully adding to unmerge queue', async function () {
  587. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  588. unmergeList.set('2', 'event-2');
  589. unmergeState.set('2', {checked: true, busy: false});
  590. const promise = GroupingStore.onUnmerge({
  591. groupId: 'groupId',
  592. orgSlug: 'org-slug',
  593. });
  594. unmergeState.set('2', {checked: false, busy: true});
  595. expect(trigger).toHaveBeenCalledWith({
  596. enableFingerprintCompare: false,
  597. unmergeLastCollapsed: false,
  598. unmergeDisabled: true,
  599. unmergeList,
  600. unmergeState,
  601. });
  602. await promise;
  603. expect(trigger).toHaveBeenLastCalledWith({
  604. enableFingerprintCompare: false,
  605. unmergeLastCollapsed: false,
  606. unmergeDisabled: false,
  607. unmergeList: new Map(),
  608. unmergeState,
  609. });
  610. });
  611. it('resets busy state and has same items checked after error when trying to merge', async function () {
  612. MockApiClient.clearMockResponses();
  613. MockApiClient.addMockResponse({
  614. method: 'DELETE',
  615. url: '/organizations/org-slug/issues/groupId/hashes/',
  616. statusCode: 500,
  617. body: {},
  618. });
  619. GroupingStore.onToggleUnmerge(['2', 'event-2']);
  620. unmergeList.set('2', 'event-2');
  621. const promise = GroupingStore.onUnmerge({
  622. groupId: 'groupId',
  623. orgSlug: 'org-slug',
  624. });
  625. unmergeState.set('2', {checked: false, busy: true});
  626. expect(trigger).toHaveBeenCalledWith(
  627. expect.objectContaining({
  628. enableFingerprintCompare: false,
  629. unmergeLastCollapsed: false,
  630. unmergeDisabled: true,
  631. unmergeList,
  632. unmergeState,
  633. })
  634. );
  635. await promise;
  636. unmergeState.set('2', {checked: true, busy: false});
  637. expect(trigger).toHaveBeenLastCalledWith({
  638. enableFingerprintCompare: false,
  639. unmergeLastCollapsed: false,
  640. unmergeDisabled: false,
  641. unmergeList,
  642. unmergeState,
  643. });
  644. });
  645. });
  646. });
  647. });