From 9f0b31039d7b8425fabbeb3249c82157a58f8d36 Mon Sep 17 00:00:00 2001 From: Cristian Lepadatu Date: Mon, 2 Sep 2024 21:34:41 +0300 Subject: [PATCH] updated the tests --- tests/main-132-133.test.js | 29 ----------------------------- tests/main-161-162.test.js | 25 ------------------------- tests/main-208-210.test.js | 26 -------------------------- 3 files changed, 80 deletions(-) delete mode 100644 tests/main-132-133.test.js delete mode 100644 tests/main-161-162.test.js delete mode 100644 tests/main-208-210.test.js diff --git a/tests/main-132-133.test.js b/tests/main-132-133.test.js deleted file mode 100644 index 0baceef..0000000 --- a/tests/main-132-133.test.js +++ /dev/null @@ -1,29 +0,0 @@ -import test from 'ava'; -import { MockAgent, setGlobalDispatcher } from 'undici'; -import { accessTokenResponse } from '../lib/main'; // Adjust the import based on your actual function - -test.beforeEach(() => { - const agent = new MockAgent(); - agent.disableNetConnect(); - setGlobalDispatcher(agent); -}); - -test('accessTokenResponse should handle the response correctly', async t => { - const agent = new MockAgent(); - const mockPool = agent.get('https://api.github.com'); - - mockPool.intercept({ - path: `/app/installations/${installationId}/access_tokens`, // Adjust the path based on your actual endpoint - method: 'POST', - headers: { - authorization: `bearer ${jwt}` - } - - }).reply(200, { /* mock response data */ }); - - setGlobalDispatcher(agent); - - const result = await accessTokenResponse(); // Call the function you're testing - - // t.deepEqual(result, { /* expected result */ }); // Adjust based on expected result -}); diff --git a/tests/main-161-162.test.js b/tests/main-161-162.test.js deleted file mode 100644 index e29c43a..0000000 --- a/tests/main-161-162.test.js +++ /dev/null @@ -1,25 +0,0 @@ -// import test from 'ava'; -// import { MockAgent, setGlobalDispatcher } from 'undici'; -// import { accessTokenResponse } from '../lib/main'; // Adjust the import based on your actual function -// -// test.beforeEach(() => { - // const agent = new MockAgent(); - // agent.disableNetConnect(); - // setGlobalDispatcher(agent); -// }); -// -// test('accessTokenResponse should handle the response correctly', async t => { - // const agent = new MockAgent(); - // const mockPool = agent.get('https://api.github.com'); - // - // mockPool.intercept({ - // path: '/your-endpoint', // Adjust the path based on your actual endpoint - // method: 'GET', - // }).reply(200, { /* mock response data */ }); -// - // setGlobalDispatcher(agent); -// - // const result = await accessTokenResponse(); // Call the function you're testing -// - // t.deepEqual(result, { /* expected result */ }); // Adjust based on expected result -// }); diff --git a/tests/main-208-210.test.js b/tests/main-208-210.test.js deleted file mode 100644 index cb6d0d2..0000000 --- a/tests/main-208-210.test.js +++ /dev/null @@ -1,26 +0,0 @@ -// import test from 'ava'; -// import { MockAgent, setGlobalDispatcher } from 'undici'; -// import { createJWT } from '../lib/main'; // Adjust the import based on your actual function -// -// test.beforeEach(() => { - // const agent = new MockAgent(); - // agent.disableNetConnect(); - // setGlobalDispatcher(agent); -// }); -// -// test('createJWT should handle the response correctly', async t => { - // const agent = new MockAgent(); - // const mockPool = agent.get('https://api.github.com'); - // - // mockPool.intercept({ - // path: '/your-endpoint', // Adjust the path based on your actual endpoint - // method: 'GET', - // }).reply(200, { /* mock response data */ }); -// - // setGlobalDispatcher(agent); -// - // const result = await createJWT(); // Call the function you're testing -// - // t.deepEqual(result, { /* expected result */ }); // Adjust based on expected result -// }); -// \ No newline at end of file