feat(onebot): configure group invite policy
Add validated group member invite policy updates with post-write verification. Fixes #334
This commit is contained in:
11 files changed
+343
-6
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { GetAtAllRemain } from '@snowluma/protocol/oidb-services/group-admin/get-at-all-remain';
|
||||
import { FetchGroupDetail } from '@snowluma/protocol/oidb-services/contacts/fetch-group-detail';
|
||||
import { KickMember } from '@snowluma/protocol/oidb-services/group-admin/kick-member';
|
||||
import { KickMembers } from '@snowluma/protocol/oidb-services/group-admin/kick-members';
|
||||
import { LeaveGroup } from '@snowluma/protocol/oidb-services/group-admin/leave-group';
|
||||
@@ -10,6 +11,12 @@ import { SetAdmin } from '@snowluma/protocol/oidb-services/group-admin/set-admin
|
||||
import { SetGroupName } from '@snowluma/protocol/oidb-services/group-admin/set-group-name';
|
||||
import { SetGroupRemark } from '@snowluma/protocol/oidb-services/group-admin/set-group-remark';
|
||||
import { SetMemberCard } from '@snowluma/protocol/oidb-services/group-admin/set-member-card';
|
||||
import {
|
||||
MEMBER_INVITE_PRIVILEGE_MASK,
|
||||
mergeMemberInvitePrivilegeFlag,
|
||||
SetMemberInvitePolicy,
|
||||
type GroupMemberInvitePolicy,
|
||||
} from '@snowluma/protocol/oidb-services/group-admin/set-member-invite-policy';
|
||||
import { SetSearch } from '@snowluma/protocol/oidb-services/group-admin/set-search';
|
||||
import { SetSpecialTitle } from '@snowluma/protocol/oidb-services/group-admin/set-special-title';
|
||||
import { ModifyGroupExtInfo } from '@snowluma/protocol/oidb-services/group-admin/modify-group-ext-info';
|
||||
@@ -39,6 +46,32 @@ export class GroupAdminApi {
|
||||
return SetSearch.invoke(this.ctx, { groupId, noFingerOpen, noCodeFingerOpen });
|
||||
}
|
||||
|
||||
async setMemberInvitePolicy(groupId: number, policy: GroupMemberInvitePolicy): Promise<void> {
|
||||
const currentPrivilegeFlag = await this.fetchGroupPrivilegeFlag(groupId, 'before update');
|
||||
const expectedPrivilegeFlag = mergeMemberInvitePrivilegeFlag(currentPrivilegeFlag, policy);
|
||||
|
||||
await SetMemberInvitePolicy.invoke(this.ctx, {
|
||||
groupId,
|
||||
currentPrivilegeFlag,
|
||||
policy,
|
||||
});
|
||||
|
||||
const actualPrivilegeFlag = await this.fetchGroupPrivilegeFlag(groupId, 'after update');
|
||||
const mask = BigInt(MEMBER_INVITE_PRIVILEGE_MASK);
|
||||
if ((BigInt(actualPrivilegeFlag) & mask) !== (BigInt(expectedPrivilegeFlag) & mask)) {
|
||||
throw new Error(`group member invite policy was not applied for group ${groupId}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async fetchGroupPrivilegeFlag(groupId: number, phase: string): Promise<number> {
|
||||
const detail = await FetchGroupDetail.invoke(this.ctx, { groupUin: groupId });
|
||||
const privilegeFlag = detail.groupInfo?.results?.privilegeFlag;
|
||||
if (typeof privilegeFlag !== 'number') {
|
||||
throw new Error(`unable to read group member invite policy ${phase} for group ${groupId}`);
|
||||
}
|
||||
return privilegeFlag;
|
||||
}
|
||||
|
||||
setAddRequest(
|
||||
groupId: number, sequence: number, eventType: number,
|
||||
approve: boolean, reason = '', filtered = false,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type { OidbBase, OidbSvcTrpcTcp0x88D_0Response } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
Oidb0x8a0Req,
|
||||
Oidb0x8a7Resp,
|
||||
Oidb0x89a_0AddOption,
|
||||
Oidb0x89a_0Search,
|
||||
Oidb0x89a_0InvitePolicy,
|
||||
Oidb0xf16Req,
|
||||
OidbGroupRequestAction,
|
||||
OidbKickMember,
|
||||
@@ -31,6 +32,17 @@ function packResponse(body: Uint8Array) {
|
||||
};
|
||||
}
|
||||
|
||||
function packPrivilegeFlag(privilegeFlag?: number) {
|
||||
return packResponse(protobuf_encode<OidbBase<OidbSvcTrpcTcp0x88D_0Response>>({
|
||||
body: {
|
||||
groupInfo: {
|
||||
uin: 12345n,
|
||||
results: privilegeFlag === undefined ? {} : { privilegeFlag },
|
||||
},
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
describe('apis/group-admin', () => {
|
||||
it('muteMember resolves UID and dispatches 0x1253_1', async () => {
|
||||
const bridge = mockBridge();
|
||||
@@ -210,6 +222,58 @@ describe('apis/group-admin', () => {
|
||||
expect(env2.body?.accept).toBe(2);
|
||||
});
|
||||
|
||||
it('setMemberInvitePolicy reads, merges, writes, and verifies the privilege flag (#334)', async () => {
|
||||
const bridge = mockBridge();
|
||||
const currentPrivilegeFlag = 0x86100001;
|
||||
const expectedPrivilegeFlag = 0x84000001;
|
||||
bridge.sendRawPacket
|
||||
.mockResolvedValueOnce(packPrivilegeFlag(currentPrivilegeFlag))
|
||||
.mockResolvedValueOnce(packResponse(Buffer.alloc(0)))
|
||||
.mockResolvedValueOnce(packPrivilegeFlag(expectedPrivilegeFlag));
|
||||
|
||||
await new GroupAdminApi(bridge as any).setMemberInvitePolicy(12345, 'disabled');
|
||||
|
||||
expect(bridge.sendRawPacket.mock.calls.map((call) => call[0])).toEqual([
|
||||
'OidbSvcTrpcTcp.0x88d_0',
|
||||
'OidbSvcTrpcTcp.0x89a_0',
|
||||
'OidbSvcTrpcTcp.0x88d_0',
|
||||
]);
|
||||
const env = protobuf_decode<OidbBase<Oidb0x89a_0InvitePolicy>>(
|
||||
bridge.sendRawPacket.mock.calls[1]![1],
|
||||
);
|
||||
expect(env.body).toMatchObject({
|
||||
groupUin: 12345n,
|
||||
settings: {
|
||||
appPrivilegeFlag: expectedPrivilegeFlag,
|
||||
appPrivilegeMask: 0x06100000,
|
||||
allowMemberInvite: 0,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('setMemberInvitePolicy fails before mutation when the current flag is absent', async () => {
|
||||
const bridge = mockBridge();
|
||||
bridge.sendRawPacket.mockResolvedValueOnce(packPrivilegeFlag());
|
||||
|
||||
await expect(
|
||||
new GroupAdminApi(bridge as any).setMemberInvitePolicy(12345, 'require_approval'),
|
||||
).rejects.toThrow(/unable to read group member invite policy before update/);
|
||||
expect(bridge.sendRawPacket).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('setMemberInvitePolicy rejects a successful ack when read-back does not match', async () => {
|
||||
const bridge = mockBridge();
|
||||
bridge.sendRawPacket
|
||||
.mockResolvedValueOnce(packPrivilegeFlag(0x80100001))
|
||||
.mockResolvedValueOnce(packResponse(Buffer.alloc(0)))
|
||||
.mockResolvedValueOnce(packPrivilegeFlag(0x80100001));
|
||||
|
||||
await expect(
|
||||
new GroupAdminApi(bridge as any).setMemberInvitePolicy(12345, 'disabled'),
|
||||
).rejects.toThrow(/was not applied/);
|
||||
expect(bridge.sendRawPacket).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
it('getAtAllRemain decodes the response and converts BigInts', async () => {
|
||||
const bridge = mockBridge();
|
||||
bridge.sendRawPacket.mockResolvedValueOnce(packResponse(
|
||||
|
||||
@@ -65,6 +65,23 @@ export const actions = [
|
||||
},
|
||||
}),
|
||||
|
||||
groupAction({
|
||||
name: 'set_group_member_invite_policy',
|
||||
summary: '设置群成员邀请策略',
|
||||
params: {
|
||||
policy: f.enum(
|
||||
'disabled',
|
||||
'require_approval',
|
||||
'no_approval',
|
||||
'no_approval_under_100',
|
||||
),
|
||||
},
|
||||
run: async (p, ctx) => {
|
||||
await ctx.bridge.apis.groupAdmin.setMemberInvitePolicy(p.group_id, p.policy);
|
||||
return okResponse();
|
||||
},
|
||||
}),
|
||||
|
||||
groupUserAction({
|
||||
name: 'set_group_admin',
|
||||
summary: '设置/取消管理员',
|
||||
@@ -128,4 +145,3 @@ export const actions = [
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -90,9 +90,9 @@ describe('compileActionRegistry namespace conflicts', () => {
|
||||
});
|
||||
|
||||
describe('compiled production Action registry', () => {
|
||||
it('preserves all 186 canonical Action docs', () => {
|
||||
expect(ACTION_REGISTRY.actions).toHaveLength(186);
|
||||
expect(collectActionDocs()).toHaveLength(186);
|
||||
it('preserves all 187 canonical Action docs', () => {
|
||||
expect(ACTION_REGISTRY.actions).toHaveLength(187);
|
||||
expect(collectActionDocs()).toHaveLength(187);
|
||||
});
|
||||
|
||||
it('resolves every executable name to exactly one canonical doc', () => {
|
||||
|
||||
@@ -1453,6 +1453,34 @@ describe('extended-actions / fetch_custom_face_detail', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('extended-actions / set_group_member_invite_policy', () => {
|
||||
it('forwards the validated policy to the group-admin API', async () => {
|
||||
const setMemberInvitePolicy = vi.fn(async () => undefined);
|
||||
const bridge = fakeBridge({ apis: { groupAdmin: { setMemberInvitePolicy } } });
|
||||
|
||||
const response = await makeHandler(fakeCtx(bridge)).handle(
|
||||
'set_group_member_invite_policy',
|
||||
{ group_id: '12345', policy: 'no_approval_under_100' },
|
||||
);
|
||||
|
||||
expect(response).toMatchObject({ status: 'ok', retcode: 0 });
|
||||
expect(setMemberInvitePolicy).toHaveBeenCalledWith(12345, 'no_approval_under_100');
|
||||
});
|
||||
|
||||
it('rejects an unknown policy before calling the bridge', async () => {
|
||||
const setMemberInvitePolicy = vi.fn();
|
||||
const bridge = fakeBridge({ apis: { groupAdmin: { setMemberInvitePolicy } } });
|
||||
|
||||
const response = await makeHandler(fakeCtx(bridge)).handle(
|
||||
'set_group_member_invite_policy',
|
||||
{ group_id: 12345, policy: 'anything' },
|
||||
);
|
||||
|
||||
expect(response).toMatchObject({ status: 'failed', retcode: 1400 });
|
||||
expect(setMemberInvitePolicy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Wave 1: get_group_shut_list ───
|
||||
|
||||
describe('extended-actions / get_group_shut_list', () => {
|
||||
|
||||
@@ -56,6 +56,20 @@ export interface Oidb0x89a_0Search {
|
||||
settings?: pb<2, Oidb0x89a_0SearchSettings>;
|
||||
field12?: pb<12, uint_32>;
|
||||
}
|
||||
// 0x89A_0 — member invitation policy. The three settings tags are the
|
||||
// GroupDetailInfoV2 fields emitted by QQ's EncodeModifyGroupDetailInfoParam:
|
||||
// appPrivilegeFlag=23, appPrivilegeMask=24, allowMemberInvite=29.
|
||||
export interface Oidb0x89a_0InvitePolicySettings {
|
||||
// All three values can legitimately be zero and still have to be present.
|
||||
appPrivilegeFlag?: pb_optional<23, uint_32>;
|
||||
appPrivilegeMask?: pb_optional<24, uint_32>;
|
||||
allowMemberInvite?: pb_optional<29, uint_32>;
|
||||
}
|
||||
export interface Oidb0x89a_0InvitePolicy {
|
||||
groupUin?: pb<1, uint_64>;
|
||||
settings?: pb<2, Oidb0x89a_0InvitePolicySettings>;
|
||||
field12?: pb<12, uint_32>;
|
||||
}
|
||||
export interface OidbKickMember {
|
||||
groupUin?: pb<1, uint_32>;
|
||||
targetUid?: pb<3, string>;
|
||||
@@ -316,6 +330,8 @@ export interface OidbGroupDetailFlags {
|
||||
answer?: pb<25, string>;
|
||||
maxAdminCount?: pb<29, string>;
|
||||
shutUpAllTimestamp?: pb<59, bool>;
|
||||
/** Current complete app privilege bitfield; needed for masked mutations. */
|
||||
privilegeFlag?: pb<99, bool>;
|
||||
}
|
||||
export interface OidbGroupDetailConfig {
|
||||
uin?: pb<1, uint_64>;
|
||||
|
||||
@@ -117,6 +117,8 @@ export interface OidbSvcTrpcTcp0x88D_0Results {
|
||||
answer?: pb<25, string>;
|
||||
maxAdminCount?: pb<29, uint_64>;
|
||||
shutUpAllTimestamp?: pb<59, uint_32>;
|
||||
/** Complete app privilege bitfield (requested with detail flag tag 99). */
|
||||
privilegeFlag?: pb<99, uint_32>;
|
||||
}
|
||||
export interface OidbSvcTrpcTcp0x88D_0ResponseGroupInfo {
|
||||
uin?: pb<1, uint_64>;
|
||||
|
||||
@@ -33,7 +33,7 @@ export namespace FetchGroupDetail {
|
||||
ownerUid: on, createTime: on, maxMemberCount: on, memberCount: on,
|
||||
level: on, name: '', noticePreview: '', uin: on, lastSequence: on,
|
||||
lastMessageTime: on, question: on, answer: '', maxAdminCount: '',
|
||||
shutUpAllTimestamp: on,
|
||||
shutUpAllTimestamp: on, privilegeFlag: on,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// 0x89A_0 — change whether members may invite people and whether invitations
|
||||
// require approval. QQ sends the complete current appPrivilegeFlag together
|
||||
// with a mask, so callers must read the flag before invoking this namespace.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase, OidbEmpty } from '@snowluma/proto-defs/oidb';
|
||||
import type { Oidb0x89a_0InvitePolicy } from '@snowluma/proto-defs/oidb-actions/base';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export type GroupMemberInvitePolicy =
|
||||
| 'disabled'
|
||||
| 'require_approval'
|
||||
| 'no_approval'
|
||||
| 'no_approval_under_100';
|
||||
|
||||
export const MEMBER_INVITE_PRIVILEGE_MASK = 0x06100000;
|
||||
|
||||
const POLICY_PRIVILEGE_BITS: Record<GroupMemberInvitePolicy, number> = {
|
||||
disabled: 0x04000000,
|
||||
require_approval: 0,
|
||||
no_approval: 0x00100000,
|
||||
no_approval_under_100: 0x02000000,
|
||||
};
|
||||
|
||||
function assertUint32(value: number, name: string): void {
|
||||
if (!Number.isInteger(value) || value < 0 || value > 0xFFFFFFFF) {
|
||||
throw new Error(`${name} must be an unsigned 32-bit integer`);
|
||||
}
|
||||
}
|
||||
|
||||
export function mergeMemberInvitePrivilegeFlag(
|
||||
currentPrivilegeFlag: number,
|
||||
policy: GroupMemberInvitePolicy,
|
||||
): number {
|
||||
assertUint32(currentPrivilegeFlag, 'current privilege flag');
|
||||
const current = BigInt(currentPrivilegeFlag);
|
||||
const mask = BigInt(MEMBER_INVITE_PRIVILEGE_MASK);
|
||||
const requested = BigInt(POLICY_PRIVILEGE_BITS[policy]);
|
||||
return Number((current & ~mask) | (requested & mask));
|
||||
}
|
||||
|
||||
export namespace SetMemberInvitePolicy {
|
||||
export const command = 0x89A;
|
||||
export const subCommand = 0;
|
||||
|
||||
export interface Params {
|
||||
groupId: number;
|
||||
currentPrivilegeFlag: number;
|
||||
policy: GroupMemberInvitePolicy;
|
||||
}
|
||||
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): Oidb0x89a_0InvitePolicy => ({
|
||||
groupUin: BigInt(p.groupId),
|
||||
settings: {
|
||||
appPrivilegeFlag: mergeMemberInvitePrivilegeFlag(p.currentPrivilegeFlag, p.policy),
|
||||
appPrivilegeMask: MEMBER_INVITE_PRIVILEGE_MASK,
|
||||
allowMemberInvite: p.policy === 'disabled' ? 0 : 1,
|
||||
},
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, _: OidbEmpty): void => {};
|
||||
|
||||
export const encode = (env: OidbBase<Oidb0x89a_0InvitePolicy>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<Oidb0x89a_0InvitePolicy>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbEmpty> =>
|
||||
protobuf_decode<OidbBase<OidbEmpty>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<void> =>
|
||||
invokeOidb(deps, SetMemberInvitePolicy, params);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { FetchGroupDetail } from '../../../src/oidb-services/contacts/fetch-grou
|
||||
interface GroupDetailResultsFixture {
|
||||
name?: pb<15, string>;
|
||||
shutUpAllTimestamp?: pb<59, uint_32>;
|
||||
privilegeFlag?: pb<99, uint_32>;
|
||||
}
|
||||
|
||||
interface GroupDetailInfoFixture {
|
||||
@@ -55,6 +56,7 @@ describe('FetchGroupDetail namespace', () => {
|
||||
expect(out.config?.flags?.maxMemberCount).toBe(true);
|
||||
expect((out.config?.flags as { shutUpAllTimestamp?: boolean })?.shutUpAllTimestamp)
|
||||
.toBe(true);
|
||||
expect(out.config?.flags?.privilegeFlag).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -111,5 +113,27 @@ describe('FetchGroupDetail namespace', () => {
|
||||
|
||||
expect(out.groupInfo?.results?.shutUpAllTimestamp).toBe(4_294_967_295);
|
||||
});
|
||||
|
||||
it('decodes the complete privilege flag used by masked group mutations', async () => {
|
||||
const responseData = Buffer.from(protobuf_encode<OidbBase<GroupDetailResponseFixture>>({
|
||||
body: {
|
||||
groupInfo: {
|
||||
uin: 601692726n,
|
||||
results: { privilegeFlag: 0x82100001 },
|
||||
},
|
||||
},
|
||||
}));
|
||||
const sender = makeSender();
|
||||
sender.sendRawPacket.mockResolvedValue({
|
||||
success: true,
|
||||
gotResponse: true,
|
||||
errorCode: 0,
|
||||
errorMessage: '',
|
||||
responseData,
|
||||
});
|
||||
|
||||
const out = await FetchGroupDetail.invoke(sender, { groupUin: 601692726 });
|
||||
expect(out.groupInfo?.results?.privilegeFlag).toBe(0x82100001);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type { SendPacketResult } from '@snowluma/common/packet-sender';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type { Oidb0x89a_0InvitePolicy } from '@snowluma/proto-defs/oidb-actions/base';
|
||||
|
||||
import {
|
||||
MEMBER_INVITE_PRIVILEGE_MASK,
|
||||
mergeMemberInvitePrivilegeFlag,
|
||||
SetMemberInvitePolicy,
|
||||
type GroupMemberInvitePolicy,
|
||||
} from '../../../src/oidb-services/group-admin/set-member-invite-policy';
|
||||
|
||||
function makeSender() {
|
||||
const r: SendPacketResult = {
|
||||
success: true,
|
||||
gotResponse: true,
|
||||
errorCode: 0,
|
||||
errorMessage: '',
|
||||
responseData: Buffer.alloc(0),
|
||||
};
|
||||
return { sendRawPacket: vi.fn(async () => r) };
|
||||
}
|
||||
|
||||
describe('SetMemberInvitePolicy namespace', () => {
|
||||
it.each<[GroupMemberInvitePolicy, number, number]>([
|
||||
['disabled', 0x04000000, 0],
|
||||
['require_approval', 0, 1],
|
||||
['no_approval', 0x00100000, 1],
|
||||
['no_approval_under_100', 0x02000000, 1],
|
||||
])('maps %s to the verified privilege bits', async (policy, policyBits, allowMemberInvite) => {
|
||||
const sender = makeSender();
|
||||
const unrelatedBits = 0x80000001;
|
||||
|
||||
await SetMemberInvitePolicy.invoke(sender, {
|
||||
groupId: 12345,
|
||||
currentPrivilegeFlag: unrelatedBits + 0x06100000,
|
||||
policy,
|
||||
});
|
||||
|
||||
const [cmd, bytes] = sender.sendRawPacket.mock.calls[0]!;
|
||||
expect(cmd).toBe('OidbSvcTrpcTcp.0x89a_0');
|
||||
const env = protobuf_decode<OidbBase<Oidb0x89a_0InvitePolicy>>(bytes);
|
||||
expect(env.command).toBe(0x89A);
|
||||
expect(env.body?.groupUin).toBe(12345n);
|
||||
expect(env.body?.settings).toEqual({
|
||||
appPrivilegeFlag: unrelatedBits + policyBits,
|
||||
appPrivilegeMask: MEMBER_INVITE_PRIVILEGE_MASK,
|
||||
allowMemberInvite,
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves unrelated bits while replacing only the member-invite mask', () => {
|
||||
expect(mergeMemberInvitePrivilegeFlag(0xE7100001, 'require_approval'))
|
||||
.toBe(0xE1000001);
|
||||
});
|
||||
|
||||
it('keeps explicit zero fields on the wire', async () => {
|
||||
const sender = makeSender();
|
||||
await SetMemberInvitePolicy.invoke(sender, {
|
||||
groupId: 1,
|
||||
currentPrivilegeFlag: MEMBER_INVITE_PRIVILEGE_MASK,
|
||||
policy: 'require_approval',
|
||||
});
|
||||
const env = protobuf_decode<OidbBase<Oidb0x89a_0InvitePolicy>>(
|
||||
sender.sendRawPacket.mock.calls[0]![1],
|
||||
);
|
||||
expect(env.body?.settings?.appPrivilegeFlag).toBe(0);
|
||||
expect(env.body?.settings?.allowMemberInvite).toBe(1);
|
||||
});
|
||||
|
||||
it('rejects an invalid current flag before sending a packet', async () => {
|
||||
const sender = makeSender();
|
||||
await expect(SetMemberInvitePolicy.invoke(sender, {
|
||||
groupId: 1,
|
||||
currentPrivilegeFlag: -1,
|
||||
policy: 'disabled',
|
||||
})).rejects.toThrow(/unsigned 32-bit/);
|
||||
expect(sender.sendRawPacket).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user