Skip to content
Prev Previous commit
Next Next commit
Changes to test spec
  • Loading branch information
DaBs committed Aug 11, 2016
commit 3e67330143f1364ead179e8a110434a6ab024256
30 changes: 11 additions & 19 deletions tests/vuefire.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ var firebaseApp = Firebase.initializeApp({

describe('VueFire', function () {
var firebaseRef
var firebaseDb

beforeEach(function (done) {
firebaseDb = firebaseApp.database()
firebaseRef = firebaseDb.ref()
firebaseRef = firebaseApp.database().ref()
firebaseRef.remove(function (error) {
if (error) {
done(error)
Expand All @@ -27,33 +25,27 @@ describe('VueFire', function () {
})
})

describe('is callable as Function', function () {
describe('support Function options', function () {
it('returns correct ref on function call', function (done) {
var ChildComponent = Vue.extend({
name: 'ChildComponent',
firebase: function () {
expect(this.$root.database).to.deep.equal(firebaseDb)
done()
},
template: '<div>test</div>'
})
var firebaseDb = firebaseApp.database()
new Vue({
data: function () {
return {
database: firebaseDb
}
},
ready: function () {
expect('poop').to.equal('notpoop')
},
components: {
'child-component': ChildComponent
'child-component': Vue.extend({
name: 'ChildComponent',
firebase: function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you actually need to have a child component?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could easily be simplified to simply test the call of the function. I'll change immediately.

expect(this.$root.database).to.deep.equal(firebaseDb)
done()
},
template: '<div>test</div>'
})
},
template: '<div><child-component></child-component></div>'
}).$mount()
Vue.nextTick(function () {

})
})
})

Expand Down