Skip to content

Commit 630397c

Browse files
Merge pull request #22 from richardeschloss/development
Proper mocking
2 parents 55c38b6 + 900ac5c commit 630397c

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

nuxt.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ module.exports = {
7777
** You can extend webpack config here
7878
*/
7979
extend(config, ctx) {},
80-
parallel: true,
81-
cache: true,
82-
hardSource: true
80+
parallel: false,
81+
cache: false,
82+
hardSource: false
8383
},
8484
globals: {
8585
loadingTimeout: 5000

test/specs/Plugin.spec.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,22 @@ function loadPlugin(t, ioOpts = {}) {
2929
return new Promise((resolve, reject) => {
3030
const context = {}
3131
Plugin(context, (label, NuxtSocket) => {
32-
const testObj = {
33-
$store: {
34-
commit: (msg) => {
35-
consola.log('commit', msg)
36-
},
37-
dispatch: (msg) => {
38-
consola.log('dispatch', msg)
39-
},
40-
watch: (stateCb, dataCb) => {
41-
stateCb(state)
42-
dataCb({ sample: 123 })
43-
}
32+
context.$store = {
33+
commit: (msg) => {
34+
consola.log('commit', msg)
4435
},
45-
testSocket: NuxtSocket
36+
dispatch: (msg) => {
37+
consola.log('dispatch', msg)
38+
},
39+
watch: (stateCb, dataCb) => {
40+
stateCb(state)
41+
dataCb({ sample: 123 })
42+
}
4643
}
44+
context[label] = NuxtSocket
4745

4846
try {
49-
const socket = testObj.testSocket(ioOpts)
47+
const socket = context[label](ioOpts)
5048
t.is(label, 'nuxtSocket')
5149
t.is(typeof NuxtSocket, 'function')
5250
t.is(NuxtSocket.name, 'nuxtSocket')

0 commit comments

Comments
 (0)