Completed
Push — master ( abbcf0...d5b928 )
by Taavo-Taur
01:20
created

test/helpers/before/vue-hookup.js   A

Complexity

Total Complexity 5
Complexity/F 1.67

Size

Lines of Code 30
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
c 2
b 0
f 0
nc 1
dl 0
loc 30
rs 10
wmc 5
mnd 1
bc 5
fnc 3
bpm 1.6666
cpm 1.6666
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A vue-hookup.js ➔ addVueWithPlugin 0 17 1
A vue-hookup.js ➔ vueCleanup 0 9 3
1
import BaseVue from 'vue'
2
import VueSyncersFeathers from '../../../src'
3
4
export function addVueWithPlugin(t, options) {
5
	const Vue = t.context.Vue = BaseVue.extend()
6
7
	// Because we're installing onto extended vue instance copy global methods to new instance
8
	Vue.version = BaseVue.version
9
	Vue.util = BaseVue.util
10
	Vue.set = BaseVue.set
11
	Vue.delete = BaseVue.delete
12
	Vue.nextTick = BaseVue.nextTick
13
	Vue.config = BaseVue.config // Not cloned
14
	// To reference the right Vue instance
15
	Vue.mixin = function (mixin) {
16
		Vue.options = Vue.util.mergeOptions(Vue.options, mixin)
17
	}
18
19
	BaseVue.use.call(Vue, {install: VueSyncersFeathers.install}, options)
20
}
21
22
export function vueCleanup(t) {
23
	if (t.context.instance) {
24
		t.context.instance.$destroy()
25
		delete t.context.instance
26
	}
27
	if (t.context.Vue) {
28
		delete t.context.Vue
29
	}
30
}
31