mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-11 17:46:41 -05:00
Update importers for folder environment and fix tests
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"scripts": {
|
||||
"build": "yaakcli build",
|
||||
"dev": "yaakcli dev",
|
||||
"lint":"tsc --noEmit && eslint . --ext .ts,.tsx"
|
||||
"lint": "tsc --noEmit && eslint . --ext .ts,.tsx",
|
||||
"test": "vitest --run tests"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,11 @@ export function convertPostman(contents: string): ImportPluginResponse | undefin
|
||||
|
||||
const rawDescription = info.description;
|
||||
const description =
|
||||
typeof rawDescription === 'object' && rawDescription !== null && 'content' in rawDescription
|
||||
typeof rawDescription === 'object' && rawDescription != null && 'content' in rawDescription
|
||||
? String(rawDescription.content)
|
||||
: String(rawDescription);
|
||||
: rawDescription == null
|
||||
? undefined
|
||||
: String(rawDescription);
|
||||
|
||||
const workspace: ExportResources['workspaces'][0] = {
|
||||
model: 'workspace',
|
||||
@@ -75,6 +77,8 @@ export function convertPostman(contents: string): ImportPluginResponse | undefin
|
||||
id: generateId('environment'),
|
||||
name: 'Global Variables',
|
||||
workspaceId: workspace.id,
|
||||
parentModel: 'workspace',
|
||||
parentId: null,
|
||||
variables:
|
||||
toArray<{ key: string; value: string }>(root.variable).map((v) => ({
|
||||
name: v.key,
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
"model": "environment",
|
||||
"name": "Global Variables",
|
||||
"variables": [],
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_0"
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_0",
|
||||
"parentId": null,
|
||||
"parentModel": "workspace"
|
||||
}
|
||||
],
|
||||
"httpRequests": [
|
||||
@@ -25,6 +27,7 @@
|
||||
"name": "Request 1",
|
||||
"method": "GET",
|
||||
"url": "",
|
||||
"sortPriority": 2,
|
||||
"urlParameters": [],
|
||||
"body": {},
|
||||
"bodyType": null,
|
||||
@@ -39,6 +42,7 @@
|
||||
"folderId": "GENERATE_ID::FOLDER_0",
|
||||
"name": "Request 2",
|
||||
"method": "GET",
|
||||
"sortPriority": 3,
|
||||
"url": "",
|
||||
"urlParameters": [],
|
||||
"body": {},
|
||||
@@ -52,6 +56,7 @@
|
||||
"id": "GENERATE_ID::HTTP_REQUEST_2",
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_0",
|
||||
"folderId": null,
|
||||
"sortPriority": 4,
|
||||
"name": "Request 3",
|
||||
"method": "GET",
|
||||
"url": "",
|
||||
@@ -69,6 +74,7 @@
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_0",
|
||||
"id": "GENERATE_ID::FOLDER_0",
|
||||
"name": "Top Folder",
|
||||
"sortPriority": 0,
|
||||
"folderId": null
|
||||
},
|
||||
{
|
||||
@@ -76,6 +82,7 @@
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_0",
|
||||
"id": "GENERATE_ID::FOLDER_1",
|
||||
"name": "Nested Folder",
|
||||
"sortPriority": 1,
|
||||
"folderId": "GENERATE_ID::FOLDER_0"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_1",
|
||||
"model": "environment",
|
||||
"name": "Global Variables",
|
||||
"parentId": null,
|
||||
"parentModel": "workspace",
|
||||
"variables": [
|
||||
{
|
||||
"name": "COLLECTION VARIABLE",
|
||||
@@ -28,6 +30,7 @@
|
||||
"workspaceId": "GENERATE_ID::WORKSPACE_1",
|
||||
"folderId": null,
|
||||
"name": "Form URL",
|
||||
"sortPriority": 0,
|
||||
"method": "POST",
|
||||
"url": "example.com/:foo/:bar",
|
||||
"urlParameters": [
|
||||
|
||||
Reference in New Issue
Block a user