summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2017-12-15 14:03:13 +0100
committerWinnie Hellmann <winnie@gitlab.com>2017-12-15 14:35:09 +0100
commit8c966e869f6f60555a84772ffd03115996897601 (patch)
treef675682e52e7feea1bc1f8f91fcde5404551e5e1
parentd849ad3ef3c20434b32a41221c341f1a162a32cf (diff)
downloadgitlab-ce-winh-test-spyOn-module.tar.gz
-rw-r--r--spec/javascripts/something.js7
-rw-r--r--spec/javascripts/something_spec.js8
2 files changed, 15 insertions, 0 deletions
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();
+ });
+});