Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import fs from 'node:fs';import path from 'node:path';
import { createClient } from '@hey-api/openapi-python';
import { getFilePaths, getSpecsPath } from '../../utils';import { createSdkConfig, getSnapshotsPath, getTempSnapshotsPath } from './utils';
const namespace = 'opencode';
const outputDir = path.join(getTempSnapshotsPath(), namespace);const snapshotsDir = path.join(getSnapshotsPath(), namespace);
const specPath = path.join(getSpecsPath(), '3.1.x', 'opencode.yaml');
describe(`Python SDK: ${namespace}`, () => { const createConfig = createSdkConfig({ outputDir, });
const scenarios = [ { config: createConfig({ input: specPath, output: 'default', plugins: ['@hey-api/python-sdk'], }), description: 'default', }, ];
it.each(scenarios)( '$description', async ({ config }) => { await createClient(config);
const filePaths = getFilePaths( typeof config.output === 'string' ? config.output : config.output.path, );
await Promise.all( filePaths.map(async (filePath) => { const fileContent = fs.readFileSync(filePath, 'utf-8'); await expect(fileContent).toMatchFileSnapshot( path.join(snapshotsDir, filePath.slice(outputDir.length + 1)), ); }), ); }, 15_000, );});