mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-21 06:30:34 +03:00
@@ -0,0 +1,21 @@
|
||||
import Vue from 'vue'
|
||||
import VueNativeSock from '@/Main'
|
||||
|
||||
import { Server } from 'mock-socket'
|
||||
|
||||
describe("Main.js", () =>{
|
||||
|
||||
let mockServer
|
||||
|
||||
it ('can be bound to the onopen event', (done) => {
|
||||
mockServer = new Server('ws://localhost:8080')
|
||||
Vue.use(VueNativeSock, 'ws://localhost:8080', null)
|
||||
let vm = new Vue()
|
||||
vm.$options.sockets.onopen = (data) => {
|
||||
expect(data.type).to.equal('open')
|
||||
mockServer.stop(done)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user