Skip to content

Commit 220ec5a

Browse files
Merge pull request #26 from richardeschloss/development
Development
2 parents 630397c + 50a4048 commit 220ec5a

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ test_unit:
2222
- npm install
2323
- npm run test:unit:cov
2424
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
25+
artifacts:
26+
paths:
27+
- coverage
2528

2629
test_e2e:
2730
script:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# Change Log
33
All notable changes to this project will be documented in this file.
44

5+
## [1.0.5] - 2019-12-06
6+
7+
### Added
8+
9+
- Check for missing vuex options; i.e., missing mutations or actions
10+
511
## [1.0.4] - 2019-11-19
612

713
### Changed

io/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function nuxtSocket(ioOpts) {
6363
}
6464
Object.entries(storeFns).forEach(([group, fn]) => {
6565
const groupOpts = vuexOpts[group]
66-
if (groupOpts.length && groupOpts.length > 0) {
66+
if (groupOpts && groupOpts.constructor.name === 'Array' && groupOpts.length > 0) {
6767
groupOpts.forEach((item) => {
6868
let evt = null
6969
let mappedItem = null

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuxt-socket-io",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Socket.io module for Nuxt. Just plug it in and GO",
55
"author": "Richard Schloss",
66
"main": "io/module.js",

test/specs/Plugin.spec.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,38 @@ test('Socket plugin (malformed vuex options)', async (t) => {
129129
await loadPlugin(t)
130130
})
131131

132+
test('Socket plugin (vuex options missing mutations)', async (t) => {
133+
const testCfg = {
134+
sockets: [
135+
{
136+
default: true,
137+
url: 'http://localhost:3000',
138+
vuex: {
139+
actions: []
140+
}
141+
}
142+
]
143+
}
144+
pOptions.set(testCfg)
145+
await loadPlugin(t)
146+
})
147+
148+
test('Socket plugin (vuex options missing actions)', async (t) => {
149+
const testCfg = {
150+
sockets: [
151+
{
152+
default: true,
153+
url: 'http://localhost:3000',
154+
vuex: {
155+
mutations: []
156+
}
157+
}
158+
]
159+
}
160+
pOptions.set(testCfg)
161+
await loadPlugin(t)
162+
})
163+
132164
test('Socket plugin (vuex opts as strings)', async (t) => {
133165
const testCfg = {
134166
sockets: [

0 commit comments

Comments
 (0)