Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.toImplement does not properly check type #42

Closed
mrozbarry opened this issue Oct 8, 2015 · 1 comment
Closed

.toImplement does not properly check type #42

mrozbarry opened this issue Oct 8, 2015 · 1 comment
Milestone

Comments

@mrozbarry
Copy link

The example for .toImplement() uses a hash where the key must exist, and implies that the value is the type the actual value should be. This method does not seem to test for individual types off the actual object, and fails when we build a mock object that is exactly what the test expects, ie:

This will pass:

expect({
  foo: 'bar',
  baz: 123,
  foobarbaz: [1, 2, 3]
}).toImplement({
  foo: String,
  baz: Number,
  foobarbaz: Array
})

but so will this:

expect({
  foo: 'bar',
  baz: '123',
  foobarbaz: [1, 2, 3]
}).toImplement({
  foo: String,
  baz: Number,
  foobarbaz: Array
})

Even though baz is a string but is expected to be a number.

If this is just checking for the existance of all attributes, why not have toImplement accept an array of the hash keys?

@JamieMason
Copy link
Owner

Yes absolutely, I need to finish this so it uses the types.

Thanks a lot.

@JamieMason JamieMason added the Bug label Nov 6, 2015
@JamieMason JamieMason modified the milestone: 2.0.0 Nov 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants