Skip to content

Instantly share code, notes, and snippets.

@techiediaries
Created September 25, 2018 19:29
Show Gist options
  • Select an option

  • Save techiediaries/38ebf58edbea4904980565705cb73d1b to your computer and use it in GitHub Desktop.

Select an option

Save techiediaries/38ebf58edbea4904980565705cb73d1b to your computer and use it in GitHub Desktop.
it("should be able to upper case a string", function () {
var spytoUpperCase = spyOn(String.prototype, 'toUpperCase').and.callThrough();
expect(utils.toUpperCase).toBeDefined();
expect(utils.toUpperCase("hello world")).toEqual("HELLO WORLD");
expect(String.prototype.toUpperCase).toHaveBeenCalled();
expect(spytoUpperCase.calls.count()).toEqual(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment