Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Remi PLANEL
bioviz-js
Commits
8b94eaf7
Commit
8b94eaf7
authored
May 28, 2019
by
Remi PLANEL
Browse files
Add tests
parent
161ad58a
Changes
2
Hide whitespace changes
Inline
Side-by-side
jest.config.js
0 → 100644
View file @
8b94eaf7
module
.
exports
=
{
// roots: ['<rootDir>/src/scripts'],
transform
:
{
"
^.+
\\
.(ts|tsx)$
"
:
"
ts-jest
"
,
},
testRegex
:
"
/tests/.*
\\
.(test|spec)
\\
.(jsx?|tsx?|ts)$
"
,
moduleFileExtensions
:
[
"
ts
"
,
"
tsx
"
,
"
js
"
,
"
jsx
"
,
"
json
"
,
"
node
"
],
};
\ No newline at end of file
tests/linear-gene.test.ts
0 → 100644
View file @
8b94eaf7
import
linearGene
from
"
../src/scripts/layout/linear-gene
"
;
import
{
scaleLinear
}
from
"
d3-scale
"
;
import
{
GeneData
}
from
"
../src/scripts/types
"
;
describe
(
"
Test linear gene layout
"
,
()
=>
{
const
data
:
GeneData
[]
=
[{
name
:
"
gene 1
"
,
strand
:
"
-
"
,
begin
:
10
,
end
:
50
,
gene
:
"
insA
"
,
},
{
name
:
"
gene 2
"
,
strand
:
"
+
"
,
begin
:
60
,
end
:
100
,
gene
:
"
yaaY
"
,
}];
const
xScale
=
scaleLinear
()
.
domain
([
0
,
120
])
.
range
([
0
,
1200
])
const
linearGeneWithPostion
=
linearGene
(
data
,
xScale
);
describe
(
"
Test gene 1
"
,
()
=>
{
const
{
position
:
{
x
,
width
}
}
=
linearGeneWithPostion
[
0
]
test
(
"
Test x position
"
,
()
=>
{
expect
(
x
).
toBe
(
100
);
});
test
(
"
Test width
"
,
()
=>
{
expect
(
width
).
toBe
(
400
);
})
});
describe
(
"
Test gene 2
"
,
()
=>
{
const
{
position
:
{
x
,
width
}
}
=
linearGeneWithPostion
[
1
]
test
(
"
Test x position
"
,
()
=>
{
expect
(
x
).
toBe
(
600
);
})
test
(
"
Test width
"
,
()
=>
{
expect
(
width
).
toBe
(
400
);
})
});
});
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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