mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
build: Initial linting setup (#1560)
* sets up linting config and runs `yarn lint --fix` once, so that all changes will show up correctly in future PRs. * Note that there are still a lot of linter errors.
This commit is contained in:
committed by
Mayukha Vadari
parent
12cfed5c17
commit
8b95ee5fab
@@ -1,55 +1,46 @@
|
||||
import {Client, BroadcastClient} from 'xrpl-local'
|
||||
import { Client, BroadcastClient } from "xrpl-local";
|
||||
|
||||
const port = 34371
|
||||
const baseUrl = 'ws://testripple.circleci.com:'
|
||||
const port = 34371;
|
||||
const baseUrl = "ws://testripple.circleci.com:";
|
||||
|
||||
function setup(this: any, port_ = port) {
|
||||
const tclient = new Client(baseUrl + port_)
|
||||
const tclient = new Client(baseUrl + port_);
|
||||
return tclient
|
||||
.connect()
|
||||
.then(() => {
|
||||
return tclient.connection.request({
|
||||
// TODO: resolve when we redo the testing framework
|
||||
// @ts-ignore
|
||||
command: 'test_command',
|
||||
data: {openOnOtherPort: true}
|
||||
})
|
||||
command: "test_command",
|
||||
data: { openOnOtherPort: true },
|
||||
});
|
||||
})
|
||||
.then((got) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
// @ts-ignore
|
||||
this.client = new Client(baseUrl + got.port)
|
||||
this.client
|
||||
.connect()
|
||||
.then(resolve)
|
||||
.catch(reject)
|
||||
})
|
||||
this.client = new Client(baseUrl + got.port);
|
||||
this.client.connect().then(resolve).catch(reject);
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
return tclient.disconnect()
|
||||
})
|
||||
return tclient.disconnect();
|
||||
});
|
||||
}
|
||||
|
||||
function setupBroadcast(this: any) {
|
||||
const servers = [port, port + 1].map((port_) => baseUrl + port_)
|
||||
this.client = new BroadcastClient(servers)
|
||||
const servers = [port, port + 1].map((port_) => baseUrl + port_);
|
||||
this.client = new BroadcastClient(servers);
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.client
|
||||
.connect()
|
||||
.then(resolve)
|
||||
.catch(reject)
|
||||
})
|
||||
this.client.connect().then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
function teardown(this: any) {
|
||||
if (this.client.isConnected()) {
|
||||
return this.client.disconnect()
|
||||
return this.client.disconnect();
|
||||
}
|
||||
return undefined
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export default {
|
||||
setup: setup,
|
||||
teardown: teardown,
|
||||
setupBroadcast: setupBroadcast
|
||||
}
|
||||
setup,
|
||||
teardown,
|
||||
setupBroadcast,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user