Skip to content

Commit 837db31

Browse files
committed
refactor: extract script.external_request scope string into a named constant
1 parent 882d5c3 commit 837db31

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

packages/vscode-extension/src/scopes.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ for (const { title, version, documentationLink, scopes } of GOOGLE_APIS || []) {
6464
}
6565
}
6666

67-
SCOPES.set("https://www.googleapis.com/auth/script.external_request", {
67+
export const SCRIPT_EXTERNAL_REQUEST_SCOPE =
68+
"https://www.googleapis.com/auth/script.external_request";
69+
70+
SCOPES.set(SCRIPT_EXTERNAL_REQUEST_SCOPE, {
6871
description: "Connect to an external service",
6972
apis: [],
7073
});

packages/vscode-extension/src/test/scopes.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*/
1616

1717
import * as assert from "node:assert";
18-
import { SCOPES, getScopeMarkdown } from "../scopes.js";
18+
import {
19+
SCOPES,
20+
SCRIPT_EXTERNAL_REQUEST_SCOPE,
21+
getScopeMarkdown,
22+
} from "../scopes.js";
1923

2024
suite("getScopeMarkdown", () => {
2125
test("it returns markdown for a known scope", () => {
@@ -29,9 +33,7 @@ suite("getScopeMarkdown", () => {
2933
});
3034

3135
test("it returns scope for script.external_request", () => {
32-
const scope = SCOPES.get(
33-
"https://www.googleapis.com/auth/script.external_request",
34-
);
36+
const scope = SCOPES.get(SCRIPT_EXTERNAL_REQUEST_SCOPE);
3537
assert.ok(scope);
3638
assert.strictEqual(scope?.description, "Connect to an external service");
3739
});

0 commit comments

Comments
 (0)