releasesRequest.spec.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, waitFor} from 'sentry-test/reactTestingLibrary';
  3. import {HealthStatsPeriodOption} from 'sentry/types';
  4. import {ReleasesDisplayOption} from 'sentry/views/releases/list/releasesDisplayOptions';
  5. import ReleasesRequest from 'sentry/views/releases/list/releasesRequest';
  6. describe('ReleasesRequest', () => {
  7. const {organization, router} = initializeOrg();
  8. const projectId = 123;
  9. const selection = {
  10. projects: [projectId],
  11. environments: [],
  12. datetime: {
  13. period: '14d',
  14. start: null,
  15. end: null,
  16. utc: false,
  17. },
  18. };
  19. MockApiClient.addMockResponse({
  20. url: `/organizations/org-slug/sessions/`,
  21. body: TestStubs.SessionStatusCountByReleaseInPeriod(),
  22. match: [
  23. MockApiClient.matchQuery({
  24. query:
  25. 'release:7a82c130be9143361f20bc77252df783cf91e4fc OR release:e102abb2c46e7fe8686441091005c12aed90da99',
  26. interval: '1d',
  27. statsPeriod: '14d',
  28. project: [`${projectId}`],
  29. field: ['sum(session)'],
  30. groupBy: ['project', 'release', 'session.status'],
  31. }),
  32. ],
  33. });
  34. const requestForAutoHealthStatsPeriodSessionHistogram = MockApiClient.addMockResponse({
  35. url: `/organizations/org-slug/sessions/`,
  36. body: TestStubs.SessionStatusCountByProjectInPeriod(),
  37. match: [
  38. MockApiClient.matchQuery({
  39. query: undefined,
  40. interval: '1d',
  41. statsPeriod: '14d',
  42. project: [`${projectId}`],
  43. field: ['sum(session)'],
  44. groupBy: ['project', 'session.status'],
  45. }),
  46. ],
  47. });
  48. const requestForAutoTotalCountByProjectInPeriod = MockApiClient.addMockResponse({
  49. url: `/organizations/org-slug/sessions/`,
  50. body: TestStubs.SessionTotalCountByProjectIn24h(),
  51. match: [
  52. MockApiClient.matchQuery({
  53. query: undefined,
  54. interval: '1d',
  55. statsPeriod: '14d',
  56. project: [`${projectId}`],
  57. field: ['sum(session)'],
  58. groupBy: ['project'],
  59. }),
  60. ],
  61. });
  62. const requestForAutoTotalCountByReleaseInPeriod = MockApiClient.addMockResponse({
  63. url: `/organizations/org-slug/sessions/`,
  64. body: TestStubs.SesssionTotalCountByReleaseIn24h(),
  65. match: [
  66. MockApiClient.matchQuery({
  67. query:
  68. 'release:7a82c130be9143361f20bc77252df783cf91e4fc OR release:e102abb2c46e7fe8686441091005c12aed90da99',
  69. interval: '1d',
  70. statsPeriod: '14d',
  71. project: [`${projectId}`],
  72. field: ['sum(session)'],
  73. groupBy: ['project', 'release'],
  74. }),
  75. ],
  76. });
  77. MockApiClient.addMockResponse({
  78. url: `/organizations/${organization.slug}/sessions/`,
  79. body: TestStubs.SesssionTotalCountByReleaseIn24h(),
  80. match: [
  81. MockApiClient.matchQuery({
  82. query:
  83. 'release:7a82c130be9143361f20bc77252df783cf91e4fc OR release:e102abb2c46e7fe8686441091005c12aed90da99',
  84. interval: '1h',
  85. statsPeriod: '24h',
  86. project: [`${projectId}`],
  87. field: ['sum(session)'],
  88. groupBy: ['project', 'release'],
  89. }),
  90. ],
  91. });
  92. MockApiClient.addMockResponse({
  93. url: `/organizations/org-slug/sessions/`,
  94. body: TestStubs.SessionTotalCountByProjectIn24h(),
  95. match: [
  96. MockApiClient.matchQuery({
  97. query: undefined,
  98. interval: '1h',
  99. statsPeriod: '24h',
  100. project: [`${projectId}`],
  101. field: ['sum(session)'],
  102. groupBy: ['project'],
  103. }),
  104. ],
  105. });
  106. MockApiClient.addMockResponse({
  107. url: `/organizations/org-slug/sessions/`,
  108. body: TestStubs.SessionUserStatusCountByReleaseInPeriod(),
  109. match: [
  110. MockApiClient.matchQuery({
  111. query:
  112. 'release:7a82c130be9143361f20bc77252df783cf91e4fc OR release:e102abb2c46e7fe8686441091005c12aed90da99',
  113. interval: '1d',
  114. statsPeriod: '14d',
  115. project: [`${projectId}`],
  116. field: ['count_unique(user)', 'sum(session)'],
  117. groupBy: ['project', 'release', 'session.status'],
  118. }),
  119. ],
  120. });
  121. MockApiClient.addMockResponse({
  122. url: `/organizations/${organization.slug}/sessions/`,
  123. body: TestStubs.UserTotalCountByReleaseIn24h(),
  124. match: [
  125. MockApiClient.matchQuery({
  126. query:
  127. 'release:7a82c130be9143361f20bc77252df783cf91e4fc OR release:e102abb2c46e7fe8686441091005c12aed90da99',
  128. interval: '1h',
  129. statsPeriod: '24h',
  130. project: [`${projectId}`],
  131. field: ['count_unique(user)'],
  132. groupBy: ['project', 'release'],
  133. }),
  134. ],
  135. });
  136. MockApiClient.addMockResponse({
  137. url: `/organizations/org-slug/sessions/`,
  138. body: TestStubs.UserTotalCountByProjectIn24h(),
  139. match: [
  140. MockApiClient.matchQuery({
  141. query: undefined,
  142. interval: '1h',
  143. statsPeriod: '24h',
  144. project: [`${projectId}`],
  145. field: ['count_unique(user)'],
  146. groupBy: ['project'],
  147. }),
  148. ],
  149. });
  150. it('calculates correct session health data', async () => {
  151. let healthData;
  152. render(
  153. <ReleasesRequest
  154. releases={[
  155. '7a82c130be9143361f20bc77252df783cf91e4fc',
  156. 'e102abb2c46e7fe8686441091005c12aed90da99',
  157. ]}
  158. organization={organization}
  159. location={{
  160. ...router.location,
  161. query: {
  162. project: [`${projectId}`],
  163. },
  164. }}
  165. display={[ReleasesDisplayOption.SESSIONS]}
  166. selection={selection}
  167. >
  168. {({getHealthData}) => {
  169. healthData = getHealthData;
  170. return null;
  171. }}
  172. </ReleasesRequest>
  173. );
  174. await waitFor(() =>
  175. expect(
  176. healthData.getCrashCount(
  177. '7a82c130be9143361f20bc77252df783cf91e4fc',
  178. projectId,
  179. ReleasesDisplayOption.SESSIONS
  180. )
  181. ).toBe(492)
  182. );
  183. expect(
  184. healthData.getCrashFreeRate(
  185. '7a82c130be9143361f20bc77252df783cf91e4fc',
  186. projectId,
  187. ReleasesDisplayOption.SESSIONS
  188. )
  189. ).toBe(99.76);
  190. expect(
  191. healthData.get24hCountByRelease(
  192. '7a82c130be9143361f20bc77252df783cf91e4fc',
  193. projectId,
  194. ReleasesDisplayOption.SESSIONS
  195. )
  196. ).toBe(219826);
  197. expect(
  198. healthData.get24hCountByProject(projectId, ReleasesDisplayOption.SESSIONS)
  199. ).toBe(835965);
  200. expect(
  201. healthData.getTimeSeries(
  202. '7a82c130be9143361f20bc77252df783cf91e4fc',
  203. projectId,
  204. ReleasesDisplayOption.SESSIONS
  205. )
  206. ).toEqual([
  207. {
  208. data: [
  209. {name: 1615975200000, value: 0},
  210. {name: 1615978800000, value: 0},
  211. {name: 1615982400000, value: 0},
  212. {name: 1615986000000, value: 0},
  213. {name: 1615989600000, value: 0},
  214. {name: 1615993200000, value: 0},
  215. {name: 1615996800000, value: 0},
  216. {name: 1616000400000, value: 0},
  217. {name: 1616004000000, value: 0},
  218. {name: 1616007600000, value: 0},
  219. {name: 1616011200000, value: 0},
  220. {name: 1616014800000, value: 0},
  221. {name: 1616018400000, value: 0},
  222. {name: 1616022000000, value: 3444},
  223. {name: 1616025600000, value: 14912},
  224. {name: 1616029200000, value: 15649},
  225. {name: 1616032800000, value: 18019},
  226. {name: 1616036400000, value: 16726},
  227. {name: 1616040000000, value: 17540},
  228. {name: 1616043600000, value: 16970},
  229. {name: 1616047200000, value: 25015},
  230. {name: 1616050800000, value: 34686},
  231. {name: 1616054400000, value: 46434},
  232. {name: 1616058000000, value: 10431},
  233. ],
  234. seriesName: 'This Release',
  235. },
  236. {
  237. data: [
  238. {name: 1615975200000, value: 51284},
  239. {name: 1615978800000, value: 43820},
  240. {name: 1615982400000, value: 46981},
  241. {name: 1615986000000, value: 56929},
  242. {name: 1615989600000, value: 59999},
  243. {name: 1615993200000, value: 60476},
  244. {name: 1615996800000, value: 54145},
  245. {name: 1616000400000, value: 52642},
  246. {name: 1616004000000, value: 42917},
  247. {name: 1616007600000, value: 35787},
  248. {name: 1616011200000, value: 35036},
  249. {name: 1616014800000, value: 29287},
  250. {name: 1616018400000, value: 24815},
  251. {name: 1616022000000, value: 19815},
  252. {name: 1616025600000, value: 16334},
  253. {name: 1616029200000, value: 16415},
  254. {name: 1616032800000, value: 18961},
  255. {name: 1616036400000, value: 17512},
  256. {name: 1616040000000, value: 18149},
  257. {name: 1616043600000, value: 17585},
  258. {name: 1616047200000, value: 25725},
  259. {name: 1616050800000, value: 36365},
  260. {name: 1616054400000, value: 48104},
  261. {name: 1616058000000, value: 6882},
  262. ],
  263. seriesName: 'Total Project',
  264. z: 0,
  265. },
  266. ]);
  267. expect(
  268. healthData.getAdoption(
  269. '7a82c130be9143361f20bc77252df783cf91e4fc',
  270. projectId,
  271. ReleasesDisplayOption.SESSIONS
  272. )
  273. ).toBe(26.29607698886915);
  274. expect(
  275. healthData.getCrashCount(
  276. 'e102abb2c46e7fe8686441091005c12aed90da99',
  277. projectId,
  278. ReleasesDisplayOption.SESSIONS
  279. )
  280. ).toBe(5);
  281. expect(
  282. healthData.getCrashFreeRate(
  283. 'e102abb2c46e7fe8686441091005c12aed90da99',
  284. projectId,
  285. ReleasesDisplayOption.SESSIONS
  286. )
  287. ).toBe(99.921);
  288. expect(
  289. healthData.get24hCountByRelease(
  290. 'e102abb2c46e7fe8686441091005c12aed90da99',
  291. projectId,
  292. ReleasesDisplayOption.SESSIONS
  293. )
  294. ).toBe(6320);
  295. expect(
  296. healthData.get24hCountByProject(projectId, ReleasesDisplayOption.SESSIONS)
  297. ).toBe(835965);
  298. expect(
  299. healthData.getTimeSeries(
  300. 'e102abb2c46e7fe8686441091005c12aed90da99',
  301. projectId,
  302. ReleasesDisplayOption.SESSIONS
  303. )
  304. ).toEqual([
  305. {
  306. data: [
  307. {name: 1615975200000, value: 0},
  308. {name: 1615978800000, value: 0},
  309. {name: 1615982400000, value: 0},
  310. {name: 1615986000000, value: 0},
  311. {name: 1615989600000, value: 0},
  312. {name: 1615993200000, value: 0},
  313. {name: 1615996800000, value: 0},
  314. {name: 1616000400000, value: 0},
  315. {name: 1616004000000, value: 0},
  316. {name: 1616007600000, value: 0},
  317. {name: 1616011200000, value: 0},
  318. {name: 1616014800000, value: 0},
  319. {name: 1616018400000, value: 0},
  320. {name: 1616022000000, value: 5809},
  321. {name: 1616025600000, value: 400},
  322. {name: 1616029200000, value: 22},
  323. {name: 1616032800000, value: 26},
  324. {name: 1616036400000, value: 12},
  325. {name: 1616040000000, value: 19},
  326. {name: 1616043600000, value: 8},
  327. {name: 1616047200000, value: 0},
  328. {name: 1616050800000, value: 19},
  329. {name: 1616054400000, value: 5},
  330. {name: 1616058000000, value: 0},
  331. ],
  332. seriesName: 'This Release',
  333. },
  334. {
  335. data: [
  336. {name: 1615975200000, value: 51284},
  337. {name: 1615978800000, value: 43820},
  338. {name: 1615982400000, value: 46981},
  339. {name: 1615986000000, value: 56929},
  340. {name: 1615989600000, value: 59999},
  341. {name: 1615993200000, value: 60476},
  342. {name: 1615996800000, value: 54145},
  343. {name: 1616000400000, value: 52642},
  344. {name: 1616004000000, value: 42917},
  345. {name: 1616007600000, value: 35787},
  346. {name: 1616011200000, value: 35036},
  347. {name: 1616014800000, value: 29287},
  348. {name: 1616018400000, value: 24815},
  349. {name: 1616022000000, value: 19815},
  350. {name: 1616025600000, value: 16334},
  351. {name: 1616029200000, value: 16415},
  352. {name: 1616032800000, value: 18961},
  353. {name: 1616036400000, value: 17512},
  354. {name: 1616040000000, value: 18149},
  355. {name: 1616043600000, value: 17585},
  356. {name: 1616047200000, value: 25725},
  357. {name: 1616050800000, value: 36365},
  358. {name: 1616054400000, value: 48104},
  359. {name: 1616058000000, value: 6882},
  360. ],
  361. seriesName: 'Total Project',
  362. z: 0,
  363. },
  364. ]);
  365. expect(
  366. healthData.getAdoption(
  367. 'e102abb2c46e7fe8686441091005c12aed90da99',
  368. projectId,
  369. ReleasesDisplayOption.SESSIONS
  370. )
  371. ).toBe(0.7560125124855706);
  372. expect(requestForAutoHealthStatsPeriodSessionHistogram).toHaveBeenCalledTimes(0);
  373. });
  374. it('calculates correct user health data', async () => {
  375. let healthData;
  376. render(
  377. <ReleasesRequest
  378. releases={[
  379. '7a82c130be9143361f20bc77252df783cf91e4fc',
  380. 'e102abb2c46e7fe8686441091005c12aed90da99',
  381. ]}
  382. organization={organization}
  383. location={{
  384. ...router.location,
  385. query: {
  386. project: [`${projectId}`],
  387. },
  388. }}
  389. display={[ReleasesDisplayOption.USERS]}
  390. selection={selection}
  391. >
  392. {({getHealthData}) => {
  393. healthData = getHealthData;
  394. return null;
  395. }}
  396. </ReleasesRequest>
  397. );
  398. await waitFor(() =>
  399. expect(
  400. healthData.getCrashCount(
  401. '7a82c130be9143361f20bc77252df783cf91e4fc',
  402. projectId,
  403. ReleasesDisplayOption.SESSIONS
  404. )
  405. ).toBe(492)
  406. );
  407. expect(
  408. healthData.getCrashFreeRate(
  409. '7a82c130be9143361f20bc77252df783cf91e4fc',
  410. projectId,
  411. ReleasesDisplayOption.USERS
  412. )
  413. ).toBe(99.908);
  414. expect(
  415. healthData.get24hCountByRelease(
  416. '7a82c130be9143361f20bc77252df783cf91e4fc',
  417. projectId,
  418. ReleasesDisplayOption.USERS
  419. )
  420. ).toBe(56826);
  421. expect(healthData.get24hCountByProject(projectId, ReleasesDisplayOption.USERS)).toBe(
  422. 140965
  423. );
  424. expect(
  425. healthData.getTimeSeries(
  426. '7a82c130be9143361f20bc77252df783cf91e4fc',
  427. projectId,
  428. ReleasesDisplayOption.USERS
  429. )
  430. ).toEqual([
  431. {
  432. data: [
  433. {name: 1615975200000, value: 0},
  434. {name: 1615978800000, value: 0},
  435. {name: 1615982400000, value: 0},
  436. {name: 1615986000000, value: 0},
  437. {name: 1615989600000, value: 0},
  438. {name: 1615993200000, value: 0},
  439. {name: 1615996800000, value: 0},
  440. {name: 1616000400000, value: 0},
  441. {name: 1616004000000, value: 0},
  442. {name: 1616007600000, value: 0},
  443. {name: 1616011200000, value: 0},
  444. {name: 1616014800000, value: 0},
  445. {name: 1616018400000, value: 0},
  446. {name: 1616022000000, value: 444},
  447. {name: 1616025600000, value: 4912},
  448. {name: 1616029200000, value: 5649},
  449. {name: 1616032800000, value: 8019},
  450. {name: 1616036400000, value: 6726},
  451. {name: 1616040000000, value: 7540},
  452. {name: 1616043600000, value: 6970},
  453. {name: 1616047200000, value: 5015},
  454. {name: 1616050800000, value: 4686},
  455. {name: 1616054400000, value: 6434},
  456. {name: 1616058000000, value: 431},
  457. ],
  458. seriesName: 'This Release',
  459. },
  460. {
  461. data: [
  462. {name: 1615975200000, value: 1284},
  463. {name: 1615978800000, value: 3820},
  464. {name: 1615982400000, value: 6981},
  465. {name: 1615986000000, value: 6929},
  466. {name: 1615989600000, value: 9999},
  467. {name: 1615993200000, value: 1476},
  468. {name: 1615996800000, value: 4145},
  469. {name: 1616000400000, value: 2642},
  470. {name: 1616004000000, value: 2917},
  471. {name: 1616007600000, value: 5787},
  472. {name: 1616011200000, value: 5036},
  473. {name: 1616014800000, value: 9287},
  474. {name: 1616018400000, value: 4815},
  475. {name: 1616022000000, value: 9815},
  476. {name: 1616025600000, value: 6334},
  477. {name: 1616029200000, value: 6415},
  478. {name: 1616032800000, value: 8961},
  479. {name: 1616036400000, value: 7512},
  480. {name: 1616040000000, value: 8149},
  481. {name: 1616043600000, value: 7585},
  482. {name: 1616047200000, value: 5725},
  483. {name: 1616050800000, value: 6365},
  484. {name: 1616054400000, value: 8104},
  485. {name: 1616058000000, value: 882},
  486. ],
  487. seriesName: 'Total Project',
  488. z: 0,
  489. },
  490. ]);
  491. expect(
  492. healthData.getAdoption(
  493. '7a82c130be9143361f20bc77252df783cf91e4fc',
  494. projectId,
  495. ReleasesDisplayOption.USERS
  496. )
  497. ).toBe(40.31213421771362);
  498. expect(
  499. healthData.getCrashCount(
  500. 'e102abb2c46e7fe8686441091005c12aed90da99',
  501. projectId,
  502. ReleasesDisplayOption.SESSIONS
  503. )
  504. ).toBe(5);
  505. expect(
  506. healthData.getCrashFreeRate(
  507. 'e102abb2c46e7fe8686441091005c12aed90da99',
  508. projectId,
  509. ReleasesDisplayOption.USERS
  510. )
  511. ).toBe(99.87);
  512. expect(
  513. healthData.get24hCountByRelease(
  514. 'e102abb2c46e7fe8686441091005c12aed90da99',
  515. projectId,
  516. ReleasesDisplayOption.USERS
  517. )
  518. ).toBe(850);
  519. expect(healthData.get24hCountByProject(projectId, ReleasesDisplayOption.USERS)).toBe(
  520. 140965
  521. );
  522. expect(
  523. healthData.getTimeSeries(
  524. 'e102abb2c46e7fe8686441091005c12aed90da99',
  525. projectId,
  526. ReleasesDisplayOption.USERS
  527. )
  528. ).toEqual([
  529. {
  530. data: [
  531. {name: 1615975200000, value: 0},
  532. {name: 1615978800000, value: 0},
  533. {name: 1615982400000, value: 0},
  534. {name: 1615986000000, value: 0},
  535. {name: 1615989600000, value: 0},
  536. {name: 1615993200000, value: 0},
  537. {name: 1615996800000, value: 0},
  538. {name: 1616000400000, value: 0},
  539. {name: 1616004000000, value: 0},
  540. {name: 1616007600000, value: 0},
  541. {name: 1616011200000, value: 0},
  542. {name: 1616014800000, value: 0},
  543. {name: 1616018400000, value: 0},
  544. {name: 1616022000000, value: 809},
  545. {name: 1616025600000, value: 0},
  546. {name: 1616029200000, value: 2},
  547. {name: 1616032800000, value: 6},
  548. {name: 1616036400000, value: 2},
  549. {name: 1616040000000, value: 9},
  550. {name: 1616043600000, value: 8},
  551. {name: 1616047200000, value: 0},
  552. {name: 1616050800000, value: 9},
  553. {name: 1616054400000, value: 5},
  554. {name: 1616058000000, value: 0},
  555. ],
  556. seriesName: 'This Release',
  557. },
  558. {
  559. data: [
  560. {name: 1615975200000, value: 1284},
  561. {name: 1615978800000, value: 3820},
  562. {name: 1615982400000, value: 6981},
  563. {name: 1615986000000, value: 6929},
  564. {name: 1615989600000, value: 9999},
  565. {name: 1615993200000, value: 1476},
  566. {name: 1615996800000, value: 4145},
  567. {name: 1616000400000, value: 2642},
  568. {name: 1616004000000, value: 2917},
  569. {name: 1616007600000, value: 5787},
  570. {name: 1616011200000, value: 5036},
  571. {name: 1616014800000, value: 9287},
  572. {name: 1616018400000, value: 4815},
  573. {name: 1616022000000, value: 9815},
  574. {name: 1616025600000, value: 6334},
  575. {name: 1616029200000, value: 6415},
  576. {name: 1616032800000, value: 8961},
  577. {name: 1616036400000, value: 7512},
  578. {name: 1616040000000, value: 8149},
  579. {name: 1616043600000, value: 7585},
  580. {name: 1616047200000, value: 5725},
  581. {name: 1616050800000, value: 6365},
  582. {name: 1616054400000, value: 8104},
  583. {name: 1616058000000, value: 882},
  584. ],
  585. seriesName: 'Total Project',
  586. z: 0,
  587. },
  588. ]);
  589. expect(
  590. healthData.getAdoption(
  591. 'e102abb2c46e7fe8686441091005c12aed90da99',
  592. projectId,
  593. ReleasesDisplayOption.USERS
  594. )
  595. ).toBe(0.6029865569467598);
  596. });
  597. it('calculates correct session count histogram (auto period)', async () => {
  598. let healthData;
  599. render(
  600. <ReleasesRequest
  601. releases={[
  602. '7a82c130be9143361f20bc77252df783cf91e4fc',
  603. 'e102abb2c46e7fe8686441091005c12aed90da99',
  604. ]}
  605. organization={organization}
  606. location={{
  607. ...router.location,
  608. query: {
  609. project: [`${projectId}`],
  610. },
  611. }}
  612. display={[ReleasesDisplayOption.SESSIONS]}
  613. selection={selection}
  614. healthStatsPeriod={HealthStatsPeriodOption.AUTO}
  615. >
  616. {({getHealthData}) => {
  617. healthData = getHealthData;
  618. return null;
  619. }}
  620. </ReleasesRequest>
  621. );
  622. await waitFor(() =>
  623. expect(
  624. healthData.getAdoption(
  625. '7a82c130be9143361f20bc77252df783cf91e4fc',
  626. projectId,
  627. ReleasesDisplayOption.SESSIONS
  628. )
  629. ).toBe(26.29607698886915)
  630. );
  631. expect(
  632. healthData.getTimeSeries(
  633. '7a82c130be9143361f20bc77252df783cf91e4fc',
  634. projectId,
  635. ReleasesDisplayOption.SESSIONS
  636. )
  637. ).toEqual([
  638. {
  639. data: [
  640. {name: 1614902400000, value: 0},
  641. {name: 1614988800000, value: 0},
  642. {name: 1615075200000, value: 0},
  643. {name: 1615161600000, value: 0},
  644. {name: 1615248000000, value: 0},
  645. {name: 1615334400000, value: 0},
  646. {name: 1615420800000, value: 0},
  647. {name: 1615507200000, value: 0},
  648. {name: 1615593600000, value: 0},
  649. {name: 1615680000000, value: 0},
  650. {name: 1615766400000, value: 0},
  651. {name: 1615852800000, value: 0},
  652. {name: 1615939200000, value: 3446},
  653. {name: 1616025600000, value: 201136},
  654. ],
  655. seriesName: 'This Release',
  656. },
  657. {
  658. data: [
  659. {name: 1614902400000, value: 0},
  660. {name: 1614988800000, value: 0},
  661. {name: 1615075200000, value: 0},
  662. {name: 1615161600000, value: 0},
  663. {name: 1615248000000, value: 0},
  664. {name: 1615334400000, value: 0},
  665. {name: 1615420800000, value: 0},
  666. {name: 1615507200000, value: 0},
  667. {name: 1615593600000, value: 0},
  668. {name: 1615680000000, value: 0},
  669. {name: 1615766400000, value: 0},
  670. {name: 1615852800000, value: 0},
  671. {name: 1615939200000, value: 9268},
  672. {name: 1616025600000, value: 1083},
  673. ],
  674. seriesName: 'Total Project',
  675. z: 0,
  676. },
  677. ]);
  678. expect(requestForAutoHealthStatsPeriodSessionHistogram).toHaveBeenCalledTimes(1);
  679. expect(requestForAutoTotalCountByProjectInPeriod).toHaveBeenCalledTimes(1);
  680. expect(requestForAutoTotalCountByReleaseInPeriod).toHaveBeenCalledTimes(1);
  681. });
  682. });