File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 2727 "tslib" : " ^2.6.2"
2828 },
2929 "devDependencies" : {
30+ "@smithy/util-base64" : " ^3.0.0" ,
3031 "@tsconfig/recommended" : " 1.0.1" ,
3132 "concurrently" : " 7.0.0" ,
3233 "downlevel-dts" : " 0.10.1" ,
Original file line number Diff line number Diff line change 1+ import { toBase64 } from "@smithy/util-base64" ;
2+ import { describe , expect , it } from "vitest" ;
3+
4+ import { CrtCrc64Nvme } from "./CrtCrc64Nvme" ;
5+
6+ describe ( CrtCrc64Nvme . name , ( ) => {
7+ it ( "should throw an error if digest is called before update" , async ( ) => {
8+ const crc64 = new CrtCrc64Nvme ( ) ;
9+ await expect ( crc64 . digest ( ) ) . rejects . toThrowError ( "No data provided to checksum" ) ;
10+ } ) ;
11+
12+ it . each ( [
13+ [ "" , "AAAAAAAAAAA=" ] ,
14+ [ "abc" , "BeXKuz/B+us=" ] ,
15+ [ "Hello world" , "OOJZ0D8xKts=" ] ,
16+ ] ) ( `crc64-nvme for "%s" is "%s"` , async ( input , output ) => {
17+ const crc64 = new CrtCrc64Nvme ( ) ;
18+ crc64 . update ( new TextEncoder ( ) . encode ( input ) ) ;
19+ const digest = await crc64 . digest ( ) ;
20+ expect ( toBase64 ( digest ) ) . toEqual ( output ) ;
21+ } ) ;
22+ } ) ;
Original file line number Diff line number Diff line change 1+ import { defineConfig } from "vitest/config" ;
2+
3+ export default defineConfig ( {
4+ test : {
5+ include : [ "**/*.spec.ts" ] ,
6+ environment : "node" ,
7+ } ,
8+ } ) ;
Original file line number Diff line number Diff line change @@ -23252,6 +23252,7 @@ __metadata:
2325223252 dependencies:
2325323253 "@aws-sdk/crt-loader": "npm:*"
2325423254 "@aws-sdk/types": "npm:*"
23255+ "@smithy/util-base64": "npm:^3.0.0"
2325523256 "@smithy/util-utf8": "npm:^3.0.0"
2325623257 "@tsconfig/recommended": "npm:1.0.1"
2325723258 concurrently: "npm:7.0.0"
You can’t perform that action at this time.
0 commit comments