dees-comms/test/test.browser.ts

21 lines
592 B
TypeScript
Raw Permalink Normal View History

2020-10-06 15:56:00 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
import * as deesComms from '../ts/index';
let deesCommsTest: deesComms.DeesComms;
2020-10-06 17:18:20 +00:00
tap.test('first test', async (tools) => {
2020-10-06 15:56:00 +00:00
deesCommsTest = new deesComms.DeesComms();
2020-10-06 17:18:20 +00:00
deesCommsTest.createTypedHandler<any>('test', async (requestData) => {
2020-12-21 12:07:34 +00:00
return { hitheretoo: `greetings to ${requestData.hithere}` };
2020-10-06 17:18:20 +00:00
});
// lets fire a request
const typedrequest = deesCommsTest.createTypedRequest<any>('test');
2020-10-06 21:49:03 +00:00
const result = await typedrequest.fire({
2020-12-21 12:07:34 +00:00
hithere: 'hello',
2020-10-06 17:18:20 +00:00
});
2020-10-06 21:49:03 +00:00
console.log(JSON.stringify(result));
2020-10-06 15:56:00 +00:00
});
tap.start();