Skip to content

Commit e4499bf

Browse files
committed
Fixed tslint errors
1 parent 5d82a30 commit e4499bf

File tree

2 files changed

+88
-85
lines changed

2 files changed

+88
-85
lines changed

src/gotham-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default class GothamModule {
9999
);
100100
} else {
101101
if (this.messagBuffer) {
102-
this.messagBuffer = Buffer.concat([this.messagBuffer, encoded])
102+
this.messagBuffer = Buffer.concat([this.messagBuffer, encoded]);
103103
} else {
104104
this.messagBuffer = encoded;
105105
}

test/gotham-node.test.ts

Lines changed: 87 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ makeConnectionTests('Initalize Tests', function () {
5050
});
5151
this.test.conn.sendResponse({
5252
requestId: '123',
53-
hook: "gotham.activated",
53+
hook: 'gotham.activated',
5454
type: 8
5555
});
5656
expect(p).to.eventually.equal(true);
@@ -65,7 +65,7 @@ makeConnectionTests('Test if requests constructed correctly', function () {
6565
this.test.module.declareFunction('test_fn', () => { });
6666
const message = this.test.getLatestSent();
6767
expect(message).excluding('requestId').to.deep.equal({
68-
function: "test_fn",
68+
function: 'test_fn',
6969
type: 9
7070
});
7171
});
@@ -75,7 +75,7 @@ makeConnectionTests('Test if requests constructed correctly', function () {
7575
this.test.module.callFunction('module.test_fn');
7676
const message = this.test.getLatestSent();
7777
expect(message).excluding('requestId').to.deep.equal({
78-
function: "module.test_fn",
78+
function: 'module.test_fn',
7979
type: 3,
8080
arguments: {}
8181
});
@@ -88,7 +88,7 @@ makeConnectionTests('Test if requests constructed correctly', function () {
8888
});
8989
const message = this.test.getLatestSent();
9090
expect(message).excluding('requestId').to.deep.equal({
91-
function: "module.test_fn",
91+
function: 'module.test_fn',
9292
type: 3,
9393
arguments: {
9494
a: 1,
@@ -101,7 +101,7 @@ makeConnectionTests('Test if requests constructed correctly', function () {
101101
this.test.module.registerHook('test_hook', () => { });
102102
const message = this.test.getLatestSent();
103103
expect(message).excluding('requestId').to.deep.equal({
104-
hook: "test_hook",
104+
hook: 'test_hook',
105105
type: 5,
106106
});
107107
});
@@ -111,89 +111,92 @@ makeConnectionTests('Test if requests constructed correctly', function () {
111111
const message = this.test.getLatestSent();
112112
expect(message).excluding('requestId').to.deep.equal({
113113
type: 7,
114-
hook: "test_hook",
114+
hook: 'test_hook',
115115
});
116116
});
117117
});
118118

119119

120-
makeConnectionTests('Test if responses from gotham parsed correctly', async function () {
121-
it('declareFunction', async function () {
122-
const p = this.test.module.declareFunction('test_fn', () => {});
123-
const requestId = this.test.getLatestSent().requestId;
124-
await sleep(0);
125-
this.test.conn.sendResponse({
126-
requestId,
127-
type: 10,
128-
function: 'test_fn'
129-
});
130-
return expect(p).to.eventually.equal(true);
131-
});
132-
it('hookRegistered', async function () {
133-
const p = this.test.module.registerHook('test_hook', () => {});
134-
await sleep(0);
135-
const requestId = this.test.getLatestSent().requestId;
136-
this.test.conn.sendResponse({
137-
requestId,
138-
type: 6,
139-
});
140-
141-
return expect(p).to.eventually.equal(true);
142-
});
143-
144-
it('hookTriggered', async function() {
145-
const fn = sinon.fake();
146-
const p = this.test.module.registerHook('test_hook', fn);
147-
await sleep(0);
148-
this.test.conn.sendResponse({
149-
requestId: '12345',
150-
type: 8,
151-
hook: 'test_hook'
152-
});
153-
// await sleep(0);
154-
assert(fn.calledOnce);
155-
});
156-
157-
it('functionCall', async function() {
158-
const fn = sinon.fake();
159-
const p = this.test.module.declareFunction('test_fn', fn);
160-
await sleep(0);
161-
162-
this.test.conn.sendResponse({
163-
requestId: '12345',
164-
type: 3,
165-
function: 'test_fn'
166-
});
167-
168-
assert(fn.calledOnce);
169-
170-
this.test.conn.sendResponse({
171-
requestId: '12345',
172-
type: 3,
173-
function: 'test_fn',
174-
arguments: {a : 1, b: 2}
175-
});
176-
177-
expect(fn.getCall(1).args[0]).to.deep.equal({a : 1, b: 2});
178-
});
179-
180-
it('functionResponse', async function() {
181-
const p = this.test.module.callFunction('module.test_fn');
182-
await sleep(0);
183-
const requestId = this.test.getLatestSent().requestId;
184-
185-
this.test.conn.sendResponse({
186-
requestId,
187-
type: 4,
188-
data: {
189-
a:1,
120+
makeConnectionTests(
121+
'Test if responses from gotham parsed correctly',
122+
async function () {
123+
it('declareFunction', async function () {
124+
const p = this.test.module.declareFunction('test_fn', () => { });
125+
const requestId = this.test.getLatestSent().requestId;
126+
await sleep(0);
127+
this.test.conn.sendResponse({
128+
requestId,
129+
type: 10,
130+
function: 'test_fn'
131+
});
132+
return expect(p).to.eventually.equal(true);
133+
});
134+
it('hookRegistered', async function () {
135+
const p = this.test.module.registerHook('test_hook', () => { });
136+
await sleep(0);
137+
const requestId = this.test.getLatestSent().requestId;
138+
this.test.conn.sendResponse({
139+
requestId,
140+
type: 6,
141+
});
142+
143+
return expect(p).to.eventually.equal(true);
144+
});
145+
146+
it('hookTriggered', async function () {
147+
const fn = sinon.fake();
148+
const p = this.test.module.registerHook('test_hook', fn);
149+
await sleep(0);
150+
this.test.conn.sendResponse({
151+
requestId: '12345',
152+
type: 8,
153+
hook: 'test_hook'
154+
});
155+
// await sleep(0);
156+
assert(fn.calledOnce);
157+
});
158+
159+
it('functionCall', async function () {
160+
const fn = sinon.fake();
161+
const p = this.test.module.declareFunction('test_fn', fn);
162+
await sleep(0);
163+
164+
this.test.conn.sendResponse({
165+
requestId: '12345',
166+
type: 3,
167+
function: 'test_fn'
168+
});
169+
170+
assert(fn.calledOnce);
171+
172+
this.test.conn.sendResponse({
173+
requestId: '12345',
174+
type: 3,
175+
function: 'test_fn',
176+
arguments: { a: 1, b: 2 }
177+
});
178+
179+
expect(fn.getCall(1).args[0]).to.deep.equal({ a: 1, b: 2 });
180+
});
181+
182+
it('functionResponse', async function () {
183+
const p = this.test.module.callFunction('module.test_fn');
184+
await sleep(0);
185+
const requestId = this.test.getLatestSent().requestId;
186+
187+
this.test.conn.sendResponse({
188+
requestId,
189+
type: 4,
190+
data: {
191+
a: 1,
192+
b: 2
193+
}
194+
});
195+
196+
return expect(p).to.eventually.deep.equal({
197+
a: 1,
190198
b: 2
191-
}
192-
});
193-
194-
return expect(p).to.eventually.deep.equal({
195-
a:1,
196-
b:2
199+
});
197200
});
198-
});
199-
});
201+
}
202+
);

0 commit comments

Comments
 (0)