-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters