Skip to content

Commit

Permalink
chore: add test to cover not sending empty array when other has data (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamzeh authored Feb 12, 2024
2 parents 8741983 + 1e79509 commit e299e5e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,27 @@ describe("OpenFGA Client", () => {
expect(scope1.isDone()).toBe(true);
}
});

it("should properly call the OpenFga Write API when providing one empty array", async () => {
const tuple = {
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "admin",
object: "workspace:1",
};
const scope = nocks.write(baseConfig.storeId!);

expect(scope.isDone()).toBe(false);
const data = await fgaClient.write({
writes: [tuple],
deletes: []
}, {
authorizationModelId: "01GXSA8YR785C4FYS3C0RTG7B1",
});

expect(scope.isDone()).toBe(true);
expect(data.writes.length).toBe(1);
expect(data.deletes.length).toBe(0);
});
});

describe("WriteTuples", () => {
Expand Down

0 comments on commit e299e5e

Please sign in to comment.