From 8c966e869f6f60555a84772ffd03115996897601 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Fri, 15 Dec 2017 14:03:13 +0100 Subject: spyOn module --- spec/javascripts/something.js | 7 +++++++ spec/javascripts/something_spec.js | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 spec/javascripts/something.js create mode 100644 spec/javascripts/something_spec.js (limited to 'spec/javascripts') diff --git a/spec/javascripts/something.js b/spec/javascripts/something.js new file mode 100644 index 00000000000..1aa9b5ec9a1 --- /dev/null +++ b/spec/javascripts/something.js @@ -0,0 +1,7 @@ +export function someFunction() { + throw new Error('someFunction should not be called'); +} + +export function otherFunction() { + someFunction(); +} diff --git a/spec/javascripts/something_spec.js b/spec/javascripts/something_spec.js new file mode 100644 index 00000000000..0868dd90a0f --- /dev/null +++ b/spec/javascripts/something_spec.js @@ -0,0 +1,8 @@ +import * as something from './something'; + +fdescribe('something', () => { + it('does not call someFunction', () => { + spyOn(something, 'someFunction').and.callFake(() => console.log('someFunction was not called! yay!')); + something.otherFunction(); + }); +}); -- cgit v1.2.1