Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bioviz-js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Remi PLANEL
bioviz-js
Commits
e25f2622
Commit
e25f2622
authored
Jun 11, 2019
by
Remi PLANEL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for phylogram layout
parent
cf9e1f39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
tests/phylogram-layout.test.ts
tests/phylogram-layout.test.ts
+71
-0
No files found.
tests/phylogram-layout.test.ts
0 → 100644
View file @
e25f2622
import
Phylogram
from
"
../src/scripts/layout/phylogram
"
;
import
{
RawPhyloTreeNode
}
from
"
../src/scripts/types
"
;
describe
(
"
Test layout
"
,
()
=>
{
const
data
:
RawPhyloTreeNode
=
{
"
name
"
:
"
root
"
,
branchLength
:
0
,
nodes
:
{
r
:
2
,
fill
:
"
green
"
},
"
children
"
:
[
{
"
name
"
:
"
child0
"
,
branchLength
:
0.5
,
nodes
:
{
fill
:
"
blue
"
}
},
{
"
name
"
:
"
child1
"
,
branchLength
:
0.6
,
nodes
:
{
r
:
8
,
fill
:
"
red
"
},
"
children
"
:
[
{
"
name
"
:
"
child10
"
,
branchLength
:
0.4
},
{
"
name
"
:
"
child11
"
,
branchLength
:
0.1
}
]
}
]
};
const
height
=
900
;
const
width
=
1000
;
const
phylogramLayout
=
Phylogram
().
size
([
height
,
width
]);
const
pointData
=
phylogramLayout
(
data
);
const
child0
=
(
pointData
.
children
)
?
pointData
.
children
[
0
]
:
{
y
:
false
};
const
child10
=
pointData
.
leaves
().
reduce
((
acc
,
curr
)
=>
{
return
(
curr
.
data
.
name
===
"
child10
"
)
?
curr
:
acc
;
},
pointData
)
test
(
"
Root node middle height
"
,
()
=>
{
expect
(
pointData
.
x
).
toBe
(
405
);
})
// Test X
if
(
child0
)
{
test
(
"
Child 0
"
,
()
=>
{
expect
(
child0
.
y
).
toBe
(
500
);
});
}
// Test y
test
(
"
child10
"
,
()
=>
{
expect
(
child10
.
y
).
toBe
(
width
);
})
//test nodes object
test
(
"
root
"
,
()
=>
{
const
nodes
=
pointData
.
data
.
nodes
;
if
(
nodes
)
{
expect
(
nodes
.
r
).
toBe
(
2
);
}
})
})
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment