Skip to content

Commit

Permalink
yarn format
Browse files Browse the repository at this point in the history
  • Loading branch information
Miłosz Skaza committed Sep 7, 2023
1 parent 62cd93f commit d5f73ec
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ switch (cmd) {
console.log(getIssuerToken(config.SECRET));
break;

case "get-visit-token":
case "get-visit-token":
const scope = args[1];
const validity = parseInt(args[2]) || 3600;
const strict = parseBool(args[3]);
Expand All @@ -24,7 +24,6 @@ switch (cmd) {
console.log(jwt.sign(payload, config.SECRET, { expiresIn: validity }));
break;


default:
console.log(`Invalid command '${cmd}'`);
process.exit(1);
Expand Down
8 changes: 7 additions & 1 deletion src/jobs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { Job } from "bull";
import * as Sentry from "@sentry/node";

import config from "../config";
import { JobBrowser, JobCookieType, JobOptions, JobStepType, PDFOptionsType } from "../schemas/api";
import {
JobBrowser,
JobCookieType,
JobOptions,
JobStepType,
PDFOptionsType,
} from "../schemas/api";
import { PlaywrightRunner } from "../utils/runner";

export type VisitJobData = {
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const JobDispatchRequest = Type.Object(
steps: Type.Array(JobStep),
cookies: Type.Array(JobCookie, { default: [] }),
options: Type.Array(Type.Enum(JobOptions), { default: [] }),
pdf: Type.Optional(PDFOptions)
pdf: Type.Optional(PDFOptions),
},
{ additionalProperties: false },
);
Expand Down
3 changes: 2 additions & 1 deletion src/utils/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
JobCookieType,
JobOptions,
JobResultType,
JobStepType, PDFOptionsType,
JobStepType,
PDFOptionsType,
} from "../schemas/api";

export type PlaywrightRunnerData = {
Expand Down
17 changes: 10 additions & 7 deletions tests/async-job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ test("POST '/api/v1/async-job' creates pdf", async (t) => {
t.is(base64regex.test(result.result.pdf), true);
});


test("POST '/api/v1/async-job' creates pdf with settings", async (t) => {
const { app, testAppURL } = t.context;

Expand All @@ -165,7 +164,8 @@ test("POST '/api/v1/async-job' creates pdf with settings", async (t) => {
delay: 0,
scale: 1.0,
},
}});
},
});

t.is(response.statusCode, 200);
const data = response.json();
Expand Down Expand Up @@ -198,7 +198,8 @@ test("POST '/api/v1/async-job' accepts pdf render size", async (t) => {
height: "10cm",
},
},
}});
},
});

t.is(response.statusCode, 200);
const data = response.json();
Expand Down Expand Up @@ -226,9 +227,10 @@ test("POST '/api/v1/async-job' validates pdf render format", async (t) => {
steps: [{ url: testAppURL }],
options: [JobOptions.PDF],
pdf: {
format: "B5"
format: "B5",
},
}});
},
});

t.is(response.statusCode, 400);
t.deepEqual(response.json(), {
Expand All @@ -253,7 +255,8 @@ test("POST '/api/v1/async-job' validates pdf render delay", async (t) => {
js: true,
delay: 20000,
},
}});
},
});

t.is(response.statusCode, 400);
t.deepEqual(response.json(), {
Expand All @@ -275,7 +278,7 @@ test("POST '/api/v1/async-job' validates pdf render scale", async (t) => {
options: [JobOptions.PDF],
pdf: {
scale: 5.0,
}
},
},
});

Expand Down
16 changes: 10 additions & 6 deletions tests/sync-job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ test("POST '/api/v1/sync-job' creates pdf with settings", async (t) => {
js: true,
delay: 0,
scale: 1.0,
},
},
}});
});

t.is(response.statusCode, 200);

Expand All @@ -155,7 +156,8 @@ test("POST '/api/v1/sync-job' accepts pdf render size", async (t) => {
height: "10cm",
},
},
}});
},
});

t.is(response.statusCode, 200);

Expand All @@ -176,9 +178,10 @@ test("POST '/api/v1/sync-job' validates pdf render format", async (t) => {
steps: [{ url: testAppURL }],
options: [JobOptions.PDF],
pdf: {
format: "B5"
format: "B5",
},
}});
},
});

t.is(response.statusCode, 400);
t.deepEqual(response.json(), {
Expand All @@ -203,7 +206,8 @@ test("POST '/api/v1/sync-job' validates pdf render delay", async (t) => {
js: true,
delay: 20000,
},
}});
},
});

t.is(response.statusCode, 400);
t.deepEqual(response.json(), {
Expand All @@ -225,7 +229,7 @@ test("POST '/api/v1/sync-job' validates pdf render scale", async (t) => {
options: [JobOptions.PDF],
pdf: {
scale: 5.0,
}
},
},
});

Expand Down

0 comments on commit d5f73ec

Please sign in to comment.