-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.test.js
More file actions
24 lines (22 loc) · 700 Bytes
/
Copy pathindex.test.js
File metadata and controls
24 lines (22 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { fetchRows, extractDiscordIDs } = require("./index");
it("is returning rows", async () => {
const mockSheetsConnection = {
spreadsheets: {
values: {
get: (obj) =>
Promise.resolve({
data: { values: [["SomeUsername#6444"], ["AnotherUsername#3336"]] },
}),
},
},
};
expect.assertions(1);
expect(
await fetchRows("ghdsj6Ghsakdf", "B2:B", mockSheetsConnection)
).toEqual([["SomeUsername#6444"], ["AnotherUsername#3336"]]);
});
it("is extracting usernames from rows", () => {
expect(
extractDiscordIDs([["SomeUsername#6444"], ["AnotherUsername#3336"]])
).toEqual(["SomeUsername#6444", "AnotherUsername#3336"]);
});