Giter Site home page Giter Site logo

Comments (20)

danielspaniel avatar danielspaniel commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

danielspaniel avatar danielspaniel commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

danielspaniel avatar danielspaniel commented on June 10, 2024

there you go .. so simple

from ember-data-factory-guy.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

danielspaniel avatar danielspaniel commented on June 10, 2024

i don't know either frankly .. sorry can't be more help.

from ember-data-factory-guy.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

danielspaniel avatar danielspaniel commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

danielspaniel avatar danielspaniel commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

Found the problem. Submitting a PR.

from ember-data-factory-guy.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

The failing tests with latest ember-data appear to be a problem with ember-data-model-fragments.

from ember-data-factory-guy.

danielspaniel avatar danielspaniel commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

There is a fix coming in model fragments, a couple of weeks away they say

from ember-data-factory-guy.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

My PR is unrelated to model fragments. It fails in master

from ember-data-factory-guy.

danielspaniel avatar danielspaniel commented on June 10, 2024

what fails in master ? confused, since I just merged your PR since all tests passed in master with it

from ember-data-factory-guy.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

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.

BryanCrotaz avatar BryanCrotaz commented on June 10, 2024

Fixed by #416

from ember-data-factory-guy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.