Skip to content

Commit

Permalink
chore: Replace ava with Node.js test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkeaton committed Jan 11, 2024
1 parent 72dc29a commit 1dfe1d2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"description": "Parse a .skiz file exported from Ski Tracks",
"version": "0.0.0-development",
"author": "Kirk Eaton <[email protected]>",
"ava": {
"files": [
"test/**/*.test.js"
],
"timeout": "2m"
},
"bugs": {
"url": "https://github.com/kirkeaton/skiz-parser/issues"
},
Expand All @@ -19,7 +13,6 @@
},
"devDependencies": {
"@types/node": "20.10.6",
"ava": "6.0.1",
"husky": "8.0.3",
"lint-staged": "15.2.0",
"prettier": "3.1.1",
Expand Down Expand Up @@ -65,7 +58,7 @@
},
"scripts": {
"prepare": "husky install",
"test": "ava -v && tsd"
"test": "node --test && tsd"
},
"type": "module"
}
55 changes: 28 additions & 27 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import test from 'ava';
import { promises as fsAsync } from 'fs';
import assert from 'node:assert/strict';
import test from 'node:test';
import path from 'path';
import { fileURLToPath } from 'url';

Expand All @@ -12,19 +13,19 @@ test('should parse .skiz file using promises', async (t) => {
const file = await fsAsync.readFile(filename);
const result = await parseSkizFile(file);

t.is(result.name, 'Day 15 - 2020/2021');
t.is(result.activity, 'skiing');
t.truthy(result.trackMetrics);
t.truthy(result.trackEvents);
t.truthy(result.trackSegments);
t.truthy(result.trackNodes);
t.truthy(result.batteryUsage);
t.truthy(result.relativeAltitude);
t.truthy(result.trackEvents.length);
t.truthy(result.trackSegments.length);
t.truthy(result.trackNodes.length);
t.truthy(result.batteryUsage.length);
t.truthy(result.relativeAltitude.length);
assert.equal(result.name, 'Day 15 - 2020/2021');
assert.equal(result.activity, 'skiing');
assert.ok(result.trackMetrics);
assert.ok(result.trackEvents);
assert.ok(result.trackSegments);
assert.ok(result.trackNodes);
assert.ok(result.batteryUsage);
assert.ok(result.relativeAltitude);
assert.ok(result.trackEvents.length);
assert.ok(result.trackSegments.length);
assert.ok(result.trackNodes.length);
assert.ok(result.batteryUsage.length);
assert.ok(result.relativeAltitude.length);
});

test('should parse .skiz file using callback', async (t) => {
Expand All @@ -35,19 +36,19 @@ test('should parse .skiz file using callback', async (t) => {
return reject(err);
}

t.is(result.name, 'Day 15 - 2020/2021');
t.is(result.activity, 'skiing');
t.truthy(result.trackMetrics);
t.truthy(result.trackEvents);
t.truthy(result.trackSegments);
t.truthy(result.trackNodes);
t.truthy(result.batteryUsage);
t.truthy(result.relativeAltitude);
t.truthy(result.trackEvents.length);
t.truthy(result.trackSegments.length);
t.truthy(result.trackNodes.length);
t.truthy(result.batteryUsage.length);
t.truthy(result.relativeAltitude.length);
assert.equal(result.name, 'Day 15 - 2020/2021');
assert.equal(result.activity, 'skiing');
assert.ok(result.trackMetrics);
assert.ok(result.trackEvents);
assert.ok(result.trackSegments);
assert.ok(result.trackNodes);
assert.ok(result.batteryUsage);
assert.ok(result.relativeAltitude);
assert.ok(result.trackEvents.length);
assert.ok(result.trackSegments.length);
assert.ok(result.trackNodes.length);
assert.ok(result.batteryUsage.length);
assert.ok(result.relativeAltitude.length);
resolve();
});
});
Expand Down

0 comments on commit 1dfe1d2

Please sign in to comment.