typescript, es6, jest working

This commit is contained in:
unknown 2019-10-30 22:43:25 -04:00
parent 03bc94ff81
commit bc218ceecd
3 changed files with 6429 additions and 2 deletions

6387
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,25 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest --watch"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@types/jest": "^24.0.21",
"babel-jest": "^24.9.0",
"jest": "^24.9.0",
"ts-jest": "^24.1.0",
"typescript": "^3.6.2"
}
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
]
},
"dependencies": {}
}

26
table.test.ts Normal file
View File

@ -0,0 +1,26 @@
import {Table, Sum} from './table';
describe("table library", ()=>
{
var table: Table;
var rows: Array<Array<string>>;
var summationColumns: Array<number>;
rows = [
["a","1"],
["b","2"],
["a","3"],
["b","1"],
["a","2"],
["b","3"],
];
summationColumns = [1];
table = new Table("Root", rows, summationColumns);
it("should create a table", ()=>
{
expect(table.Name).toEqual("Root");
expect(table.Rows).toEqual(rows);
});
})