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

Can't create unauthenticated user for tests #12

Closed
lyahdav opened this issue Aug 18, 2015 · 4 comments
Closed

Can't create unauthenticated user for tests #12

lyahdav opened this issue Aug 18, 2015 · 4 comments

Comments

@lyahdav
Copy link

lyahdav commented Aug 18, 2015

I'm trying to create a user in the users object that's unauthenticated via:

"users": {
      "unauthenticated": null
    }

Then I have a rule that checks auth != null:

".write": "auth != null"

I get this error when running tests:

/usr/local/lib/node_modules/targaryen/lib/test-jig.js:22
    auth.$description = desc;
                      ^
TypeError: Cannot set property '$description' of null
    at TestJig._lookupAuth (/usr/local/lib/node_modules/targaryen/lib/test-jig.js:22:23)
    at TestJig.<anonymous> (/usr/local/lib/node_modules/targaryen/lib/test-jig.js:50:19)
    at Array.map (native)
    at TestJig.<anonymous> (/usr/local/lib/node_modules/targaryen/lib/test-jig.js:48:42)
    at Array.forEach (native)
    at TestJig.run (/usr/local/lib/node_modules/targaryen/lib/test-jig.js:32:27)
    at Object.<anonymous> (/usr/local/lib/node_modules/targaryen/bin/targaryen.js:25:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
@danielcha
Copy link

I just ran into the same issue. This should really be fixed. It seems this isn't the issue if you are using the API. But with the CLI it is broken. I fixed it with a dirty hack by changing line 22 of test-jig.js to:

if (typeof auth === 'string' && auth !== 'unauthenticated') {

I wouldn't recommend this solution, but at least I can run my tests :-)

@mrozbarry
Copy link

@goldibex are you accepting PRs or anything to get this moving along? Just ran into this with the CLI tool, and wouldn't mind a fix, and don't mind doing the fix myself if necessary. Jasmine and Chai both have this functionality, so it would be great if all facets of this project had the same feature sets.

@goldibex
Copy link
Owner

@mrozbarry with my apologies for the delay. I would happily accept PRs!

@jbearer
Copy link
Contributor

jbearer commented May 6, 2016

Just submitted a PR that should fix this.

goldibex added a commit that referenced this issue May 11, 2016
Support unauthenticated user (null auth payload) for CLI. Fixes #12.
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

5 participants