mardi 23 mai 2017

Unable to modify Ember mirage fixture from within acceptance test

I have a fixture create which looks somewhat like this.

path => mirage/fixtures/people.js

 export default {
      'people': [
        {
          'id': 1,
          'name': 'Ram',
         },
         {
          'id': 2,
          'name': 'Raja',
         }
       ]
    }

Inside my acceptance test I'm doing server.create('people'); which successfully returns this array of object. But within my test, I want to modify this people array and add, suppose another object { 'id': 3, 'name': 'John', }

Note: I dont want to use factories as I dont want all datas to be dynamically generated, so I want to take this array from fixtures, push my new object into this array and then return it. What is the correct way to do it?

Note2: Don't suggest adding this object in fixtures itself, because I want to dynamically add items to the fixture based on conditions in my test.




Aucun commentaire:

Enregistrer un commentaire