❯ jest --coverage=true
console.log
test
at log (index.js:12:21)
PASS ./index.test.js
work
✓ 1 and 2 pass (11 ms)
✓ 1 pass 2 not (1 ms)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 75 | 100 | 100 |
index.js | 100 | 75 | 100 | 100 | 5
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 0.179 s, estimated 1 s
Last active
June 25, 2023 15:49
-
-
Save rluvaton/2195d8ced64b4eec75eb5b1752c4a733 to your computer and use it in GitHub Desktop.
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
module.exports = { | |
run(user) { | |
const notifications = {sent: false, channels: {}}; | |
if(user.sensitiveDepartment) { | |
notifications.channels.email = { | |
address: user.email | |
}; | |
} | |
if(!user.permission) { | |
console.log(notifications.channels.email.address) | |
notifications.sent = true; | |
} | |
} | |
} |
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
const {run} = require('./index'); | |
describe('work', () => { | |
it('1 and 2 pass', () => { | |
run({sensitiveDepartment: true, permission: false, email: 'test'}) | |
}); | |
it('1 pass 2 not', () => { | |
run({sensitiveDepartment: true, permission: true}) | |
}); | |
}); |
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
module.exports = { | |
// Indicates whether the coverage information should be collected while executing the test | |
collectCoverage: true, | |
// The directory where Jest should output its coverage files | |
coverageDirectory: "coverage", | |
coverageProvider: 'babel' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment