-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* backbone pretty print * add: toJSON and fix tree generation * add: tests * fix: tree order loading * add: tcs declaration * fix: manage of function with same names * remove: after show in pretty print * add: test more strict * add: map to track nodeIds * add: map to track parents * fix: prettyPrint return string and typo * fix: time is too relative
- Loading branch information
Showing
9 changed files
with
427 additions
and
1 deletion.
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict' | ||
|
||
const test = require('tap').test | ||
const boot = require('..') | ||
|
||
test('pretty print', t => { | ||
t.plan(14) | ||
|
||
const app = boot() | ||
app | ||
.use(first) | ||
.use(duplicate, { count: 3 }) | ||
.use(second) | ||
.use(duplicate, { count: 2 }) | ||
.use(third) | ||
.use(duplicate, { count: 1 }) | ||
|
||
const linesExpected = [ /bound root \d+ ms/, | ||
/├── first \d+ ms/, | ||
/├─┬ duplicate \d+ ms/, | ||
/│ └─┬ duplicate \d+ ms/, | ||
/│ {3}└─┬ duplicate \d+ ms/, | ||
/│ {5}└── duplicate \d+ ms/, | ||
/├── second \d+ ms/, | ||
/├─┬ duplicate \d+ ms/, | ||
/│ └─┬ duplicate \d+ ms/, | ||
/│ {3}└── duplicate \d+ ms/, | ||
/├── third \d+ ms/, | ||
/└─┬ duplicate \d+ ms/, | ||
/ {2}└── duplicate \d+ ms/, | ||
'' | ||
] | ||
|
||
app.on('preReady', function show () { | ||
const print = app.prettyPrint() | ||
print.split('\n').forEach((l, i) => { | ||
t.match(l, linesExpected[i]) | ||
}) | ||
}) | ||
|
||
function first (s, opts, done) { | ||
done() | ||
} | ||
function second (s, opts, done) { | ||
done() | ||
} | ||
function third (s, opts, done) { | ||
done() | ||
} | ||
|
||
function duplicate (instance, opts, cb) { | ||
if (opts.count > 0) { | ||
instance.use(duplicate, { count: opts.count - 1 }) | ||
} | ||
setTimeout(cb, 20) | ||
} | ||
}) |
Oops, something went wrong.