From f64419c6439cdc99cb1ffbad730f122b81afdcc3 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Tue, 18 Aug 2020 17:37:08 +0200 Subject: [PATCH] Add tests for Switch --- src/bootstrap/__tests__/Switch.test.js | 33 +++++++++++ .../__snapshots__/Switch.test.js.snap | 56 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 src/bootstrap/__tests__/Switch.test.js create mode 100644 src/bootstrap/__tests__/__snapshots__/Switch.test.js.snap diff --git a/src/bootstrap/__tests__/Switch.test.js b/src/bootstrap/__tests__/Switch.test.js new file mode 100644 index 0000000..b0f73ef --- /dev/null +++ b/src/bootstrap/__tests__/Switch.test.js @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/) + * + * This is free software, licensed under the GNU General Public License v3. + * See /LICENSE for more information. + */ + +import React from "react"; + +import { render } from "customTestRender"; + +import { Switch } from "../Switch"; + +describe("", () => { + it("Render switch", () => { + const { container } = render( + {}} + /> + ); + expect(container.firstChild).toMatchSnapshot(); + }); + + it("Render uncheked switch", () => { + const { container } = render( + + ); + expect(container.firstChild).toMatchSnapshot(); + }); +}); diff --git a/src/bootstrap/__tests__/__snapshots__/Switch.test.js.snap b/src/bootstrap/__tests__/__snapshots__/Switch.test.js.snap new file mode 100644 index 0000000..cc5f8c9 --- /dev/null +++ b/src/bootstrap/__tests__/__snapshots__/Switch.test.js.snap @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` Render switch 1`] = ` +
+
+ + + + Some help text + +
+
+`; + +exports[` Render uncheked switch 1`] = ` +
+
+ + + + Some help text + +
+
+`;