« get me outta code hell

test: emit right error when no calls expected - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-29 09:44:49 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-03-29 09:44:49 -0300
commitf69d3397ea370793094261daa769aa893bdd74b1 (patch)
treec93cdbcbeb853c6af615f9d66b30d340b9e52a15 /test
parent179520dca821a149f1a8cd73204e0fead02ed555 (diff)
test: emit right error when no calls expected
Diffstat (limited to 'test')
-rw-r--r--test/lib/generic-mock.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lib/generic-mock.js b/test/lib/generic-mock.js
index 2a346448..119f8731 100644
--- a/test/lib/generic-mock.js
+++ b/test/lib/generic-mock.js
@@ -219,7 +219,7 @@ export function mockFunction(...args) {
         } else if (expectedCallCount === 1) {
           topLevelErrors.push(new Error(`Expected 1 call, got ${totalCallCount}`));
         } else {
-          topLevelErrors.push(new Error(`Unexpectedly called at all`));
+          topLevelErrors.push(new Error(`Expected no calls, got ${totalCallCount}`));
         }
       }
 
@@ -246,7 +246,7 @@ export function mockFunction(...args) {
     // No further processing, this indicates the function shouldn't have been
     // called at all and there aren't any descriptions to match this call with.
     if (empty(allCallDescriptions)) {
-      return;
+      return newCallDescription();
     }
 
     const currentCallNumber = runningCallCount;