Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. // a.js
  2. let a;
  3.  
  4. export const setA = () => {
  5. a = 5;
  6. };
  7.  
  8. export const getA = () => {
  9. if(!a) { throw new Error() }
  10. return a;
  11. }
  12.  
  13. // a.spec.js
  14.  
  15. describe('a', () => {
  16. it('test setA', () => {
  17. setA();
  18. });
  19.  
  20. it('should throw a is not set', () => {
  21. expect(() => getA()).toThrow(Error);
  22. })
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement