Cotton code
32 lines · 1.2 KB · RustRaw
//! `packages/core/src/messages/limits.ts` has no test file of its own — the//! numbers are asserted from `preview.test.ts` ("the limits") and leaned on by//! `applyMessageWrite.test.ts`. Both assertions are here, plus the one the//! TypeScript cannot make: that the codebase's TWO names for the group cap still//! hold the same number.use super::*;use crate::constants::GROUP_MEMBER_CAP;/// `preview.test.ts` → "is one ceiling, 4000, and one preview length, 140".#[test]fn is_one_ceiling_4000_and_one_preview_length_140() {    assert_eq!(MESSAGE_BODY_MAX, 4000);    assert_eq!(MESSAGE_PREVIEW_MAX, 140);}#[test]fn a_group_holds_256_and_a_forward_carries_30() {    assert_eq!(GROUP_MEMBER_MAX, 256);    assert_eq!(MESSAGE_FORWARD_MAX, 30);}/// Two names for one number, in two TypeScript files, read by different halves/// of the system: `GROUP_MEMBER_MAX` by the group service, `GROUP_MEMBER_CAP` by/// the relay's applier and the peer producer. A cap enforced at 256 on one side/// and 512 on the other is a group that is full for one member and not for/// another, and the member who cannot see the difference is the one who gets/// dropped.#[test]fn the_two_group_caps_agree() {    assert_eq!(GROUP_MEMBER_MAX, GROUP_MEMBER_CAP);}