From c086cd2087c27ae95cbd59f7b16091fabc748a89 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sat, 30 Jun 2018 02:03:43 +0300 Subject: [PATCH] lint also tests folder --- format.bat | 4 +- src/app/torrent.js | 34 +++++++-------- tests/application.js | 32 +++++++------- tests/bigtableapi.test.js | 50 +++++++++++----------- tests/init.js | 14 +++---- tests/sphinx.test.js | 88 +++++++++++++++++++-------------------- tests/spider.disabled.js | 30 ++++++------- 7 files changed, 126 insertions(+), 126 deletions(-) diff --git a/format.bat b/format.bat index c889749..2f5d875 100644 --- a/format.bat +++ b/format.bat @@ -1,2 +1,2 @@ -"d:\Program Files\Git\bin\bash.exe" -c "find src -name '*.js' ! -type d -exec bash -c 'expand -t 4 \"$0\" > /tmp/e && mv /tmp/e \"$0\"' {} \;" -node_modules\.bin\eslint --fix src +"d:\Program Files\Git\bin\bash.exe" -c "find src tests -name '*.js' ! -type d -exec bash -c 'expand -t 4 \"$0\" > /tmp/e && mv /tmp/e \"$0\"' {} \;" +node_modules\.bin\eslint --fix src tests diff --git a/src/app/torrent.js b/src/app/torrent.js index f7779f9..ad4f715 100644 --- a/src/app/torrent.js +++ b/src/app/torrent.js @@ -437,24 +437,24 @@ export default class Torrent extends Component { : this.state.startingDownloading && !this.state.downloading - ? - -
{ - e.preventDefault(); - e.stopPropagation(); - window.torrentSocket.emit('downloadCancel', torrent.hash) - }}> -
-
-
-
-
-
-
-
+ ? + +
{ + e.preventDefault(); + e.stopPropagation(); + window.torrentSocket.emit('downloadCancel', torrent.hash) + }}> +
+
+
+
+
+
+
+
+
-
- + : this.state.downloaded ? diff --git a/tests/application.js b/tests/application.js index d7706f6..62ab2eb 100644 --- a/tests/application.js +++ b/tests/application.js @@ -2,26 +2,26 @@ import electron from "electron"; import { Application } from "spectron"; const startApplication = function() { - this.timeout(30000); - this.app = new Application({ - path: electron, - args: ["."], - startTimeout: 30000, - waitTimeout: 30000, - quitTimeout: 10000 - }); - return this.app.start(); + this.timeout(30000); + this.app = new Application({ + path: electron, + args: ["."], + startTimeout: 30000, + waitTimeout: 30000, + quitTimeout: 10000 + }); + return this.app.start(); }; const stopApplication = function() { - this.timeout(30000); - if (this.app && this.app.isRunning()) { - return this.app.stop(); - } - return undefined; + this.timeout(30000); + if (this.app && this.app.isRunning()) { + return this.app.stop(); + } + return undefined; }; export { - startApplication, - stopApplication + startApplication, + stopApplication }; diff --git a/tests/bigtableapi.test.js b/tests/bigtableapi.test.js index 95bc79d..ef17a7c 100644 --- a/tests/bigtableapi.test.js +++ b/tests/bigtableapi.test.js @@ -6,34 +6,34 @@ const {pool} = require('../src/background/mysql') const forBigTable = require('../src/background/forBigTable') describe("big table for check", () => { - let sphinx; + let sphinx; - it("init", function() { - sphinx = pool() - expect(sphinx) - }) + it("init", function() { + sphinx = pool() + expect(sphinx) + }) - it("insert 13 records for big table check", async function() { - for(let i = 1; i < 14; i++) - await sphinx.query(`insert into feed(id, data) values(${i}, 'a')`) - }) + it("insert 13 records for big table check", async function() { + for(let i = 1; i < 14; i++) + await sphinx.query(`insert into feed(id, data) values(${i}, 'a')`) + }) - it("for each 3 records of big table", async function() { - const records = [] - await forBigTable(sphinx, 'feed', record => records.push(record), null, 3) - expect(records.length === 13) - }) + it("for each 3 records of big table", async function() { + const records = [] + await forBigTable(sphinx, 'feed', record => records.push(record), null, 3) + expect(records.length === 13) + }) - it("for each 13 records of big table", async function() { - const records = [] - await forBigTable(sphinx, 'feed', record => records.push(record), null, 13) - expect(records.length === 13) - expect(records[1].id === 2) - }) + it("for each 13 records of big table", async function() { + const records = [] + await forBigTable(sphinx, 'feed', record => records.push(record), null, 13) + expect(records.length === 13) + expect(records[1].id === 2) + }) - it("for each 15 records of big table", async function() { - const records = [] - await forBigTable(sphinx, 'feed', record => records.push(record), null, 15) - expect(records.length === 13) - }) + it("for each 15 records of big table", async function() { + const records = [] + await forBigTable(sphinx, 'feed', record => records.push(record), null, 15) + expect(records.length === 13) + }) }); diff --git a/tests/init.js b/tests/init.js index 6c387f5..fefa84c 100644 --- a/tests/init.js +++ b/tests/init.js @@ -1,13 +1,13 @@ import {startApplication, stopApplication} from "../tests/application"; describe("application", () => { - before(startApplication); - after(stopApplication); + before(startApplication); + after(stopApplication); - it("check start", async function() { - const { app } = this - await app.client.waitForExist('#index-window') - }); + it("check start", async function() { + const { app } = this + await app.client.waitForExist('#index-window') + }); - //TESTS + //TESTS }); diff --git a/tests/sphinx.test.js b/tests/sphinx.test.js index d81d68a..f13013f 100644 --- a/tests/sphinx.test.js +++ b/tests/sphinx.test.js @@ -4,58 +4,58 @@ const mysql = require('mysql') const config = require('../src/background/config') describe("sphinx", () => { - let sphinx; + let sphinx; - it("init", function() { - sphinx = mysql.createPool({ - connectionLimit: config.sphinx.connectionLimit, - host : config.sphinx.host, - port : config.sphinx.port - }); - expect(sphinx) - }) + it("init", function() { + sphinx = mysql.createPool({ + connectionLimit: config.sphinx.connectionLimit, + host : config.sphinx.host, + port : config.sphinx.port + }); + expect(sphinx) + }) - it("insert", function(done) { - sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(1, 'a', 'bashaa', 'bashaa', 50)", (err) => { - if(err) - throw new Error(err) + it("insert", function(done) { + sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(1, 'a', 'bashaa', 'bashaa', 50)", (err) => { + if(err) + throw new Error(err) - sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(2, 'b', 'biotu', 'biotu', 30)", (err) => { - if(err) - throw new Error(err) + sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(2, 'b', 'biotu', 'biotu', 30)", (err) => { + if(err) + throw new Error(err) - done() - }) - }) - }) + done() + }) + }) + }) - it("select", function(done) { - sphinx.query("select * from files where hash = 'a'", (err, result) => { - if(!result) - throw new Error(err) - if(result.length !== 1) - throw new Error('not one result') + it("select", function(done) { + sphinx.query("select * from files where hash = 'a'", (err, result) => { + if(!result) + throw new Error(err) + if(result.length !== 1) + throw new Error('not one result') - if(result[0].size !== 50) - throw new Error('not 50 in field') + if(result[0].size !== 50) + throw new Error('not 50 in field') - done() - }) - }) + done() + }) + }) - it("search", function(done) { - sphinx.query("select * from files where MATCH('bashaa')", (err, result) => { - if(!result) - throw new Error(err) - if(result.length !== 1) - throw new Error('not one result') + it("search", function(done) { + sphinx.query("select * from files where MATCH('bashaa')", (err, result) => { + if(!result) + throw new Error(err) + if(result.length !== 1) + throw new Error('not one result') - if(result[0].hash !== 'a') - throw new Error('not a in hash') - if(result[0].size !== 50) - throw new Error('not 50 in field') + if(result[0].hash !== 'a') + throw new Error('not a in hash') + if(result[0].size !== 50) + throw new Error('not 50 in field') - done() - }) - }) + done() + }) + }) }); diff --git a/tests/spider.disabled.js b/tests/spider.disabled.js index 81c36f6..2ec5469 100644 --- a/tests/spider.disabled.js +++ b/tests/spider.disabled.js @@ -4,22 +4,22 @@ const client = new (require('../src/background/bt/client')) const spider = new (require('../src/background/bt/spider'))(client) describe("spider check", () => { - it("listen", function() { - spider.listen(4445) - }) + it("listen", function() { + spider.listen(4445) + }) - it("enshure hash recive", function(done) { - this.timeout(100000); - spider.once('ensureHash', () => done()) - }) + it("enshure hash recive", function(done) { + this.timeout(100000); + spider.once('ensureHash', () => done()) + }) - it("get metadata", function(done) { - this.timeout(120000); - client.once('complete', function (metadata, infohash, rinfo) { - expect(Buffer.isBuffer(infohash)) - expect(infohash.length == 20) - spider.close(() => done()) - }) - }); + it("get metadata", function(done) { + this.timeout(120000); + client.once('complete', function (metadata, infohash, rinfo) { + expect(Buffer.isBuffer(infohash)) + expect(infohash.length == 20) + spider.close(() => done()) + }) + }); });