mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
parent
223a6e13c9
commit
d205cb5ddc
@ -54,6 +54,9 @@ class Monitor extends Searcher {
|
|||||||
case 1001:
|
case 1001:
|
||||||
event_bus.emit('Turn_off_the_Monitor', '评论失败')
|
event_bus.emit('Turn_off_the_Monitor', '评论失败')
|
||||||
break;
|
break;
|
||||||
|
case 1004:
|
||||||
|
event_bus.emit('Turn_off_the_Monitor', '需要输入验证码')
|
||||||
|
break
|
||||||
case 2001:
|
case 2001:
|
||||||
event_bus.emit('Turn_off_the_Monitor', '关注出错')
|
event_bus.emit('Turn_off_the_Monitor', '关注出错')
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1,8 +1,31 @@
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const bili_client = require("../lib/net/bili");
|
const bili_client = require("../lib/net/bili");
|
||||||
|
const util = require('./util');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
assert(await bili_client.getMyinfo())
|
assert(await bili_client.getMyinfo());
|
||||||
assert.equal((await bili_client.getTopRcmd()).length, 10)
|
|
||||||
|
await util.par_run([
|
||||||
|
async () => {
|
||||||
|
assert.equal((await bili_client.getTopRcmd()).length, 10)
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
assert.equal(await bili_client.sendChat(
|
||||||
|
(await bili_client.getOneDynamicByDyid("692193323569381399")).desc.rid,
|
||||||
|
"test",
|
||||||
|
11),
|
||||||
|
7
|
||||||
|
)
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
assert.equal(await bili_client.sendChat(
|
||||||
|
(await bili_client.getOneDynamicByDyid("11229466874154064")).desc.rid,
|
||||||
|
"test",
|
||||||
|
1),
|
||||||
|
3
|
||||||
|
)
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
console.log("api.test ... ok!");
|
console.log("api.test ... ok!");
|
||||||
})()
|
})()
|
||||||
@ -3,7 +3,7 @@ const global_var = require("../lib/data/global_var");
|
|||||||
const { log } = require('../lib/utils');
|
const { log } = require('../lib/utils');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
log._level = 1
|
log._level = 0
|
||||||
env.init()
|
env.init()
|
||||||
global_var.init(process.env["COOKIE"], 1)
|
global_var.init(process.env["COOKIE"], 1)
|
||||||
|
|
||||||
|
|||||||
10
test/util.js
Normal file
10
test/util.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* @param {Array<()=>any>} fns
|
||||||
|
*/
|
||||||
|
function par_run(fns) {
|
||||||
|
return Promise.all((fns.map(fn => fn())))
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
par_run
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user