diff --git a/.travis.yml b/.travis.yml index 057c7810..a8d5346b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ script: - pre-commit run -a - npm install -g expo-cli --loglevel=error - npm install --log-level=error - #- npm test # Tests disabled for now + - npm test diff --git a/App.test.js b/App.test.js index 407cc02e..bc3c8ae5 100644 --- a/App.test.js +++ b/App.test.js @@ -1,11 +1,17 @@ import React from "react"; +import App from "./App"; + import renderer from "react-test-renderer"; -import App from "./App"; +// Mock application +jest.mock("expo", () => ({ + AppLoading: "AppLoading" +})); + +jest.mock("./navigation/navigation", () => "navigation"); -describe("", () => { - it("has 1 child", () => { - const tree = renderer.create().toJSON(); - expect(tree.children.length).toBe(1); - }); +// Snapshot test +test("renders correctly", () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); }); diff --git a/__snapshots__/App.test.js.snap b/__snapshots__/App.test.js.snap new file mode 100644 index 00000000..f82c35a3 --- /dev/null +++ b/__snapshots__/App.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders correctly 1`] = ``; diff --git a/babel.config.js b/babel.config.js index 6be071b3..399181bd 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,10 +1,3 @@ -// module.exports = function(api) { -// api.cache(true); -// return { -// presets: ["@babel/preset-env", "babel-preset-expo"], -// plugins: ["@babel/plugin-proposal-class-properties"] -// }; -// }; module.exports = { presets: [ [ diff --git a/jest.config.js b/jest.config.js index 49ede28c..e4b47070 100644 --- a/jest.config.js +++ b/jest.config.js @@ -176,7 +176,7 @@ module.exports = { // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation transformIgnorePatterns: [ - "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|sentry-expo|native-base|react-native-screens|react-native|rn-sliding-up-panel)" + "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|sentry-expo|native-base|react-native-screens|react-native|rn-sliding-up-panel|react-native-maps|react-test-renderer)" ] // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them