Skip to content
This repository was archived by the owner on Aug 13, 2021. It is now read-only.

Error using sails-memory for tests #27

Open
adrdra opened this issue Sep 21, 2015 · 2 comments
Open

Error using sails-memory for tests #27

adrdra opened this issue Sep 21, 2015 · 2 comments

Comments

@adrdra
Copy link

adrdra commented Sep 21, 2015

Hi !

I'm trying to use sails-memory and Barrels to get some fixtures in my tests.

I have created a model called Source and I got a fixture with one source. I can see that the source is in the sails memory, so I want to get the data to test it. I do :

Source.findOne(1, function(err, source) { console.log(source)};

And I get this Error :

Message:
    TypeError: Cannot read property 'select' of undefined
  Stack:
    TypeError: Cannot read property 'select' of undefined
        at Object.module.exports.adapter.find (/home/adrdra/.../node_modules/sails-memory/lib/adapter.js:117:27)
        at module.exports.find (/home/adrdra/.../node_modules/waterline/lib/waterline/adapter/dql.js:120:13)
        at module.exports.findOne (/home/adrdra/...t/node_modules/waterline/lib/waterline/adapter/dql.js:163:10)

...
@adrdra adrdra closed this as completed Sep 21, 2015
@adrdra adrdra reopened this Sep 21, 2015
@mattcodez
Copy link

I have a similar error when doing tests. After updating a model, I have a callback run a get() on the route but I receive an error:
TypeError: Cannot read property 'getPKField' of undefined
If I run the get() before on it's own, there is no problem. Both are identical routes. Not convinced it's sails-memory's fault but I'm not sure where to go from here.

@mattcodez
Copy link

So, I just randomly "fixed" this, but doesn't make much sense. I was running the callback via supertest's expect() callback. The call that was running it actually had a failing test that wasn't being reported. Once I fixed that, the callback runs as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants