Files
spark/src/web/api/__tests__/ServiceContext.test.ts
T

27 lines
793 B
TypeScript

import {root} from 'proto'
import { connect, ServiceContext } from '../src/ServiceContext'
import { HelloService } from '../src/HelloService'
test('log in and say hi', async () => {
let ctx = await connect("bts", "password");
expect(ctx instanceof ServiceContext).toBe(true)
const hello = new HelloService(<ServiceContext>ctx)
const reply = await hello.say_hello({ name: "Bob" })
expect(reply.message).toBe("hello Bob")
console.log(reply.message)
}, 15000);
test('api_errors_updated', () => {
const ResponseHeader = root.lookupType("bts.api.ResponseHeader")
const rh = ResponseHeader.encode({
request_id: 42,
code: 3
}).finish()
const round = ResponseHeader.decode(rh)
expect(round).toBeDefined()
});