Comments (20)
first off .. instead of this >>
let mockPlayer = mockFindRecord('player').returns({model: player});
do this:
let mockPlayer = mockFindRecord(player);
as to this
mockQueryRecord('user', {current: true}).returns({model: user});
not sure what you doing wrong. you might try using mock instead of mockQueryRecord
https://github.com/danielspaniel/ember-data-factory-guy#mock
but I can't do more than this without actually debugging your code step by step to see why your url not capturing
from ember-data-factory-guy.
I'm debugging step by step and I've found the handler isn't being matched in requestWrapper.handleRequest
.
In request-wrapper.getHandlers
, this.handlers == []
from ember-data-factory-guy.
Right, so what can I do. I suggested using mock and setting the url exactly ( depending on what the handleRequest url is getting.
you can also check the mock.getURL() function to
see what it is mocking ( mockQueryRequest )
other than that .. you gotta track it down. if its a bug then that is fine but for now I don't know yet
from ember-data-factory-guy.
what should the handler look like with the test code I wrote? Should handler.handler.handlers be an array of one object?
from ember-data-factory-guy.
Aha. Found the problem.
let mockQuery = mockQueryRecord('user', {current: true}).returns({model: user});
console.log(mockQuery.getUrl());
//logs /api/v1/users -- should be /api/v1/users/current
from ember-data-factory-guy.
there you go .. so simple
from ember-data-factory-guy.
But the mock is picking up the correct url from my adapter. Can't currently see why it's going wrong
from ember-data-factory-guy.
i don't know either frankly .. sorry can't be more help.
from ember-data-factory-guy.
To check, the handler should pick up the url from the adapter urlForQueryRecord
, and then that url should be returned by getUrl
?
If that's the correct behaviour I can try to create a failing test with my setup and submit a PR.
from ember-data-factory-guy.
i am not 100% sure actually. but factory guy has boat load of tests .. why don't you check there ? if you submit PR with failing test, you will have to fix it yourself as well. Not have time for fixing up things now.
from ember-data-factory-guy.
Works with ember-data 3.9, fails spectacularly with 437 test failures with ember-data 3.18 (which is what I'm using). Investigating.
from ember-data-factory-guy.
yeah , i have not updated factory guy for the latest ember , and since I am not using ember anymore, I am not really into doing that. hope that is not a killer for you trying to fix though
from ember-data-factory-guy.
Found the problem. Submitting a PR.
from ember-data-factory-guy.
The failing tests with latest ember-data
appear to be a problem with ember-data-model-fragments
.
from ember-data-factory-guy.
model fragments have not updated in a while, so ? not much we can do i reckon. but thanks for heads up.
from ember-data-factory-guy.
There is a fix coming in model fragments, a couple of weeks away they say
from ember-data-factory-guy.
My PR is unrelated to model fragments. It fails in master
from ember-data-factory-guy.
what fails in master ? confused, since I just merged your PR since all tests passed in master with it
from ember-data-factory-guy.
Look at the 1 line code change. There’s a comment with it explaining it. The test I’ve added fails in master but doesn’t fail with the code fix I’ve also supplied.
from ember-data-factory-guy.
Fixed by #416
from ember-data-factory-guy.
Related Issues (20)
- `mockFindAll` should be able to also `mockFindRecord`
- Compatibility with Ember Data Model Fragments new refactor HOT 9
- Putting this addon up for adoption? HOT 13
- Error: Pretender intercepted GET but no handler was defined for this type of request HOT 5
- Bump pretender to 3.4.3 HOT 1
- documention error for returns method for mockCreate and mockUpdate
- Mock status is not working. HOT 1
- Factory Guy incompatible with Embroider HOT 4
- Header verification
- Dependency on older broccoli plugin versions prevents test runs with more recent ember-data versions HOT 1
- Version v4 items HOT 2
- (enhancement) Make the documentation more accessible HOT 2
- modelName being used as payloadKey
- Could not find module `@ember/debug` HOT 1
- Fix ember-assign deprecation warning
- Pretender does not catch call when mock is not define - ERROR : "The adapter operation was aborted"
- can we publish a release HOT 8
- String vs number ids and ember-data 5.3+ issues HOT 2
- Switch from pretender to msw?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-data-factory-guy.