Skip to content

Commit

Permalink
test: use fast-check to improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xballoy committed Feb 6, 2025
1 parent bdcfe9e commit 516c675
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
41 changes: 41 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@types/vscode": "1.97.0",
"@vscode/test-cli": "0.0.10",
"@vscode/test-electron": "2.4.1",
"fast-check": "3.23.2",
"swc-loader": "0.2.6",
"typescript": "5.7.3",
"webpack": "5.97.1",
Expand Down
9 changes: 6 additions & 3 deletions src/test/extension.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { strictEqual } from 'node:assert';
import { gzipText } from '../core/gzipText';
import { unzipText } from '../core/unzipText';
import fc from 'fast-check';

suite('Gzip / Unzip text Test Suite', () => {
test('should be reversible', () => {
const input = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 👍';

strictEqual(unzipText(gzipText(input)), input);
fc.assert(
fc.property(fc.string(), (text) => {
strictEqual(unzipText(gzipText(text)), text);
})
)
});
});

0 comments on commit 516c675

Please sign in to comment.