Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
transform: {
'^.+\\.ts?$': ['ts-jest', { tsconfig: './tsconfig.jest.json' }],
},
testRegex: '/test/.*\\.test?\\.ts$',
moduleFileExtensions: ['ts', 'js'],
};
17 changes: 17 additions & 0 deletions test/crc.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {expect, test} from '@jest/globals';

import { crc32 } from "../src/crc32";

describe('crc module', () => {
test('crc for a simple string is correct', async () => {
const something = "something";
var blob = new Blob([something], {
type: 'text/plain'
});

const buffer = await new Response(blob).arrayBuffer();
const bytes = new Uint8Array(buffer);

expect(crc32(bytes)).toBe(0x9DA31FB);
});
});
6 changes: 6 additions & 0 deletions tsconfig.jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"verbatimModuleSyntax": false
}
}