Skip to content

Instantly share code, notes, and snippets.

@johndowns
Last active February 9, 2018 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndowns/cc82136612dbd89e9d9549cfd8193d36 to your computer and use it in GitHub Desktop.
Save johndowns/cc82136612dbd89e9d9549cfd8193d36 to your computer and use it in GitHub Desktop.
it("should execute a query against the collection", function() {
// arrange
const mock = new Mock<ICollection>()
.setup(instance => instance.getSelfLink)
.returns(() => { return "self-link"; })
.setup(instance => instance.queryDocuments)
.returns((selfLink: string, query: IParameterizedQuery, callback: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void) => {
callback(null, [""], null);
return true;
});
const collectionObject = mock.object();
// act
getGroupedOrdersImpl(["1"], collectionObject);
// assert
mock.verify(instance => instance.queryDocuments, Times.Once());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment