From 4935fd5c5544158fe3f2d3fe2c9e1e89963b1a56 Mon Sep 17 00:00:00 2001 From: Rohit Bansal <40559587+Rohit3523@users.noreply.github.com> Date: Sun, 7 Dec 2025 00:29:21 +0530 Subject: [PATCH 1/3] update @testing-library/react-native --- package.json | 2 +- yarn.lock | 72 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 18036f1628..f684bae7bc 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "@rocket.chat/eslint-config": "^0.4.0", "@storybook/react": "9.0.9", "@storybook/react-native": "9.0.9", - "@testing-library/react-native": "^13.2.0", + "@testing-library/react-native": "^13.3.3", "@types/bytebuffer": "^5.0.44", "@types/ejson": "^2.1.3", "@types/i18n-js": "3.8.3", diff --git a/yarn.lock b/yarn.lock index 42818383dc..fef7929266 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3526,6 +3526,11 @@ dependencies: "@jest/types" "^29.6.3" +"@jest/diff-sequences@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz#0ededeae4d071f5c8ffe3678d15f3a1be09156be" + integrity sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw== + "@jest/environment@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" @@ -3563,6 +3568,11 @@ jest-mock "^29.7.0" jest-util "^29.7.0" +"@jest/get-type@30.1.0": + version "30.1.0" + resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.1.0.tgz#4fcb4dc2ebcf0811be1c04fd1cb79c2dba431cbc" + integrity sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA== + "@jest/globals@^29.2.1", "@jest/globals@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" @@ -3603,6 +3613,13 @@ strip-ansi "^6.0.0" v8-to-istanbul "^9.0.1" +"@jest/schemas@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.5.tgz#7bdf69fc5a368a5abdb49fd91036c55225846473" + integrity sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA== + dependencies: + "@sinclair/typebox" "^0.34.0" + "@jest/schemas@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" @@ -4964,6 +4981,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== +"@sinclair/typebox@^0.34.0": + version "0.34.41" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.41.tgz#aa51a6c1946df2c5a11494a2cdb9318e026db16c" + integrity sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g== + "@sinonjs/commons@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" @@ -5084,14 +5106,14 @@ lodash "^4.17.21" redent "^3.0.0" -"@testing-library/react-native@^13.2.0": - version "13.2.0" - resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-13.2.0.tgz#b4f53c69a889728abe8bc3115ba803824bcafe10" - integrity sha512-3FX+vW/JScXkoH8VSCRTYF4KCHC56y4AI6TMDISfLna6r+z8kaSEmxH1I6NVaFOxoWX9yaHDyI26xh7BykmqKw== +"@testing-library/react-native@^13.3.3": + version "13.3.3" + resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-13.3.3.tgz#4bf02911c4e18075df40b5de0e029c209fb45bda" + integrity sha512-k6Mjsd9dbZgvY4Bl7P1NIpePQNi+dfYtlJ5voi9KQlynxSyQkfOgJmYGCYmw/aSgH/rUcFvG8u5gd4npzgRDyg== dependencies: - chalk "^4.1.2" - jest-matcher-utils "^29.7.0" - pretty-format "^29.7.0" + jest-matcher-utils "^30.0.5" + picocolors "^1.1.1" + pretty-format "^30.0.5" redent "^3.0.0" "@testing-library/user-event@^14.6.1": @@ -5944,7 +5966,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" -ansi-styles@^5.0.0: +ansi-styles@^5.0.0, ansi-styles@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== @@ -9896,6 +9918,16 @@ jest-config@^29.7.0: slash "^3.0.0" strip-json-comments "^3.1.1" +jest-diff@30.2.0: + version "30.2.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.2.0.tgz#e3ec3a6ea5c5747f605c9e874f83d756cba36825" + integrity sha512-dQHFo3Pt4/NLlG5z4PxZ/3yZTZ1C7s9hveiOj+GCN+uT109NC2QgsoVZsVOAvbJ3RgKkvyLGXZV9+piDpWbm6A== + dependencies: + "@jest/diff-sequences" "30.0.1" + "@jest/get-type" "30.1.0" + chalk "^4.1.2" + pretty-format "30.2.0" + jest-diff@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" @@ -10014,6 +10046,16 @@ jest-matcher-utils@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" +jest-matcher-utils@^30.0.5: + version "30.2.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.2.0.tgz#69a0d4c271066559ec8b0d8174829adc3f23a783" + integrity sha512-dQ94Nq4dbzmUWkQ0ANAWS9tBRfqCrn0bV9AMYdOi/MHW726xn7eQmMeRTpX2ViC00bpNaWXq+7o4lIQ3AX13Hg== + dependencies: + "@jest/get-type" "30.1.0" + chalk "^4.1.2" + jest-diff "30.2.0" + pretty-format "30.2.0" + jest-message-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" @@ -12141,6 +12183,15 @@ pretty-bytes@5.6.0, pretty-bytes@^5.6.0: resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" integrity sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg== +pretty-format@30.2.0, pretty-format@^30.0.5: + version "30.2.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.2.0.tgz#2d44fe6134529aed18506f6d11509d8a62775ebe" + integrity sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA== + dependencies: + "@jest/schemas" "30.0.5" + ansi-styles "^5.2.0" + react-is "^18.3.1" + pretty-format@^26.5.2, pretty-format@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" @@ -12387,6 +12438,11 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-is@^18.3.1: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== + react-is@^19.0.0, react-is@^19.1.0: version "19.1.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-19.1.0.tgz#805bce321546b7e14c084989c77022351bbdd11b" From 61b13abf2bbeca4bce0434d72754d6eb719e6b8f Mon Sep 17 00:00:00 2001 From: Rohit Bansal <40559587+Rohit3523@users.noreply.github.com> Date: Sun, 7 Dec 2025 00:29:45 +0530 Subject: [PATCH 2/3] use renderAsync to get state updated UI --- .rnstorybook/generateSnapshots.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.rnstorybook/generateSnapshots.tsx b/.rnstorybook/generateSnapshots.tsx index a72ed077dc..f1e833c854 100644 --- a/.rnstorybook/generateSnapshots.tsx +++ b/.rnstorybook/generateSnapshots.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { composeStories } from '@storybook/react'; -import { render } from '@testing-library/react-native'; +import { renderAsync } from '@testing-library/react-native'; import preview from './preview'; import { mockedStore } from '../app/reducers/mockedStore'; import { initStore } from '../app/lib/store/auxStore'; @@ -13,8 +13,8 @@ export function generateSnapshots(stories: any) { decorators: preview.decorators }); Object.entries(composedStories).forEach(([name, story]) => { - test(`${name} should match snapshot`, () => { - const rendered = render(React.createElement(story as React.ComponentType)); + test(`${name} should match snapshot`, async () => { + const rendered = await renderAsync(React.createElement(story as React.ComponentType)); expect(rendered.toJSON()).toMatchSnapshot(); }); }); From 492b7c9c743a2e87c3bce965d9aef9b664ca883a Mon Sep 17 00:00:00 2001 From: Rohit Bansal <40559587+Rohit3523@users.noreply.github.com> Date: Sun, 7 Dec 2025 00:29:52 +0530 Subject: [PATCH 3/3] Snapshot update --- .../__snapshots__/Message.test.tsx.snap | 1524 +++++------------ 1 file changed, 418 insertions(+), 1106 deletions(-) diff --git a/app/containers/message/__snapshots__/Message.test.tsx.snap b/app/containers/message/__snapshots__/Message.test.tsx.snap index fb42ca0dda..497667ba4d 100644 --- a/app/containers/message/__snapshots__/Message.test.tsx.snap +++ b/app/containers/message/__snapshots__/Message.test.tsx.snap @@ -1294,10 +1294,8 @@ exports[`Story Snapshots: AttachmentWithTextAndLink should match snapshot 1`] = style={ [ { - "borderRadius": 4, - "minHeight": 200, - "overflow": "hidden", - "width": "100%", + "alignItems": "center", + "justifyContent": "center", }, { "borderColor": "#CBCED1", @@ -1307,89 +1305,40 @@ exports[`Story Snapshots: AttachmentWithTextAndLink should match snapshot 1`] = }, ] } - /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - - -  - + style={ + { + "height": 0, + "width": 0, + } + } + transition={null} + width={0} + /> - - -