Skip to content

Commit

Permalink
Change to using assert
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Oct 3, 2024
1 parent c0a0fec commit 17ab526
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint src",
"test": "tsx --test tests/zip.test.ts",
"test": "tsx --test --experimental-test-coverage",
"build": "npx build --package=@zenfs/core --globalName ZenFS_ZIP --entry src/index.ts",
"build:docs": "typedoc --out docs --name 'ZenFS Zip' src/index.ts",
"prepublishOnly": "npm run build"
Expand Down
14 changes: 7 additions & 7 deletions tests/zip.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { configureSingle, fs } from '@zenfs/core';
import { readFileSync } from 'fs';
import assert from 'node:assert';
import { suite, test } from 'node:test';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { Zip } from '../src/ZipFS.js';
import { test, suite } from 'node:test';
import { equal } from 'node:assert';

suite('Basic ZIP operations', () => {
test('Configure', async () => {
Expand All @@ -14,22 +14,22 @@ suite('Basic ZIP operations', () => {
});

test('readdir /', () => {
equal(fs.readdirSync('/').length, 3);
assert(fs.readdirSync('/').length == 3);
});

test('read /one.txt', () => {
equal(fs.readFileSync('/one.txt', 'utf8'), '1');
assert(fs.readFileSync('/one.txt', 'utf8') == '1');
});

test('read /two.txt', () => {
equal(fs.readFileSync('/two.txt', 'utf8'), 'two');
assert(fs.readFileSync('/two.txt', 'utf8') == 'two');
});

test('readdir /nested', () => {
equal(fs.readdirSync('/nested').length, 1);
assert(fs.readdirSync('/nested').length == 1);
});

test('readdir /nested/omg.txt', () => {
equal(fs.readFileSync('/nested/omg.txt', 'utf8'), 'This is a nested file!');
assert(fs.readFileSync('/nested/omg.txt', 'utf8') == 'This is a nested file!');
});
});

0 comments on commit 17ab526

Please sign in to comment.