Skip to content

Commit

Permalink
Using index signature to access index properties
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Dec 26, 2024
1 parent 5111de6 commit b699b75
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 57 deletions.
4 changes: 2 additions & 2 deletions __tests__/frontend/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with basic configuration", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works with basic configuration", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { response: { errors: [] }, status: "success" },
Expand Down
8 changes: 4 additions & 4 deletions __tests__/frontend/configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with copy configuration", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works with copy configuration", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { response: { errors: [] }, status: "success" },
Expand Down Expand Up @@ -53,7 +53,7 @@ test("works with merge configuration", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -63,7 +63,7 @@ test("works with merge configuration", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { response: { errors: [] }, status: "success" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/destination-selection-api-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listFolders = [
window._endpointStubs["listFolders"] = [
{
status: "success",
value: { status: "error", type: "DriveAPIError" },
},
];
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listFolders = [
window._endpointStubs["listFolders"] = [
{
status: "success",
value: { status: "error", type: "invalidParameter" },
},
];
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listFolders = [
window._endpointStubs["listFolders"] = [
{
status: "failure",
value: new Error("ERROR MESSAGE"),
},
];
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listFolders = [
window._endpointStubs["listFolders"] = [
{
status: "success",
value: { status: "error", type: "unknown" },
},
];
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/move-api-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with an API error", async ({ page }) => {
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works with an API error", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { status: "error", type: "DriveAPIError" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/move-folders-equal-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("works with source and destination folders being equal", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -19,7 +19,7 @@ test("works with source and destination folders being equal", async ({
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { status: "error", type: "sourceEqualsDestination" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/move-invalid-parameter-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with an API error", async ({ page }) => {
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works with an API error", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { status: "error", type: "invalidParameter" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/move-repeat-after-timeout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("works with an unhandled move error", async ({ page }) => {
await page.evaluate(() => {
const e = new Error();
e.name = "ScriptError";
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -19,7 +19,7 @@ test("works with an unhandled move error", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "failure",
value: e,
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/move-unhandled-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with an unhandled move error", async ({ page }) => {
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works with an unhandled move error", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "failure",
value: new Error("ERROR MESSAGE"),
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/move-unknown-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with an unknown move error", async ({ page }) => {
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works with an unknown move error", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { status: "error", type: "unknown" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with basic configuration", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -33,7 +33,7 @@ test("works with basic configuration", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { response: { errors: [] }, status: "success" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/non-empty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with non-empty destination folder", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -21,7 +21,7 @@ test("works with non-empty destination folder", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
delay: 500,
status: "success",
Expand Down
6 changes: 3 additions & 3 deletions __tests__/frontend/source-destination-selection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works with folder selection", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listFolders = [
window._endpointStubs["listFolders"] = [
{
status: "success",
value: {
Expand Down Expand Up @@ -96,7 +96,7 @@ test("works with folder selection", async ({ page }) => {
},
},
];
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: {
Expand Down Expand Up @@ -138,7 +138,7 @@ test("works with folder selection", async ({ page }) => {
},
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: { response: { errors: [] }, status: "success" },
Expand Down
2 changes: 1 addition & 1 deletion __tests__/frontend/source-selection-api-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { status: "error", type: "DriveAPIError" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("handles invalid parameter errors in source folder selection gracefully", a
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { status: "error", type: "invalidParameter" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "failure",
value: new Error("ERROR MESSAGE"),
Expand Down
2 changes: 1 addition & 1 deletion __tests__/frontend/source-selection-unknown-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("handles raw errors in source folder selection gracefully", async ({
await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { status: "error", type: "unknown" },
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frontend/success-with-errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("works and displays moving errors", async ({ page }) => {
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
window._endpointStubs["listSharedDrives"] = [
{
status: "success",
value: { response: [], status: "success" },
Expand All @@ -17,7 +17,7 @@ test("works and displays moving errors", async ({ page }) => {
value: { response: [], status: "success" },
},
];
window._endpointStubs.move = [
window._endpointStubs["move"] = [
{
status: "success",
value: {
Expand Down
10 changes: 5 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
forbidOnly: process.env.CI !== undefined,
forbidOnly: process.env["CI"] !== undefined,
fullyParallel: true,
projects: [
{
Expand All @@ -17,18 +17,18 @@ export default defineConfig({
use: { ...devices["Desktop Safari"] },
},
],
reporter: process.env.CI !== undefined ? "html" : "list",
retries: process.env.CI !== undefined ? 2 : 0,
reporter: process.env["CI"] !== undefined ? "html" : "list",
retries: process.env["CI"] !== undefined ? 2 : 0,
testDir: "./__tests__/frontend",
use: {
baseURL: "http://127.0.0.1:8080",
trace: "on-first-retry",
},
webServer: {
command: "npm run start",
reuseExistingServer: process.env.CI === undefined,
reuseExistingServer: process.env["CI"] === undefined,
url: "http://127.0.0.1:8080",
},
// Opt out of parallel tests on CI.
//workers: process.env.CI !== undefined ? 1 : undefined,
//workers: process.env["CI"] !== undefined ? 1 : undefined,
});
8 changes: 4 additions & 4 deletions src/backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { move } from "./move";

declare const global: google.script.PublicEndpoints;

global.doGet = doGet;
global.listFolders = listFolders;
global.listSharedDrives = listSharedDrives;
global.move = move;
global["doGet"] = doGet;
global["listFolders"] = listFolders;
global["listSharedDrives"] = listSharedDrives;
global["move"] = move;
Loading

0 comments on commit b699b75

Please sign in to comment.