Skip to content

Commit 8884f3b

Browse files
committed
Fix tslint issues
1 parent 8e93a49 commit 8884f3b

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

tests/cases/unittests/session.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module ts.server {
3030
};
3131

3232
describe('the Session class', () => {
33-
let session:Session,
34-
lastSent:protocol.Message;
33+
let session: Session,
34+
lastSent: protocol.Message;
3535

3636
beforeEach(() => {
3737
session = new Session(mockHost, Buffer.byteLength, process.hrtime, mockLogger);
@@ -111,10 +111,10 @@ module ts.server {
111111
type: 'command'
112112
};
113113
session.onMessage(JSON.stringify(req));
114-
req.seq+=2;
114+
req.seq += 2;
115115
req.arguments = {};
116116
session.onMessage(JSON.stringify(req));
117-
req.seq+=2;
117+
req.seq += 2;
118118
req.arguments = null;
119119
session.onMessage(JSON.stringify(req));
120120
}
@@ -147,7 +147,7 @@ module ts.server {
147147

148148
describe('exit', () => {
149149
it('is a noop which can be handled by subclasses', () => {
150-
session.exit(); //does nothing, should keep running tests
150+
session.exit(); // Does nothing, should keep running tests
151151
expect(session).to.exist;
152152
});
153153
});
@@ -156,7 +156,7 @@ module ts.server {
156156
it('is an overrideable handle which sends protocol messages over the wire', () => {
157157
let msg = {seq: 0, type: 'none'},
158158
strmsg = JSON.stringify(msg),
159-
len = 1+Buffer.byteLength(strmsg, 'utf8'),
159+
len = 1 + Buffer.byteLength(strmsg, 'utf8'),
160160
resultMsg = `Content-Length: ${len}\r\n\r\n${strmsg}\n`;
161161

162162
session.send = Session.prototype.send;
@@ -246,7 +246,7 @@ module ts.server {
246246
describe('how Session is extendable via subclassing', () => {
247247
let TestSession = class extends Session {
248248
lastSent: protocol.Message;
249-
customHandler:string = 'testhandler';
249+
customHandler: string = 'testhandler';
250250
constructor(){
251251
super(mockHost, Buffer.byteLength, process.hrtime, mockLogger);
252252
this.addProtocolHandler(this.customHandler, () => {
@@ -338,8 +338,9 @@ module ts.server {
338338
}
339339

340340
handleRequest(msg: protocol.Request) {
341+
let response: protocol.Response;
341342
try {
342-
var {response} = this.executeCommand(msg);
343+
response = this.executeCommand(msg).response;
343344
} catch (e) {
344345
this.output(undefined, msg.command, msg.seq, e.toString());
345346
return;
@@ -351,27 +352,27 @@ module ts.server {
351352

352353
consumeQueue() {
353354
while (this.queue.length > 0) {
354-
let elem = this.queue[this.queue.length-1];
355-
this.queue = this.queue.slice(0,this.queue.length-1);
355+
let elem = this.queue[this.queue.length - 1];
356+
this.queue = this.queue.slice(0, this.queue.length - 1);
356357
this.handleRequest(elem);
357358
}
358359
}
359360
},
360361
InProcClient = class {
361-
private server: Session&{enqueue: (msg: protocol.Request) => void};
362+
private server: Session & {enqueue: (msg: protocol.Request) => void};
362363
private seq: number = 0;
363364
private callbacks: ts.Map<(resp: protocol.Response) => void> = {};
364365
private eventHandlers: ts.Map<(args: any) => void> = {};
365366

366367
handle(msg: protocol.Message): void {
367368
if (msg.type === 'response') {
368-
var response = <protocol.Response>msg;
369+
let response = <protocol.Response>msg;
369370
if (this.callbacks[response.request_seq]) {
370371
this.callbacks[response.request_seq](response);
371372
delete this.callbacks[response.request_seq];
372373
}
373374
} else if (msg.type === 'event') {
374-
var event = <protocol.Event>msg;
375+
let event = <protocol.Event>msg;
375376
this.emit(event.event, event.body);
376377
}
377378
}
@@ -387,7 +388,7 @@ module ts.server {
387388
this.eventHandlers[name] = handler;
388389
}
389390

390-
connect(session: Session&{enqueue: (msg: protocol.Request) => void}): void {
391+
connect(session: Session & {enqueue: (msg: protocol.Request) => void}): void {
391392
this.server = session;
392393
}
393394

@@ -417,28 +418,28 @@ module ts.server {
417418
},
418419
responses = 0;
419420

420-
//Connect the client
421+
// Connect the client
421422
cli.connect(session);
422423

423-
//add an event handler
424+
// Add an event handler
424425
cli.on('testevent', (eventinfo) => {
425426
expect(eventinfo).to.equal(toEvent);
426427
responses++;
427428
expect(responses).to.equal(1);
428429
});
429430

430-
//trigger said event from the server
431-
session.event(toEvent,'testevent');
431+
// Trigger said event from the server
432+
session.event(toEvent, 'testevent');
432433

433-
//Queue an echo command
434+
// Queue an echo command
434435
cli.execute('echo', toEcho, (resp) => {
435436
assert(resp.success, resp.message);
436437
responses++;
437438
expect(responses).to.equal(2);
438439
expect(resp.body).to.deep.equal(toEcho);
439440
});
440441

441-
//Queue a configure command
442+
// Queue a configure command
442443
cli.execute('configure', {
443444
hostInfo: 'unit test',
444445
formatOptions: {
@@ -451,7 +452,7 @@ module ts.server {
451452
done();
452453
});
453454

454-
//Consume the queue and trigger the callbacks
455+
// Consume the queue and trigger the callbacks
455456
session.consumeQueue();
456457
});
457458
});

0 commit comments

Comments
 (0)