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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { ActionContext } from "#behavior/context/ActionContext.js";
import { LocalActorContext } from "#behavior/context/server/LocalActorContext.js";
import { MaybePromise } from "@matter/general";
import { ConformanceError, Val } from "@matter/protocol";
import { FabricIndex, NodeId } from "@matter/types";
Expand Down Expand Up @@ -576,6 +577,22 @@ describe("ListManager", () => {
}, {});
});

// A behavior populating a fabric-scoped attribute at startup has no session, so nothing supplies the fabric
it("refuses an entry stored with no session to supply the fabric", async () => {
const struct = TestStruct(
{ list: listOf(structOf({ fabricIndex: "FabricIndex", value: "uint8" }), { access: "F" }) },
{},
);

await LocalActorContext.act("test", async cx => {
const ref = struct.reference(cx);
expect(() => (ref.list = [{ value: 1 }])).throw(ConformanceError);
expect(ref.list).undefined;
});

expect(struct.fields.list).undefined;
});

it("supplies the accessing fabric for an entry that omits it", async () => {
await testMandatoryFabricIndex(list => {
list[0] = { value: 3 };
Expand Down
Loading