Comments (6)
Hmmm .. that is a good point .. about partial matches. I think that the idea was only to provide exact match, and I never considered partial match because it was kind of difficult. I tried your code above and it did not actually work. If you can prove otherwise send me a test I can run?
Is this a big need you think, for partial match? I was hoping to get away with exact match and call it a day.
from ember-data-factory-guy.
Yes, it is a big need. In most of the cases I don't want to set all fields.
I have taken a look into this and it seems that the problem is
hash.data = JSON.stringify(hash.data);
line in ember-data. Mockjax can't match it partially (since it is a string), it means we can't do this: $.mockjax({url: '/test', data: {test: {some: 'test'}}})
Just curious why ember data "stringifies" data object. JQuery can handle it...
from ember-data-factory-guy.
There may be a way around this .. I am going to try an experiment this weekend to see if I can get the partial match working.
Do you think it's beneficial to have two different ways to match like:
handleCreate('person', { partial_match: { name: 'blah' } })
handleCreate('person', { exact_match: { name: 'blah', age: 30 } })
I am thinking that sometimes you might want an exact match sometimes??
from ember-data-factory-guy.
@danielspaniel I think if you can do partial_match
, we do not need exact match, just match. When I see match: {field: 'value'}
I expect that field value must be "value", I don't tell anything else about rest of the fields with this code, IMO.
from ember-data-factory-guy.
Right .. I see what you mean .. just match as many attributes as you have. Ok .. will work on the partial match and let you know when I am done.
from ember-data-factory-guy.
@yratanov, this issue is now fixed in v0.9.5. Ie. you can now do partial matches.
Check it out and let me know if you see any problems though.
from ember-data-factory-guy.
Related Issues (20)
- `mockFindAll` should be able to also `mockFindRecord`
- Nothing returned by handler for mockQueryRecord when mocking ember-simple-auth currentUser HOT 20
- 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.