Skip to content

Commit 8381440

Browse files
committed
Initial Mocha Unit tests
1 parent c33024e commit 8381440

5 files changed

Lines changed: 42 additions & 11 deletions

File tree

File renamed without changes.

test/unit/stats.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* ---------------------------------------------------------------------------------------------
2+
* Copyright (c) Applied Eng & Design All rights reserved.
3+
* Licensed under the MIT License. See License.md in the project root for license information.
4+
* -------------------------------------------------------------------------------------------- */
5+
6+
'use strict';
7+
8+
import { expect } from 'chai';
9+
import { GCodeRuntimeParser } from '../../src/views/providers/gcodeRuntimeParser';
10+
import fs from 'fs';
11+
import path from 'path';
12+
13+
describe('G-Code Stats', () => {
14+
it('calculates the correct runtime', () => {
15+
const gcr = new GCodeRuntimeParser(
16+
fs.readFileSync(path.resolve(__dirname, '..', '..', 'samplenc', 'sample-profile.nc')).toString(),
17+
);
18+
gcr.update();
19+
20+
expect(gcr.getRuntime()).to.be.equal(59.74464683955828);
21+
});
22+
});

tsconfig.json

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
{
22
"compilerOptions": {
3+
"esModuleInterop": true,
4+
"forceConsistentCasingInFileNames": true,
5+
"incremental": true,
6+
"isolatedModules": true,
7+
"lib": [
8+
"es2019"
9+
],
310
"module": "commonjs",
411
"moduleResolution": "node",
5-
"target": "ES2019",
12+
"noFallthroughCasesInSwitch": true,
13+
"noImplicitReturns": true,
14+
"noUnusedLocals": false,
15+
"newLine": "lf",
616
"outDir": "out",
7-
"lib": [
8-
"ES2019"
9-
],
17+
"resolveJsonModule": true,
18+
"rootDir": ".",
19+
"skipLibCheck": true,
1020
"sourceMap": true,
11-
"rootDir": "src",
1221
"strict": true,
13-
"resolveJsonModule": true,
14-
"newLine": "lf",
15-
"removeComments": true,
16-
"esModuleInterop": true,
17-
"forceConsistentCasingInFileNames": true,
18-
"skipLibCheck": true
22+
"target": "es2019",
23+
"useDefineForClassFields": true
1924
},
25+
"include": [
26+
"src/**/*.ts",
27+
"test/**/*.ts"
28+
],
2029
"exclude": [
2130
"node_modules",
2231
"samplenc",

0 commit comments

Comments
 (0)