Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions tests/tipstream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,62 @@ describe("TipStream Contract Tests", () => {

expect(result).toBeOk(Cl.uint(20000));
});

it("accepts fee at exactly the maximum limit of 1000 basis points", () => {
const { result } = simnet.callPublicFn(
"tipstream",
"set-fee-basis-points",
[Cl.uint(1000)],
deployer
);
expect(result).toBeOk(Cl.bool(true));

const { result: fee } = simnet.callReadOnlyFn(
"tipstream",
"get-fee-for-amount",
[Cl.uint(1000000)],
wallet1
);
expect(fee).toBeOk(Cl.uint(100000));
});

it("rejects fee above the maximum limit of 1000 basis points", () => {
const { result } = simnet.callPublicFn(
"tipstream",
"set-fee-basis-points",
[Cl.uint(1001)],
deployer
);
expect(result).toBeErr(Cl.uint(101));
});

it("accepts zero fee to disable platform fees", () => {
const { result } = simnet.callPublicFn(
"tipstream",
"set-fee-basis-points",
[Cl.uint(0)],
deployer
);
expect(result).toBeOk(Cl.bool(true));

const { result: fee } = simnet.callReadOnlyFn(
"tipstream",
"get-fee-for-amount",
[Cl.uint(1000000)],
wallet1
);
expect(fee).toBeOk(Cl.uint(0));
});

it("non-owner cannot change fee", () => {
const { result } = simnet.callPublicFn(
"tipstream",
"set-fee-basis-points",
[Cl.uint(100)],
wallet1
);
expect(result).toBeErr(Cl.uint(100));
});
});

describe("Batch Tipping", () => {
Expand Down
Loading