fix bad rpc finding for class member for real this time
This commit is contained in:
@@ -4,6 +4,7 @@ import { RPCServer, RPCSocket, SubscriptionResponse, makeSubResponse } from '../
|
||||
import * as uuidv4 from "uuid/v4"
|
||||
import { doesNotReject } from "assert";
|
||||
import { Socket } from "dgram";
|
||||
import { RPCExporter } from "../src/Interfaces";
|
||||
|
||||
const add = (...args:number[]) => {return args.reduce((a,b)=>a+b, 0)}
|
||||
function makeServer(){
|
||||
@@ -499,4 +500,34 @@ describe("Errorhandler functionality", ()=>{
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe("Class binding", ()=>{
|
||||
|
||||
class MyExporter implements RPCExporter{
|
||||
name = "MyExporter";
|
||||
exportRPCs = () => [
|
||||
this.myRPC
|
||||
]
|
||||
|
||||
myRPC = () => "Hello World"
|
||||
|
||||
}
|
||||
|
||||
it("binds correctly", (done)=>{
|
||||
const exporter = new MyExporter()
|
||||
const serv = new RPCServer(21004, [exporter])
|
||||
const sock = new RPCSocket(21004, 'localhost')
|
||||
sock.connect().then(sock => {
|
||||
if(sock.MyExporter && sock.MyExporter.myRPC){
|
||||
done()
|
||||
}
|
||||
})
|
||||
.catch(done)
|
||||
.finally(() => {
|
||||
sock.destroy()
|
||||
serv.destroy()
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user