Skip to content

Commit

Permalink
test fixes, example tweaks, repo link fix (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
GabiGrin authored Mar 8, 2024
1 parent a94cc44 commit 0b09375
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 86 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"vscode": "^1.75.0"
},
"icon": "icon.png",
"repository": "https://github.com/flydehq/flyde-vscode",
"repository": "https://github.com/flydelabs/flyde-vscode",
"categories": [
"Programming Languages",
"Visualization",
Expand Down Expand Up @@ -214,4 +214,4 @@
"ts-node": "^10.9.2"
},
"packageManager": "[email protected]"
}
}
5 changes: 1 addition & 4 deletions src/editor/open-flyde-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ export async function getWebviewContent(params: WebviewContentParams) {
<link href="https://fonts.googleapis.com/css?family=Montserrat|Roboto|Roboto+Condensed|Roboto+Mono"
rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Source+Sans+Pro" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800;900&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
Expand Down
39 changes: 35 additions & 4 deletions src/test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,46 @@
// as well as import your extension to test it
import * as vscode from "vscode";
import * as path from "path";
import * as fs from "fs";
import * as os from "os";

import { webviewTestingCommand } from "./testUtils";
import assert = require("assert");
import { eventually } from "@flyde/core";
import { getTemplates } from "../templateUtils";

let tmpDir = "";

suite("Extension Test Suite", () => {
suiteSetup(() => {
// copy all test-fixtures to a temp directory
// and set the workspace to that directory
tmpDir = path.join(os.tmpdir(), `flyde-test-fixtures-${Date.now()}`);

if (!fs.existsSync(tmpDir)) {
fs.mkdirSync(tmpDir, { recursive: true });

const fixturesDir = path.resolve(__dirname, "../../test-fixtures");

fs.readdirSync(fixturesDir).forEach((file) => {
const source = path.join(fixturesDir, file);
const dest = path.join(tmpDir, file);
fs.copyFileSync(source, dest);
});

const templatesDir = path.resolve(__dirname, "../../templates");
fs.readdirSync(templatesDir).forEach((templateFolder) => {
const source = path.join(templatesDir, templateFolder, `Example.flyde`);
const dest = path.join(tmpDir, `${templateFolder}.flyde`);
fs.copyFileSync(source, dest);
});
console.log(`Temporary directory created at ${tmpDir}`);
} else {
throw new Error("Temporary directory already exists");
}
});
test("Loads test flow and renders instance views", async () => {
const testFile = vscode.Uri.file(
path.resolve(__dirname, "../../test-fixtures/HelloWorld.flyde")
);
const testFile = vscode.Uri.file(path.resolve(tmpDir, "HelloWorld.flyde"));

await vscode.commands.executeCommand(
"vscode.openWith",
Expand Down Expand Up @@ -77,7 +107,8 @@ suite("Extension Test Suite", () => {

templateFiles.forEach((templateFile) => {
test(`Loads ${templateFile.name} template`, async () => {
const flowPath = path.join(templateFile.fullPath, "Example.flyde");
const templateFolder = templateFile.fullPath.split(path.sep).pop();
const flowPath = path.join(tmpDir, `${templateFolder}.flyde`);
const testFile = vscode.Uri.file(flowPath);

await vscode.commands.executeCommand(
Expand Down
124 changes: 48 additions & 76 deletions templates/combine-apis/Example.flyde
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ imports:
- CodeExpression
- Http
- Loop List
- Get Attribute
- Collect
- GetAttribute
node:
instances:
- pos:
Expand All @@ -31,44 +31,6 @@ node:
id: Example-er2490w
inputConfig: {}
nodeId: Loop List
- pos:
x: 41.97147338867188
y: 140.09222335815429
id: Get Attribute-bu349tr
inputConfig:
attribute:
mode: sticky
nodeId: Get Attribute
- pos:
x: -278.4306311035156
y: 130.01132415771485
id: Example-08049sl
inputConfig:
attribute:
mode: sticky
nodeId: Get Attribute
- pos:
x: 242.60955810546875
y: 5.8730010986328125
id: ydryp0wq8nwbwust0b2h6gj0
inputConfig: {}
nodeId: InlineValue__ydryp0wq8nwbwust0b2h6gj0
macroId: InlineValue
macroData:
type: string
value: first_name
label: '"first_name"'
- pos:
x: -98.13684509277346
y: 30.92610443115234
id: Example-mt149qn
inputConfig: {}
nodeId: InlineValue__Example-mt149qn
macroId: InlineValue
macroData:
type: string
value: name
label: '"name"'
- pos:
x: -203.3569860839844
y: 242.0537305481027
Expand Down Expand Up @@ -244,8 +206,8 @@ node:
icon: beer
color: "#fee440"
- pos:
x: -91.95058837890622
y: 357.4822429319957
x: -117.35210815429684
y: 348.5079768797496
id: n38bkbjwe57oxvd1nvztu9gv
inputConfig: {}
nodeId: Collect__n38bkbjwe57oxvd1nvztu9gv
Expand All @@ -254,7 +216,29 @@ node:
strategy: count
count:
mode: static
count: 5
value: 5
- pos:
x: -66.03905883789065
y: 113.72089470890216
id: pcld2qma2841gzcfyqurwu4a
inputConfig: {}
nodeId: GetAttribute__pcld2qma2841gzcfyqurwu4a
macroId: GetAttribute
macroData:
key:
value: first_name
mode: static
- pos:
x: -346.9323999023437
y: 112.26985473632811
id: Example-w0049zu
inputConfig: {}
nodeId: GetAttribute__Example-w0049zu
macroId: GetAttribute
macroData:
key:
value: name
mode: static
connections:
- from:
insId: lppjv85ixcde390hug6eonj5
Expand All @@ -281,53 +265,41 @@ node:
insId: Example-er2490w
pinId: list
- from:
insId: Loop List-a2149ei
pinId: item
to:
insId: Get Attribute-bu349tr
pinId: object
- from:
insId: Example-er2490w
pinId: item
to:
insId: Example-08049sl
pinId: object
- from:
insId: ydryp0wq8nwbwust0b2h6gj0
insId: zfhcgwxnesaxpux6bgjwnan2
pinId: value
to:
insId: Get Attribute-bu349tr
pinId: attribute
- from:
insId: Example-mt149qn
insId: n38bkbjwe57oxvd1nvztu9gv
pinId: value
- from:
insId: n38bkbjwe57oxvd1nvztu9gv
pinId: list
to:
insId: Example-08049sl
pinId: attribute
insId: __this
pinId: data
- from:
insId: Get Attribute-bu349tr
insId: pcld2qma2841gzcfyqurwu4a
pinId: value
to:
insId: zfhcgwxnesaxpux6bgjwnan2
pinId: beer
- from:
insId: Example-08049sl
pinId: value
insId: Loop List-a2149ei
pinId: item
to:
insId: zfhcgwxnesaxpux6bgjwnan2
pinId: user
insId: pcld2qma2841gzcfyqurwu4a
pinId: object
- from:
insId: zfhcgwxnesaxpux6bgjwnan2
pinId: value
insId: Example-er2490w
pinId: item
to:
insId: n38bkbjwe57oxvd1nvztu9gv
pinId: value
insId: Example-w0049zu
pinId: object
- from:
insId: n38bkbjwe57oxvd1nvztu9gv
pinId: list
insId: Example-w0049zu
pinId: value
to:
insId: __this
pinId: data
insId: zfhcgwxnesaxpux6bgjwnan2
pinId: user
id: Example
inputs: {}
outputs:
Expand All @@ -339,5 +311,5 @@ node:
x: -23.264428942324532
y: 237.25953921502617
data:
x: -26.658421630859372
y: 481.40048507690426
x: -35.6508837890625
y: 469.41647628784176

0 comments on commit 0b09375

Please sign in to comment.