Read more

Jasmine: Test that an object is an instance of a given class

Henning Koch
January 29, 2020Software engineer at makandra GmbH

To test that an object was constructed by a given constructor function, use jasmine.any(Klass):

describe('plus()', function() {
  it ('returns a number', function() {
    let result = plus(1, 2)
    expect(result).toEqual(jasmine.any(Number))
  })
})
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Also see Expecting objects as method invocation arguments.

Posted by Henning Koch to makandra dev (2020-01-29 10:19)