diff --git a/package.json b/package.json index 90530604..00b60f3d 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,6 @@ "start-testnet": "cross-env-shell NODE_ENV=testnet \"yarn start\"", "test": "cross-env NODE_OPTIONS='--max-http-header-size 32768' NODE_ENV=test vitest", "test-badges": "make-coverage-badge --output-path ./docs/images/badge.svg", - "test-integration:mainnet": "cross-env NETWORK=mainnet vitest -c vitest.config.integration.ts --run --segfault-retry=3", - "test-integration:preprod": "cross-env NETWORK=preprod vitest -c vitest.config.integration.ts --run --segfault-retry=3", - "test-integration:preview": "cross-env NETWORK=preview vitest -c vitest.config.integration.ts --run --segfault-retry=3", "type-check": "tsc --project tsconfig.json" }, "dependencies": { @@ -57,7 +54,6 @@ "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "6.7.2", "@vitest/coverage-c8": "^0.27", - "change-case": "^4.1.2", "eslint": "8.49.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-import": "^2.28.1", diff --git a/test/integration/tests/common/routes.ts b/test/integration/tests/common/routes.ts deleted file mode 100644 index c6fe6a02..00000000 --- a/test/integration/tests/common/routes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe } from 'vitest'; -import { commonFixtures } from '@blockfrost/blockfrost-tests'; -import { generateTestSuite } from '../../utils.js'; - -describe('Integration Tests - common', () => { - generateTestSuite(commonFixtures); -}); diff --git a/test/integration/tests/mainnet/routes.ts b/test/integration/tests/mainnet/routes.ts deleted file mode 100644 index 62dfe4e9..00000000 --- a/test/integration/tests/mainnet/routes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe } from 'vitest'; -import { mainnetFixtures } from '@blockfrost/blockfrost-tests'; -import { generateTestSuite } from '../../utils.js'; - -describe('Integration Tests - mainnet', () => { - generateTestSuite(mainnetFixtures); -}); diff --git a/test/integration/tests/preprod/routes.ts b/test/integration/tests/preprod/routes.ts deleted file mode 100644 index fd65e435..00000000 --- a/test/integration/tests/preprod/routes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe } from 'vitest'; -import { preprodFixtures } from '@blockfrost/blockfrost-tests'; -import { generateTestSuite } from '../../utils.js'; - -describe('Integration Tests - preprod', () => { - generateTestSuite(preprodFixtures); -}); diff --git a/test/integration/tests/preview/routes.ts b/test/integration/tests/preview/routes.ts deleted file mode 100644 index 7fece8f9..00000000 --- a/test/integration/tests/preview/routes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe } from 'vitest'; -import { previewFixtures } from '@blockfrost/blockfrost-tests'; -import { generateTestSuite } from '../../utils.js'; - -describe('Integration Tests - preview', () => { - generateTestSuite(previewFixtures); -}); diff --git a/test/integration/utils.ts b/test/integration/utils.ts deleted file mode 100644 index d5694d8f..00000000 --- a/test/integration/utils.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { expect, test, describe } from 'vitest'; -import type { Fixture } from '@blockfrost/blockfrost-tests'; -import { noCase } from 'change-case'; -import got from 'got'; - -export const getInstance = () => { - return got.extend({ - responseType: 'json', - prefixUrl: 'http://localhost:3000', - https: { - rejectUnauthorized: false, - }, - }); -}; - -const client = getInstance(); - -export const generateTest = (fixture: Fixture, endpoint: string) => { - if (fixture.isCached) { - return; - } - - // TODO: update dbsync and fix this - if (fixture.testName === 'scripts/datum/:hash/cbor - random datum') { - return; - } - - test(fixture.testName, async () => { - if ('error' in fixture.response) { - try { - await client.get(endpoint).json(); - throw new Error(`Expected ${fixture.response} but did not throw`); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (error: any) { - expect(error.response.body).toStrictEqual(fixture.response); - } - } else { - const response = await client.get(endpoint).json(); - - expect(response).toStrictEqual(fixture.response); - } - }); -}; - -export const generateTestSuite = (fixtures: Record) => { - for (const fixtureName of Object.keys(fixtures)) { - const f = fixtures[fixtureName]; - - describe(`${noCase(fixtureName)} endpoints`, () => { - test('should have at least one endpoint', () => { - expect(1).toBe(1); - }); - for (const fixture of f) { - for (const endpoint of fixture.endpoints) { - generateTest(fixture, endpoint); - } - } - }); - } -}; diff --git a/vitest.config.integration.ts b/vitest.config.integration.ts deleted file mode 100644 index 4672a4d7..00000000 --- a/vitest.config.integration.ts +++ /dev/null @@ -1,20 +0,0 @@ -// eslint-disable-next-line import/extensions -import { defineConfig } from 'vitest/config'; - -if (!['mainnet', 'preprod', 'preview'].includes(process.env.NETWORK as string)) { - throw 'Error NETWORK env variable can be only `mainnet, preview, preprod`'; -} - -export default defineConfig({ - test: { - reporters: ['verbose'], - testTimeout: 50_000, - passWithNoTests: true, - hookTimeout: 30_000, - cache: false, - include: [ - `./test/integration/tests/${process.env.NETWORK}/**/*.ts`, - `./test/integration/tests/common/**/*.ts`, - ], - }, -});