Skip to content

Commit

Permalink
chore: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
qddegtya committed Feb 26, 2022
1 parent 5d8e0c2 commit 4677293
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 42 deletions.
43 changes: 19 additions & 24 deletions packages/runtime/test/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@

import { Flow } from '../src/index';
import Console from './fixtures/base/console';
import TimestampNode from './fixtures/base/timestamp';
import { Flow } from "../src/index";
import Console from "./fixtures/base/console";
import TimestampNode from "./fixtures/base/timestamp";

test("test base flow", (done) => {
const flow = new Flow({});

const $time = new TimestampNode({
config:{
params:{
interval: 500
}
config: {
params: {
interval: 500,
},
},
})
});

const $console = new Console({
config:{params:{}},
middleware: {
logger: console.log,
},
})
$time.O('Output').connect($console.I('Input'))
config: { params: {} },
middleware: {
logger: console.log,
},
});

$time.O("Output").connect($console.I("Input"));

// run
flow.run($time);

setTimeout(() => {
done();
}, 3000)
}, 3000);
});




10 changes: 4 additions & 6 deletions packages/runtime/test/fixtures/base/console.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@


import { WriteableNode, Port } from '../../../src/index';
import { WriteableNode, Port } from "../../../src/index";

export default class ConsoleNode extends WriteableNode {
constructor(opts = {}) {
super(opts);

Port.I('Input').attach(this);
Port.I("Input").attach(this);
}

_write($i) {
$i('Input').on(payload => {
$i("Input").on((payload) => {
// eslint-disable-next-line no-console
console.log('debug console:', payload);
console.log("debug console:", payload);
});
}
}
22 changes: 10 additions & 12 deletions packages/runtime/test/fixtures/base/timestamp.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@


import { ReadableNode, Port } from '../../../src/index';
import { interval } from 'rxjs';
import moment = require('moment');
import { ReadableNode, Port } from "../../../src/index";
import { interval } from "rxjs";
import moment = require("moment");

export default class TimestampNode extends ReadableNode {
constructor(opts) {
super(opts)
super(opts);

this.opts = opts
this.opts = opts;

Port.I('Input').attach(this)
Port.O('Output').attach(this)
Port.I("Input").attach(this);
Port.O("Output").attach(this);
}

_read($o) {
Expand All @@ -22,10 +20,10 @@ export default class TimestampNode extends ReadableNode {

const source = interval(time);

source.subscribe(() => {
source.subscribe(() => {
const timestamp = moment().toISOString();

$o('Output').send(timestamp);
$o("Output").send(timestamp);
});
}
}
}

0 comments on commit 4677293

Please sign in to comment.