lint also tests folder
This commit is contained in:
		| @ -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 | ||||
|  | ||||
| @ -437,24 +437,24 @@ export default class Torrent extends Component { | ||||
|   								</ToolTip> | ||||
|   								: | ||||
|   								this.state.startingDownloading && !this.state.downloading | ||||
| 									  ? | ||||
| 									  <ToolTip hint={__('Serching metadata in progress... Click will delete this torrent.')} right={true}> | ||||
|   									<div className="overlay-loader" onClick={(e) => { | ||||
|   										e.preventDefault(); | ||||
|   										e.stopPropagation(); | ||||
|   										window.torrentSocket.emit('downloadCancel', torrent.hash) | ||||
|   									}}> | ||||
|   										<div className="loader"> | ||||
|   											<div></div> | ||||
|   											<div></div> | ||||
|   											<div></div> | ||||
|   											<div></div> | ||||
|   											<div></div> | ||||
|   											<div></div> | ||||
|   											<div></div> | ||||
|   									? | ||||
|   									<ToolTip hint={__('Serching metadata in progress... Click will delete this torrent.')} right={true}> | ||||
|   										<div className="overlay-loader" onClick={(e) => { | ||||
|   											e.preventDefault(); | ||||
|   											e.stopPropagation(); | ||||
|   											window.torrentSocket.emit('downloadCancel', torrent.hash) | ||||
|   										}}> | ||||
|   											<div className="loader"> | ||||
|   												<div></div> | ||||
|   												<div></div> | ||||
|   												<div></div> | ||||
|   												<div></div> | ||||
|   												<div></div> | ||||
|   												<div></div> | ||||
|   												<div></div> | ||||
|   											</div> | ||||
|   										</div> | ||||
|   									</div> | ||||
| 									  </ToolTip> | ||||
|   									</ToolTip> | ||||
|   									: | ||||
|   									this.state.downloaded | ||||
|   										? | ||||
|  | ||||
| @ -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 | ||||
| }; | ||||
|  | ||||
| @ -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) | ||||
| 	}) | ||||
| }); | ||||
|  | ||||
| @ -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 | ||||
| }); | ||||
|  | ||||
| @ -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() | ||||
| 		}) | ||||
| 	}) | ||||
| }); | ||||
|  | ||||
| @ -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()) | ||||
| 		}) | ||||
| 	}); | ||||
|    | ||||
| }); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user