From bcb93075a13ed558b21458e6ef8f56c25db4839f Mon Sep 17 00:00:00 2001 From: dorianzheng Date: Wed, 23 Sep 2026 16:40:03 +0800 Subject: [PATCH] test: compare Google OAuth scopes as an exact set --- test/google-tools.test.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/google-tools.test.mjs b/test/google-tools.test.mjs index 61572a8..73654b1 100644 --- a/test/google-tools.test.mjs +++ b/test/google-tools.test.mjs @@ -12,11 +12,13 @@ test('Google policy enables requested creations and edits, but no mail sending o } assert.deepEqual(TOOLS.gmail, { read: [], write: ['create_draft'] }) assert.equal(TOOLS.calendar.write.includes('delete_event'), false) - const scopes = googleScopes(TOOLS) - for (const scope of ['gmail.compose', 'calendar.app.created', 'calendar.events', 'drive.file', 'documents', 'spreadsheets', 'presentations']) { - assert.ok(scopes.includes(`https://www.googleapis.com/auth/${scope}`), scope) - } - assert.equal(scopes.includes('https://mail.google.com/'), false) + assert.deepEqual(new Set(googleScopes(TOOLS)), new Set([ + 'openid', 'email', ...[ + 'drive.readonly', 'drive.file', 'documents.readonly', 'documents', + 'spreadsheets.readonly', 'spreadsheets', 'presentations.readonly', 'presentations', + 'calendar.readonly', 'calendar.events', 'calendar.app.created', 'gmail.compose', + ].map((scope) => `https://www.googleapis.com/auth/${scope}`), + ])) }) async function fixture(t) {