Created
March 28, 2016 09:40
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
diff --git a/imports/api/tasks.tests.js b/imports/api/tasks.tests.js | |
index 1359e85..9b61c5a 100644 | |
--- a/imports/api/tasks.tests.js | |
+++ b/imports/api/tasks.tests.js | |
@@ -2,6 +2,7 @@ | |
import { Meteor } from 'meteor/meteor'; | |
import { Random } from 'meteor/random'; | |
+import { assert } from 'meteor/practicalmeteor:chai'; | |
import { Tasks } from './tasks.js'; | |
@@ -22,6 +23,18 @@ if (Meteor.isServer) { | |
}); | |
it('can delete owned task', () => { | |
+ // Find the internal implementation of the task method so we can | |
+ // test it in isolation | |
+ const deleteTask = Meteor.server.method_handlers['tasks.remove']; | |
+ | |
+ // Set up a fake method invocation that looks like what the method expects | |
+ const invocation = { userId }; | |
+ | |
+ // Run the method with `this` set to the fake invocation | |
+ deleteTask.apply(invocation, [taskId]); | |
+ | |
+ // Verify that the method does what we expected | |
+ assert.equal(Tasks.find().count(), 0); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment