fix(qdreader): match upstream finishWatch payload
This commit is contained in:
@@ -966,6 +966,37 @@ test('adv task accepts nested data result 9 with empty message from sign gateway
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
test('finishWatch payload matches upstream lowercase taskId and full captcha field names', () => {
|
||||
const store = {
|
||||
qdreader_cookie_json: JSON.stringify({ '12345': cookie }),
|
||||
qdreader_user_bind_json: JSON.stringify({ '12345': 'user-a' }),
|
||||
qdreader_task_pref_json: JSON.stringify({ '12345': { adv: true } }),
|
||||
};
|
||||
const r = runPlugin({
|
||||
content: '启点签到',
|
||||
store,
|
||||
userId: 'user-a',
|
||||
requests: [
|
||||
{ body: { code: 0, data: { headers: { 'QD-Sign': 'sig' } } } },
|
||||
{ statusCode: 200, body: { code: 1, msg: '今日已签到' } },
|
||||
{ body: { code: 0, data: { headers: { 'QD-Sign': 'sig' } } } },
|
||||
{ statusCode: 200, body: { code: 1, msg: '无可领取礼包' } },
|
||||
{ body: { code: 0, data: { headers: { 'QD-Sign': 'sig' } } } },
|
||||
{ statusCode: 200, body: { code: 0, Data: { VideoRewardTab: { TaskList: [{ TaskId: '1187767793786748928', Title: '激励碎片', IsFinished: 0 }] } } } },
|
||||
{ body: { code: 0, data: { headers: { 'QD-Sign': 'sig' } } } },
|
||||
{ statusCode: 200, body: { result: 9, message: '' } },
|
||||
{ body: { code: 0, data: { headers: { 'QD-Sign': 'sig' } } } },
|
||||
{ statusCode: 200, body: { code: 0, Data: { VideoRewardTab: { TaskList: [{ TaskId: '1187767793786748928', Title: '激励碎片', IsFinished: 1 }] } } } },
|
||||
],
|
||||
});
|
||||
const finishCall = r.calls.find(c => /video\/adv\/finishWatch$/.test(c.url));
|
||||
assert.ok(finishCall, 'finishWatch request should be issued');
|
||||
assert.equal(finishCall.body, 'taskId=1187767793786748928&BanId=0&BanMessage=&CaptchaAId=&CaptchaURL=&CaptchaType=0&Challenge=&Gt=&NewCaptcha=0&Offline=0&PhoneNumber=&SessionKey=');
|
||||
assert.doesNotMatch(finishCall.body, /TaskId=/);
|
||||
assert.doesNotMatch(finishCall.body, /Fee=|Gif=|PhoneTicket=/);
|
||||
});
|
||||
test('adv task submits each unfinished upstream list item once before verification', () => {
|
||||
const store = {
|
||||
qdreader_cookie_json: JSON.stringify({ '12345': cookie }),
|
||||
|
||||
Reference in New Issue
Block a user