V
V
Vadim2017-10-03 08:46:01
Ember.js
Vadim, 2017-10-03 08:46:01

How to populate firebase before running acceptance tests in ember?

 I'm trying to lock the base like this

moduleForAcceptance(name, {
    beforeEach () {
      scenarioDefault(server)

      stubFirebase()
      this.firebaseReference = createOfflineFirebaseReference(FIXTURE_DATA)
      replaceFirebaseReference(this.application, this.firebaseReference)

      if (options.beforeEach) {
        options.beforeEach.apply(this, arguments)
      }
    },

    afterEach () {
      if (options.afterEach) {
        options.afterEach.apply(this, arguments)
      }

      unstubFirebase()
    }
  })

where FIXTURE_DATA looks something like this
export default {

  "monthWeeks": {
    "month_1_tree_1_week_1": {
      "monthTree": "month_1_tree_1",
      "name": "1_Week_Name",
      "position": 0
    }
  },

  "monthTrees": {
    "month_1_tree_1": {
      "month": "month_1",
      "monthWeeks": {
        "month_1_tree_1_week_1": true
      }
    }
  },

  "months": {
    "month_1": {
      "name": "1_Name",
      "monthTree": "month_1_tree_1"
    },
    "month_2": {
      "name": "2_Name"
    }
  }
}

i'm using firebase adapters for all models (month, monthTree, monthWeek) but when debugging tests i see that all models hit the store but individually and not in a tree structure as expected and so for example i can't call such code because there is no such object and array in month, but separately monthWeeks is obtained. Any ideas why this might be happening? Thank you.
month.get('monthTree.monthWeeks.firstObject')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question