Commit 8b94eaf7 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Add tests

parent 161ad58a
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
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment