import { expect } from 'chai'

import WebsocketClientPlugin from '../../src/plugin/wsclient'

/** @test {WebsocketClientPlugin} */
describe('WebsocketClientPlugin', () => {
  let plugin

  before(() => {
    plugin = new WebsocketClientPlugin({
      port: 8129,
      host: '127.0.0.1',
    })
  })

  it('merges the given options correctly', () => {
    expect(plugin.options.port).to.be.equals(8129)
    expect(plugin.options.host).to.be.equals('127.0.0.1')
    expect(plugin.options.secure).to.be.equals(false)
  })

  describe('status', () => {
    it('returns the initial status', () => {
      expect(plugin.status()).to.be.equals(-1)
    })
  })
})

@@ -35,61 +35,196 @@
 ort 
-WebsocketClientPlugin from '../../src/plugin/wsclient
+OSC from '../../src/osc'%0Aimport Message from '../../src/message'%0A%0Aimport WebsocketClientPlugin from '../../src/plugin/wsclient'%0Aimport WebsocketServerPlugin from '../../src/plugin/wsserver
 '%0A%0A/
@@ -313,16 +313,58 @@
 t plugin
+%0A  let osc%0A  let oscServer%0A  let oscBridge
 %0A%0A  befo
@@ -460,24 +460,265 @@
 0.1',%0A    %7D)
+%0A%0A    osc = new OSC(%7B%0A      discardLateMessages: true,%0A      plugin,%0A    %7D)%0A%0A    oscServer = new OSC(%7B%0A      discardLateMessages: true,%0A      plugin: new WebsocketServerPlugin(%7B%0A        port: 8129,%0A        host: '127.0.0.1',%0A      %7D),%0A    %7D)
 %0A  %7D)%0A%0A  it(
@@ -1053,16 +1053,16 @@
 als(-1)%0A
-
     %7D)%0A 
@@ -1065,11 +1065,917 @@
 %7D)%0A  %7D)%0A
+%0A%0A  describe('remote address info', () =%3E %7B%0A    it('returns the remote address info', () =%3E new Promise((resolve, reject) =%3E %7B%0A%0A      let message%0A      let rinfo%0A      let resolved = false%0A%0A      const expectedMessage = %7B%0A        offset: 24,%0A        address: '/test/path',%0A        types: ',ii',%0A        args: %5B 122, 554 %5D%0A      %7D%0A%0A      const expectedRinfo = %7B%0A        address: '127.0.0.1',%0A        family: 'IPv4',%0A        port: 8129,%0A        size: 24,%0A      %7D%0A%0A      oscServer.open()%0A      osc.open()%0A%0A      oscServer.on('/test/path', (a, b) =%3E %7B%0A        message = a%0A        rinfo = b%0A%0A        expect(message).to.deep.equal(expectedMessage)%0A        expect(rinfo).to.deep.equal(expectedRinfo)%0A%0A        resolve()%0A        resolved = true%0A      %7D)%0A%0A      osc.on('open', () =%3E osc.send(new Message('/test/path', 122, 554)))%0A%0A      setTimeout(() =%3E !resolved && reject(new Error('Timeout')), 1000)%0A    %7D))%0A  %7D)%0A
 %7D)%0A

Add test for WebSocket remote address info