mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 12:11:53 +01:00
Fix tests and lint
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
import { Context } from '@yaakapp/api';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { pluginHookImport } from '../src';
|
||||
|
||||
const ctx = {} as Context;
|
||||
|
||||
describe('importer-openapi', () => {
|
||||
const p = path.join(__dirname, 'fixtures');
|
||||
const fixtures = fs.readdirSync(p);
|
||||
|
||||
test('Skips invalid file', async () => {
|
||||
const imported = await pluginHookImport({}, '{}');
|
||||
const imported = await pluginHookImport(ctx, '{}');
|
||||
expect(imported).toBeUndefined();
|
||||
})
|
||||
|
||||
for (const fixture of fixtures) {
|
||||
test('Imports ' + fixture, async () => {
|
||||
const contents = fs.readFileSync(path.join(p, fixture), 'utf-8');
|
||||
const imported = await pluginHookImport({}, contents);
|
||||
const imported = await pluginHookImport(ctx, contents);
|
||||
expect(imported?.resources.workspaces).toEqual([
|
||||
expect.objectContaining({
|
||||
name: 'Swagger Petstore - OpenAPI 3.0',
|
||||
|
||||
Reference in New Issue
Block a user