From 7d449e05562c76bb430efc1c36bd715675a84152 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Thu, 23 Mar 2017 18:05:36 +0000 Subject: PLT-5755: Infrastructure for Component Testing. (#5814) This migrates the existing webapp tests to using Jest and Enzyme. The infrastructure is put in place for React component testing, and a few simple example component tests are implemented. This also adds snapshot testing of components, coverage checking for the webapp (although that is not yet integrated to Coveralls), and the ability to run npm run test:watch to automatically re-run affected tests when working on the webapp codebase. --- .../__snapshots__/about_build_modal.test.jsx.snap | 334 +++++++++++++++++++++ .../__snapshots__/spinner_button.test.jsx.snap | 27 ++ 2 files changed, 361 insertions(+) create mode 100644 webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap create mode 100644 webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap (limited to 'webapp/tests/components/__snapshots__') diff --git a/webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap b/webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap new file mode 100644 index 000000000..27eefa273 --- /dev/null +++ b/webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap @@ -0,0 +1,334 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/AboutBuildModal should match snapshot for enterprise edition 1`] = ` + + + + + + + +
+
+ ", + } + } + /> +
+
+

+ Mattermost + + +

+

+ +

+
+
+ + +  3.6.0  (3.6.2) + +
+
+ +  Postgres +
+
+
+
+
+
+ + + about.mattermost.com + +
+
+ +
+
+
+

+ +   + abcdef1234567890 +
+ +   + 0123456789abcdef +

+

+ +   + 21 January 2017 +

+
+
+
+`; + +exports[`components/AboutBuildModal should match snapshot for team edition 1`] = ` + + + + + + + +
+
+ ", + } + } + /> +
+
+

+ Mattermost + + +

+

+ +

+
+
+ + +  3.6.0  (3.6.2) + +
+
+ +  Postgres +
+
+
+
+
+
+ + + mattermost.org + +
+
+ +
+
+
+

+ +   + abcdef1234567890 +
+ +   +

+

+ +   + 21 January 2017 +

+
+
+
+`; diff --git a/webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap b/webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap new file mode 100644 index 000000000..e05132ddd --- /dev/null +++ b/webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/SpinnerButton should match snapshot with children 1`] = ` + +`; + +exports[`components/SpinnerButton should match snapshot with required props 1`] = ` +