Skip to content

Commit

Permalink
changes start_time in js WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpq committed Nov 21, 2024
1 parent fdd933f commit 7b345e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/clients/js/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Reads the list of historical relationship tuple writes and deletes.
const type = 'document';
const options = {
pageSize: 25,
startTime: "2022-01-01T00:00:00Z",
continuationToken: 'eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==',
};

Expand Down
10 changes: 6 additions & 4 deletions config/clients/js/template/tests/client.test.ts.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,13 @@ describe("{{appTitleCaseName}} Client", () => {
it("should properly call the ReadChanges API", async () => {
const type = "repo";
const pageSize = 25;
const startTime = "2022-01-01T00:00:00Z";
const continuationToken = "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==";
const scope = nocks.readChanges(baseConfig.storeId!, type, pageSize, continuationToken);
const scope = nocks.readChanges(baseConfig.storeId!, type, pageSize, continuationToken, startTime);
expect(scope.isDone()).toBe(false);
const response = await fgaClient.readChanges({ type }, { pageSize, continuationToken });
const response = await fgaClient.readChanges({ type }, { pageSize, continuationToken, startTime });

expect(scope.isDone()).toBe(true);
expect(response).toMatchObject({ changes: expect.arrayContaining([]) });
Expand All @@ -263,11 +264,12 @@ describe("{{appTitleCaseName}} Client", () => {
it("should properly call the ReadChanges API with no type", async () => {
const pageSize = 25;
const continuationToken = "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==";
const startTime = "2022-01-01T00:00:00Z";
const scope = nocks.readChanges(baseConfig.storeId!, "", pageSize, continuationToken);
const scope = nocks.readChanges(baseConfig.storeId!, "", pageSize, continuationToken, startTime);
expect(scope.isDone()).toBe(false);
const response = await fgaClient.readChanges(undefined, { pageSize, continuationToken });
const response = await fgaClient.readChanges(undefined, { pageSize, continuationToken, startTime });

expect(scope.isDone()).toBe(true);
expect(response).toMatchObject({ changes: expect.arrayContaining([]) });
Expand Down

0 comments on commit 7b345e3

Please sign in to comment.