jsfmt.spec.js.snap 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. // Jest Snapshot v1, https://goo.gl/fbAQLP
  2. exports[`arrow.js 1`] = `
  3. function f() {
  4. const appEntitys = getAppEntitys(loadObject).filter(
  5. entity => entity && entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled()
  6. )
  7. }
  8. function f() {
  9. const appEntitys = getAppEntitys(loadObject).map(
  10. entity => entity && entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled() && {
  11. id: entity.id
  12. }
  13. )
  14. }
  15. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. function f() {
  17. const appEntitys = getAppEntitys(loadObject).filter(
  18. entity =>
  19. entity &&
  20. entity.isInstallAvailable() &&
  21. !entity.isQueue() &&
  22. entity.isDisabled()
  23. );
  24. }
  25. function f() {
  26. const appEntitys = getAppEntitys(loadObject).map(
  27. entity =>
  28. entity &&
  29. entity.isInstallAvailable() &&
  30. !entity.isQueue() &&
  31. entity.isDisabled() && {
  32. id: entity.id
  33. }
  34. );
  35. }
  36. `;
  37. exports[`bitwise-flags.js 1`] = `
  38. const FLAG_A = 1 << 0;
  39. const FLAG_B = 1 << 1;
  40. const FLAG_C = 1 << 2;
  41. const all = FLAG_A | FLAG_B | FLAG_C;
  42. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. const FLAG_A = 1 << 0;
  44. const FLAG_B = 1 << 1;
  45. const FLAG_C = 1 << 2;
  46. const all = FLAG_A | FLAG_B | FLAG_C;
  47. `;
  48. exports[`comment.js 1`] = `
  49. a = (
  50. // Commment 1
  51. (Math.random() * (yRange * (1 - minVerticalFraction)))
  52. + (minVerticalFraction * yRange)
  53. ) - offset;
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. a =
  56. // Commment 1
  57. Math.random() * (yRange * (1 - minVerticalFraction)) +
  58. minVerticalFraction * yRange -
  59. offset;
  60. `;
  61. exports[`equality.js 1`] = `
  62. x == y == z;
  63. x != y == z;
  64. x == y != z;
  65. x != y != z;
  66. x === y === z;
  67. x !== y === z;
  68. x === y !== z;
  69. x !== y !== z;
  70. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71. (x == y) == z;
  72. (x != y) == z;
  73. (x == y) != z;
  74. (x != y) != z;
  75. (x === y) === z;
  76. (x !== y) === z;
  77. (x === y) !== z;
  78. (x !== y) !== z;
  79. `;
  80. exports[`exp.js 1`] = `
  81. a ** b ** c;
  82. (a ** b) ** c;
  83. a.b ** c;
  84. (-a) ** b;
  85. a ** -b;
  86. -(a**b);
  87. (a * b) ** c;
  88. a ** (b * c);
  89. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. a ** (b ** c);
  91. (a ** b) ** c;
  92. a.b ** c;
  93. (-a) ** b;
  94. a ** -b;
  95. -(a ** b);
  96. (a * b) ** c;
  97. a ** (b * c);
  98. `;
  99. exports[`if.js 1`] = `
  100. if (this.hasPlugin("dynamicImports") && this.lookahead().type) {}
  101. if (this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft) {}
  102. if (this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft.right) {}
  103. if (VeryVeryVeryVeryVeryVeryVeryVeryLong === VeryVeryVeryVeryVeryVeryVeryVeryLong) {
  104. }
  105. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  106. if (this.hasPlugin("dynamicImports") && this.lookahead().type) {
  107. }
  108. if (
  109. this.hasPlugin("dynamicImports") &&
  110. this.lookahead().type === tt.parenLeft
  111. ) {
  112. }
  113. if (
  114. this.hasPlugin("dynamicImports") &&
  115. this.lookahead().type === tt.parenLeft.right
  116. ) {
  117. }
  118. if (
  119. VeryVeryVeryVeryVeryVeryVeryVeryLong === VeryVeryVeryVeryVeryVeryVeryVeryLong
  120. ) {
  121. }
  122. `;
  123. exports[`inline-jsx.js 1`] = `
  124. const user = renderedUser || <div><User name={this.state.user.name} age={this.state.user.age} /></div>;
  125. const user = renderedUser || shouldRenderUser && <div><User name={this.state.user.name} age={this.state.user.age} /></div>;
  126. const avatar = hasAvatar && <Gravatar user={author} size={size} />;
  127. const avatar = (hasAvatar || showPlaceholder) && <Gravatar user={author} size={size} />;
  128. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  129. const user = renderedUser || (
  130. <div>
  131. <User name={this.state.user.name} age={this.state.user.age} />
  132. </div>
  133. );
  134. const user =
  135. renderedUser ||
  136. (shouldRenderUser && (
  137. <div>
  138. <User name={this.state.user.name} age={this.state.user.age} />
  139. </div>
  140. ));
  141. const avatar = hasAvatar && <Gravatar user={author} size={size} />;
  142. const avatar = (hasAvatar || showPlaceholder) && (
  143. <Gravatar user={author} size={size} />
  144. );
  145. `;
  146. exports[`inline-object-array.js 1`] = `
  147. prevState = prevState || {
  148. catalogs: [],
  149. loadState: LOADED,
  150. opened: false,
  151. searchQuery: '',
  152. selectedCatalog: null,
  153. };
  154. prevState = prevState ||
  155. defaultState || {
  156. catalogs: [],
  157. loadState: LOADED,
  158. opened: false,
  159. searchQuery: '',
  160. selectedCatalog: null,
  161. };
  162. prevState = prevState ||
  163. defaultState && {
  164. catalogs: [],
  165. loadState: LOADED,
  166. opened: false,
  167. searchQuery: '',
  168. selectedCatalog: null,
  169. };
  170. prevState = prevState || useDefault && defaultState || {
  171. catalogs: [],
  172. loadState: LOADED,
  173. opened: false,
  174. searchQuery: '',
  175. selectedCatalog: null,
  176. };
  177. this.steps = steps || [
  178. {
  179. name: 'mock-module',
  180. path: '/nux/mock-module',
  181. },
  182. ];
  183. this.steps = steps || checkStep && [
  184. {
  185. name: 'mock-module',
  186. path: '/nux/mock-module',
  187. },
  188. ];
  189. this.steps = steps && checkStep || [
  190. {
  191. name: 'mock-module',
  192. path: '/nux/mock-module',
  193. },
  194. ];
  195. const create = () => {
  196. const result = doSomething();
  197. return (
  198. shouldReturn &&
  199. result.ok && {
  200. status: "ok",
  201. createdAt: result.createdAt,
  202. updatedAt: result.updatedAt
  203. }
  204. );
  205. }
  206. const create = () => {
  207. const result = doSomething();
  208. return (
  209. shouldReturn && result.ok && result || {
  210. status: "ok",
  211. createdAt: result.createdAt,
  212. updatedAt: result.updatedAt
  213. }
  214. );
  215. }
  216. const obj = {
  217. state: shouldHaveState &&
  218. stateIsOK && {
  219. loadState: LOADED,
  220. opened: false
  221. },
  222. loadNext: stateIsOK && hasNext || {
  223. skipNext: true
  224. },
  225. loaded: true
  226. }
  227. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  228. prevState = prevState || {
  229. catalogs: [],
  230. loadState: LOADED,
  231. opened: false,
  232. searchQuery: "",
  233. selectedCatalog: null
  234. };
  235. prevState = prevState ||
  236. defaultState || {
  237. catalogs: [],
  238. loadState: LOADED,
  239. opened: false,
  240. searchQuery: "",
  241. selectedCatalog: null
  242. };
  243. prevState =
  244. prevState ||
  245. (defaultState && {
  246. catalogs: [],
  247. loadState: LOADED,
  248. opened: false,
  249. searchQuery: "",
  250. selectedCatalog: null
  251. });
  252. prevState = prevState ||
  253. (useDefault && defaultState) || {
  254. catalogs: [],
  255. loadState: LOADED,
  256. opened: false,
  257. searchQuery: "",
  258. selectedCatalog: null
  259. };
  260. this.steps = steps || [
  261. {
  262. name: "mock-module",
  263. path: "/nux/mock-module"
  264. }
  265. ];
  266. this.steps =
  267. steps ||
  268. (checkStep && [
  269. {
  270. name: "mock-module",
  271. path: "/nux/mock-module"
  272. }
  273. ]);
  274. this.steps = (steps && checkStep) || [
  275. {
  276. name: "mock-module",
  277. path: "/nux/mock-module"
  278. }
  279. ];
  280. const create = () => {
  281. const result = doSomething();
  282. return (
  283. shouldReturn &&
  284. result.ok && {
  285. status: "ok",
  286. createdAt: result.createdAt,
  287. updatedAt: result.updatedAt
  288. }
  289. );
  290. };
  291. const create = () => {
  292. const result = doSomething();
  293. return (
  294. (shouldReturn && result.ok && result) || {
  295. status: "ok",
  296. createdAt: result.createdAt,
  297. updatedAt: result.updatedAt
  298. }
  299. );
  300. };
  301. const obj = {
  302. state: shouldHaveState &&
  303. stateIsOK && {
  304. loadState: LOADED,
  305. opened: false
  306. },
  307. loadNext: (stateIsOK && hasNext) || {
  308. skipNext: true
  309. },
  310. loaded: true
  311. };
  312. `;
  313. exports[`jsx_parent.js 1`] = `
  314. <div
  315. src={
  316. !isJellyfishEnabled &&
  317. diffUpdateMessageInput != null &&
  318. this.state.isUpdateMessageEmpty
  319. }
  320. />;
  321. <div>
  322. {!isJellyfishEnabled &&
  323. diffUpdateMessageInput != null &&
  324. this.state.isUpdateMessageEmpty}
  325. </div>;
  326. <div
  327. style={
  328. !isJellyfishEnabled &&
  329. diffUpdateMessageInput && {
  330. fontSize: 14,
  331. color: '#fff'
  332. }
  333. }
  334. />;
  335. <div>
  336. {!isJellyfishEnabled &&
  337. diffUpdateMessageInput != null && <div><span>Text</span></div>}
  338. </div>;
  339. <div>
  340. {!isJellyfishEnabled &&
  341. diffUpdateMessageInput != null && child || <div><span>Text</span></div>}
  342. </div>;
  343. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344. <div
  345. src={
  346. !isJellyfishEnabled &&
  347. diffUpdateMessageInput != null &&
  348. this.state.isUpdateMessageEmpty
  349. }
  350. />;
  351. <div>
  352. {!isJellyfishEnabled &&
  353. diffUpdateMessageInput != null &&
  354. this.state.isUpdateMessageEmpty}
  355. </div>;
  356. <div
  357. style={
  358. !isJellyfishEnabled &&
  359. diffUpdateMessageInput && {
  360. fontSize: 14,
  361. color: "#fff"
  362. }
  363. }
  364. />;
  365. <div>
  366. {!isJellyfishEnabled &&
  367. diffUpdateMessageInput != null && (
  368. <div>
  369. <span>Text</span>
  370. </div>
  371. )}
  372. </div>;
  373. <div>
  374. {(!isJellyfishEnabled && diffUpdateMessageInput != null && child) || (
  375. <div>
  376. <span>Text</span>
  377. </div>
  378. )}
  379. </div>;
  380. `;
  381. exports[`math.js 1`] = `
  382. x + y / z;
  383. x / y + z;
  384. x * y % z;
  385. x / y % z;
  386. x % y * z;
  387. x % y / z;
  388. x % y % z;
  389. x << y >> z;
  390. x >>> y << z;
  391. x >>> y >>> z;
  392. x + y >> z;
  393. x | y & z;
  394. x & y | z;
  395. x ^ y ^ z;
  396. x & y & z;
  397. x | y | z;
  398. x & y >> z;
  399. x << y | z;
  400. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  401. x + y / z;
  402. x / y + z;
  403. (x * y) % z;
  404. (x / y) % z;
  405. (x % y) * z;
  406. (x % y) / z;
  407. (x % y) % z;
  408. (x << y) >> z;
  409. (x >>> y) << z;
  410. (x >>> y) >>> z;
  411. (x + y) >> z;
  412. x | (y & z);
  413. (x & y) | z;
  414. x ^ y ^ z;
  415. x & y & z;
  416. x | y | z;
  417. x & (y >> z);
  418. (x << y) | z;
  419. `;
  420. exports[`return.js 1`] = `
  421. function foo() {
  422. return this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft.right;
  423. }
  424. function foo() {
  425. return this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft.right
  426. ? true
  427. : false;
  428. }
  429. function foo() {
  430. return this.calculate().compute().first.numberOfThings > this.calculate().compute().last.numberOfThings
  431. ? true
  432. : false;
  433. }
  434. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  435. function foo() {
  436. return (
  437. this.hasPlugin("dynamicImports") &&
  438. this.lookahead().type === tt.parenLeft.right
  439. );
  440. }
  441. function foo() {
  442. return this.hasPlugin("dynamicImports") &&
  443. this.lookahead().type === tt.parenLeft.right
  444. ? true
  445. : false;
  446. }
  447. function foo() {
  448. return this.calculate().compute().first.numberOfThings >
  449. this.calculate().compute().last.numberOfThings
  450. ? true
  451. : false;
  452. }
  453. `;
  454. exports[`short-right.js 1`] = `
  455. this._cumulativeHeights &&
  456. Math.abs(
  457. this._cachedItemHeight(this._firstVisibleIndex + i) -
  458. this._provider.fastHeight(i + this._firstVisibleIndex),
  459. ) >
  460. 1
  461. foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(
  462. aaaaaaaaaaaaaaaaaaa
  463. ) +
  464. a;
  465. const isPartOfPackageJSON = dependenciesArray.indexOf(
  466. dependencyWithOutRelativePath.split('/')[0],
  467. ) !== -1;
  468. defaultContent.filter(defaultLocale => {
  469. // ...
  470. })[0] || null;
  471. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  472. this._cumulativeHeights &&
  473. Math.abs(
  474. this._cachedItemHeight(this._firstVisibleIndex + i) -
  475. this._provider.fastHeight(i + this._firstVisibleIndex)
  476. ) > 1;
  477. foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(
  478. aaaaaaaaaaaaaaaaaaa
  479. ) + a;
  480. const isPartOfPackageJSON =
  481. dependenciesArray.indexOf(dependencyWithOutRelativePath.split("/")[0]) !== -1;
  482. defaultContent.filter(defaultLocale => {
  483. // ...
  484. })[0] || null;
  485. `;
  486. exports[`test.js 1`] = `
  487. // It should always break the highest precedence operators first, and
  488. // break them all at the same time.
  489. const x = longVariable + longVariable + longVariable;
  490. const x = longVariable + longVariable + longVariable + longVariable - longVariable + longVariable;
  491. const x = longVariable + longVariable * longVariable + longVariable - longVariable + longVariable;
  492. const x = longVariable + longVariable * longVariable * longVariable / longVariable + longVariable;
  493. const x = longVariable && longVariable && longVariable && longVariable && longVariable && longVariable;
  494. const x = longVariable && longVariable || longVariable && longVariable || longVariable && longVariable;
  495. const x = firstItemWithAVeryLongNameThatKeepsGoing || firstItemWithAVeryLongNameThatKeepsGoing || {};
  496. const x = firstItemWithAVeryLongNameThatKeepsGoing || firstItemWithAVeryLongNameThatKeepsGoing || [];
  497. const x = call(firstItemWithAVeryLongNameThatKeepsGoing, firstItemWithAVeryLongNameThatKeepsGoing) || [];
  498. const x = longVariable * longint && longVariable >> 0 && longVariable + longVariable;
  499. const x = longVariable > longint && longVariable === 0 + longVariable * longVariable;
  500. foo(obj.property * new Class() && obj instanceof Class && longVariable ? number + 5 : false);
  501. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  502. // It should always break the highest precedence operators first, and
  503. // break them all at the same time.
  504. const x = longVariable + longVariable + longVariable;
  505. const x =
  506. longVariable +
  507. longVariable +
  508. longVariable +
  509. longVariable -
  510. longVariable +
  511. longVariable;
  512. const x =
  513. longVariable +
  514. longVariable * longVariable +
  515. longVariable -
  516. longVariable +
  517. longVariable;
  518. const x =
  519. longVariable +
  520. (longVariable * longVariable * longVariable) / longVariable +
  521. longVariable;
  522. const x =
  523. longVariable &&
  524. longVariable &&
  525. longVariable &&
  526. longVariable &&
  527. longVariable &&
  528. longVariable;
  529. const x =
  530. (longVariable && longVariable) ||
  531. (longVariable && longVariable) ||
  532. (longVariable && longVariable);
  533. const x =
  534. firstItemWithAVeryLongNameThatKeepsGoing ||
  535. firstItemWithAVeryLongNameThatKeepsGoing ||
  536. {};
  537. const x =
  538. firstItemWithAVeryLongNameThatKeepsGoing ||
  539. firstItemWithAVeryLongNameThatKeepsGoing ||
  540. [];
  541. const x =
  542. call(
  543. firstItemWithAVeryLongNameThatKeepsGoing,
  544. firstItemWithAVeryLongNameThatKeepsGoing
  545. ) || [];
  546. const x =
  547. longVariable * longint && longVariable >> 0 && longVariable + longVariable;
  548. const x =
  549. longVariable > longint && longVariable === 0 + longVariable * longVariable;
  550. foo(
  551. obj.property * new Class() && obj instanceof Class && longVariable
  552. ? number + 5
  553. : false
  554. );
  555. `;
  556. exports[`unary.js 1`] = `
  557. const anyTestFailures = !(
  558. aggregatedResults.numFailedTests === 0 &&
  559. aggregatedResults.numRuntimeErrorTestSuites === 0
  560. );
  561. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  562. const anyTestFailures = !(
  563. aggregatedResults.numFailedTests === 0 &&
  564. aggregatedResults.numRuntimeErrorTestSuites === 0
  565. );
  566. `;