Last active
September 8, 2020 14:45
-
-
Save coisnepe/bdadcd9522793c1328a537411427c0b6 to your computer and use it in GitHub Desktop.
Basic JS testing with Jest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | |
module.exports = { | |
presets: ["@babel/preset-env"] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const hello = (name) => `hello ${name}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { hello } from "./index"; | |
describe("works", () => { | |
it("welcomes you", () => { | |
expect(hello('Paul')).toEqual('hello Paul'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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