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

expectJSONTypes: Can't use custom functions in nested objects #93

Closed
juliogarciag opened this issue Apr 24, 2014 · 8 comments
Closed

expectJSONTypes: Can't use custom functions in nested objects #93

juliogarciag opened this issue Apr 24, 2014 · 8 comments

Comments

@juliogarciag
Copy link

When i use expectJSONTypes to make tests using json test objects like this:

var StringOrNull = function(val) { expect(val).toBeTypeOrNull(String) } 

person = {
  phone: StringOrNull
}

It works. It executes the toBeTypeOrNull matcher and everything is ok. But when i try to use a function like this:

var StringOrNull = function(val) { expect(val).toBeTypeOrNull(String) } 

stuff = {
  person: {
    phone: StringOrNull
  }
}

The jasmine matcher is never reached. It's not being executed. Instead, it will throw an error when executed against another object:

Expected 'null' to be type 'object' on key 'phone'
@amgray789
Copy link

Is this (or has this) being addressed?

@marclitchfield
Copy link

I believe I have a fix for this issue and #94. I'll make a PR against the master branch, but I also have a fix against the release-fix branch (currently 0.8.5) at https://github.com/marclitchfield/frisby/tree/release-fix-nested-objects. I would be interested in learning if this resolves the issue you describe.

@Ciki
Copy link

Ciki commented Jun 12, 2015

@vlucas Is this (or has this) being addressed?

@ns-jdripps
Copy link

I am running into this issue. Has anyone tested #180 to see if it fixes the issue?

@jkwohlfahrt
Copy link

I am still running into this issue as well.

@ramsey
Copy link

ramsey commented Feb 16, 2016

Bump. Me, too.

@SecuritySheriff
Copy link

Has this issue been resolved? I'm running into it if someone can redirect me that would be great

@vlucas
Copy link
Owner

vlucas commented Jul 26, 2017

This will never work in 0.x due to the reasons outlined in #316. Please update to v2.

@vlucas vlucas closed this as completed Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants