Skip to content

Instantly share code, notes, and snippets.

@coisnepe
Last active September 8, 2020 14:45
Show Gist options
  • Save coisnepe/bdadcd9522793c1328a537411427c0b6 to your computer and use it in GitHub Desktop.
Save coisnepe/bdadcd9522793c1328a537411427c0b6 to your computer and use it in GitHub Desktop.
Basic JS testing with Jest
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
module.exports = {
presets: ["@babel/preset-env"]
};
export const hello = (name) => `hello ${name}`;
import { hello } from "./index";
describe("works", () => {
it("welcomes you", () => {
expect(hello('Paul')).toEqual('hello Paul');
});
});
{
"private": true,
"version": "0.0.0",
"name": "getting-started-with-jest",
"devDependencies": {
"@babel/core": "*",
"@babel/preset-env": "*",
"babel-jest": "*",
"jest": "*"
},
"scripts": {
"test": "jest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment