From ed5bde77e0b2fda010706a5269d700adf58b79b9 Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Sat, 27 Mar 2021 13:56:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=80=E8=AF=B7=E5=A5=BD?= =?UTF-8?q?=E5=8F=8B=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/servers/role/handler/friendHandler.ts | 2 +- game-server/test/friend.test.ts | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/game-server/app/servers/role/handler/friendHandler.ts b/game-server/app/servers/role/handler/friendHandler.ts index c367a3f4e..9560208c6 100644 --- a/game-server/app/servers/role/handler/friendHandler.ts +++ b/game-server/app/servers/role/handler/friendHandler.ts @@ -139,7 +139,7 @@ export class FriendHandler { str = getResStr(STATUS.FRIEND_YOURSELF); continue; } - let incResult = await RoleModel.increaseFriendApplyCnt(hisRoleId, 1, 50); + let incResult = await RoleModel.increaseFriendApplyCnt(hisRoleId, 1, FRIEND.FRIEND_MANAGE_APPLICATION); if(!incResult) { str = getResStr(STATUS.FRIEND_HIS_APPLY_MAX); continue; } diff --git a/game-server/test/friend.test.ts b/game-server/test/friend.test.ts index 52cc2b406..d4bb1c080 100644 --- a/game-server/test/friend.test.ts +++ b/game-server/test/friend.test.ts @@ -59,6 +59,39 @@ describe('好友测试测试', function() { }); }); + it('清空申请', function(done) { + pinusClientT.request('role.friendHandler.getApplyList', {}, (res) => { + + checkSuccessResponse(res); + expect(res.data.list).to.be.a('array'); + res.data.list.forEach(cur => { + checkFriendApplyParams(cur); + }); + + const applyCodes = res.data.list.map(apply => { + return apply.applyCode; + }); + pinusClientT.request('role.friendHandler.handleApply', { applyCodeList: applyCodes, isPass: false }, (res) => { + checkSuccessResponse(res); + expect(res.data.isSuccess).to.be.a('boolean'); + expect(res.data.msg).to.be.a('string'); + + expect(res.data.applyCodeList).to.be.a('array'); + res.data.applyCodeList.forEach(cur => { + expect(cur).to.be.a('string'); + }) + + expect(res.data.list).to.be.a('array'); + res.data.list.forEach(cur => { + checkFriendListParam(cur); + }); + + expect(res.data.friendCnt).to.be.a('number'); + done(); + }); + }); + }); + it('申请好友', function(done) { pinusClient.request('role.friendHandler.applyFriend', { roleIds: [roleInfoT.roleId] } , (res) => { checkSuccessResponse(res);