From f28225844fd76c9da8814c747d81889af93c5d7b Mon Sep 17 00:00:00 2001 From: diosmosis Date: Wed, 2 Oct 2024 00:43:36 -0700 Subject: [PATCH] debug test --- package.json | 2 +- src-test/callFunctionInTest.ts | 3 +++ tests/appscript/api.spec.ts | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cc51e40..80ad032 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "create": "mkdir -p dist && clasp create --rootDir dist --title='Matomo Looker Studio Connector' --type=standalone && mv ./dist/.clasp.json .", "push": "tsx ./scripts/push.ts", "test:appscript": "jest --config=./jest.config.appscript.ts", - "test": "npm run test:appscript", + "test": "npm run test:appscript -- ./tests/appscript/api.spec.ts", "test:download-artifacts": "tsx ./scripts/download-expected.ts", "update-secrets-in-ci": "tsx ./scripts/update_ci_secrets.ts" }, diff --git a/src-test/callFunctionInTest.ts b/src-test/callFunctionInTest.ts index 2000885..74e33fe 100644 --- a/src-test/callFunctionInTest.ts +++ b/src-test/callFunctionInTest.ts @@ -27,6 +27,9 @@ export function callFunctionInTestWithMockFixture( ...params: unknown[] ) { const fixtureInstance = (ALL_FIXTURES[fixture.name])(...params); + console.log(fixture.name); + console.log(ALL_FIXTURES[fixture.name].toString()); + console.log(UrlFetchApp.fetchAll.toString()); fixtureInstance.setUp(); try { return callFunctionInTest(functionName, testName, ...params); diff --git a/tests/appscript/api.spec.ts b/tests/appscript/api.spec.ts index 3dc691d..83c0bc8 100644 --- a/tests/appscript/api.spec.ts +++ b/tests/appscript/api.spec.ts @@ -278,7 +278,7 @@ describe('api', () => { expect(requestCount).toEqual(1); }); - it('should abort when UrlFetchApp throws an unknown error', async () => { + it.only('should abort when UrlFetchApp throws an unknown error', async () => { if (!process.env.USE_LOCALTUNNEL) { console.log('*** SKIPPING TEST ***'); return; @@ -299,7 +299,6 @@ describe('api', () => { const errorMessage = 'unknown error'; await expect(async () => { - // check it does not throw when an Error is used await Clasp.runWithFixture( { name: 'urlfetchapp', params: [ errorMessage ] }, 'fetchAll', @@ -314,7 +313,6 @@ describe('api', () => { ); }).rejects.toHaveProperty('message', errorMessage); - // check it does not throw when a string is used await expect(async () => { await Clasp.runWithFixture( { name: 'urlfetchapp', params: [ errorMessage, true ] },