Skip to content
This repository was archived by the owner on Dec 10, 2020. It is now read-only.

Commit 04bc8ff

Browse files
committed
Lint test/blockchain, test/integration
1 parent f9ffec9 commit 04bc8ff

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

test/blockchain/chain.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ defaultLogger.silent = true
77

88
// explicitly import util and buffer,
99
// needed for karma-typescript bundling
10-
import * as util from 'util'
11-
import { Buffer } from 'buffer'
10+
import * as util from 'util' //eslint-disable-line @typescript-eslint/no-unused-vars
11+
import { Buffer } from 'buffer' //eslint-disable-line @typescript-eslint/no-unused-vars
1212

1313
tape('[Chain]', (t) => {
1414
t.test('should test object creation without logger', (t) => {

test/integration/lightsync.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable */
2+
// TODO: re-enable linting. Disabled because much of test is commented out
3+
// resulting in unused variable false positives
14
import tape from 'tape'
25
import { FastEthereumService, LightEthereumService } from '../../lib/service'
36
import MockServer from './mocks/mockserver'

test/integration/mocks/mockserver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class MockServer extends Server {
2222
if (this.started) {
2323
return false
2424
}
25-
super.start()
25+
await super.start()
2626
await this.wait(1)
2727
if (this.location) {
2828
this.server = network.createServer(this.location)
@@ -33,8 +33,8 @@ export default class MockServer extends Server {
3333
})
3434
})
3535
}
36-
this.server.on('connection', (connection: any) => {
37-
this.connect(connection)
36+
this.server.on('connection', async (connection: any) => {
37+
await this.connect(connection)
3838
})
3939
return true
4040
}

test/integration/mocks/network.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EventEmitter } from 'events'
22

3-
const Pipe = function (id: any) {
3+
const Pipe = function () {
44
const buffer: any[] = []
55
let closed = false
66

@@ -36,8 +36,8 @@ const Pipe = function (id: any) {
3636
} as any
3737

3838
const Connection = function (protocols: any) {
39-
const outgoing = new Pipe('OUT')
40-
const incoming = new Pipe('IN')
39+
const outgoing = new Pipe()
40+
const incoming = new Pipe()
4141

4242
return {
4343
local: (remoteId: any) => ({
@@ -73,6 +73,16 @@ export function createServer(location: any) {
7373
return servers[location].server
7474
}
7575

76+
export function destroyConnection(id: any, location: any) {
77+
if (servers[location]) {
78+
const conn = servers[location].connections[id]
79+
if (conn) {
80+
conn.close()
81+
delete servers[location].connections[id]
82+
}
83+
}
84+
}
85+
7686
export function destroyServer(location: any) {
7787
if (servers[location]) {
7888
for (const id of Object.keys(servers[location].connections)) {
@@ -91,13 +101,3 @@ export function createConnection(id: any, location: any, protocols: any) {
91101
setTimeout(() => servers[location].server.emit('connection', connection.local(id)), 10)
92102
return connection.remote(location)
93103
}
94-
95-
export function destroyConnection(id: any, location: any) {
96-
if (servers[location]) {
97-
const conn = servers[location].connections[id]
98-
if (conn) {
99-
conn.close()
100-
delete servers[location].connections[id]
101-
}
102-
}
103-
}

0 commit comments

Comments
 (0)