From eaaa625411f8b66a1d5f6db5435b3cfea8f91605 Mon Sep 17 00:00:00 2001 From: GabrielTrettel Date: Thu, 7 Jan 2021 11:51:46 -0300 Subject: [PATCH] More utest attempts --- src/__test__/App.test.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/__test__/App.test.js b/src/__test__/App.test.js index 27fe34e..c767039 100644 --- a/src/__test__/App.test.js +++ b/src/__test__/App.test.js @@ -2,13 +2,29 @@ import React from "react"; import renderer from "react-test-renderer"; import App from "../App"; -//FIXME:currently, I can't run the example that is in the expo documentation -// -> https://docs.expo.io/guides/testing-with-jest/#unit-test + +jest.useFakeTimers(); // NOTE: Just an toy example for verifying if Jest is running -describe("", () => { - it("has 1 child", () => { - // const tree = renderer.create().toJSON(); +describe("Jest initialization test", () => { + it("Knows how to sum", () => { expect(1 + 1).toBe(2); }); }); + + +// NOTE: Testing a snapshot +it('Renders correctly', () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); +}); + + +//FIXME:currently, I can't run the example that is in the expo documentation +// -> https://docs.expo.io/guides/testing-with-jest/#unit-test +// describe("", () => { +// it("has 1 child", () => { +// const tree = renderer.create().toJSON(); +// expect(tree.children.length).toBe(1); +// }); +// });