mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-18 23:19:39 +02:00
Copy as curl
This commit is contained in:
1681
plugins/importer-curl/package-lock.json
generated
1681
plugins/importer-curl/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,11 +2,10 @@
|
||||
"name": "importer-curl",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"shell-quote": "^1.8.1",
|
||||
"url": "^0.11.3"
|
||||
"shell-quote": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"random-seedable": "^1.0.8"
|
||||
"vitest": "^1.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ type Pair = string | boolean;
|
||||
|
||||
type PairsByName = Record<string, Pair[]>;
|
||||
|
||||
export const pluginHookImport = (rawData: string) => {
|
||||
export function pluginHookImport(rawData: string) {
|
||||
if (!rawData.match(/^\s*curl /)) {
|
||||
return null;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export const pluginHookImport = (rawData: string) => {
|
||||
workspaces: [workspace],
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export function importCommand(parseEntries: ParseEntry[], workspaceId: string) {
|
||||
// ~~~~~~~~~~~~~~~~~~~~~ //
|
||||
|
||||
@@ -1,22 +1,8 @@
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { HttpRequest, Model, Workspace } from '../../../src-web/lib/models';
|
||||
import { pluginHookImport } from '../src';
|
||||
import { XORShift } from 'random-seedable';
|
||||
|
||||
let originalRandom = Math.random;
|
||||
|
||||
describe('importer-curl', () => {
|
||||
beforeEach(() => {
|
||||
const rand = new XORShift(123456789);
|
||||
Math.random = vi.fn(() => {
|
||||
return rand.float();
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Math.random = originalRandom;
|
||||
});
|
||||
|
||||
test('Imports basic GET', () => {
|
||||
expect(pluginHookImport('curl https://yaak.app')).toEqual({
|
||||
resources: {
|
||||
|
||||
Reference in New Issue
Block a user