Skip to content

Commit

Permalink
test: add tests to comments in file
Browse files Browse the repository at this point in the history
  • Loading branch information
braposo committed May 26, 2019
1 parent f367f68 commit c2a17d2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
50 changes: 50 additions & 0 deletions src/__tests__/file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,54 @@ describe("File", () => {
data: { file: { images: [{ id: "0:1" }] } },
});
});

test("can get file comments", async () => {
const query = `
query {
file(id: "${figmaFile}") {
comments {
id
message
file_key
order_id
parent_id
created_at
client_meta {
node_id
node_offset {
x
y
}
}
resolved_at
}
}
}
`;

await expect(graphql(schema, query, null, { fileId: figmaFile })).resolves.toEqual({
data: {
file: {
comments: [
{
id: "6907475",
message: "Testing comment",
file_key: "cLp23bR627jcuNSoBGkhL04E",
order_id: 1,
parent_id: "",
created_at: "2019-05-26T17:47:36Z",
client_meta: {
node_id: "28:5",
node_offset: {
x: 111,
y: 22,
},
},
resolved_at: null,
},
],
},
},
});
});
});
2 changes: 1 addition & 1 deletion src/types/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports.type = `
id: ID!
# The position of the comment. Either the absolute coordinates on the canvas or a relative offset within a frame
client_meta: Position
client_meta: FrameOffset
# The file in which the comment lives
file_key: String
Expand Down

0 comments on commit c2a17d2

Please sign in to comment.