44 * Tests the built artifacts using Noble crypto plugin (Deno-compatible).
55 */
66
7- import {
8- assertEquals ,
9- assertNotEquals ,
10- assertMatch ,
11- assertThrows ,
12- assertInstanceOf ,
13- } from "@std/assert" ;
7+ import { describe , it } from "@std/testing/bdd" ;
8+ import { expect } from "@std/expect" ;
149import { NobleCryptoPlugin } from "@otplib/plugin-crypto-noble" ;
1510import { ScureBase32Plugin } from "@otplib/plugin-base32-scure" ;
1611import { TOTP } from "@otplib/totp" ;
@@ -23,7 +18,6 @@ import {
2318 verifySync ,
2419 OTP ,
2520} from "otplib" ;
26- import { createDenoTestContext } from "@repo/testing" ;
2721
2822import { createHOTPDistributionTests } from "./hotp-test.ts" ;
2923import { createTOTPDistributionTests } from "./totp-test.ts" ;
@@ -33,41 +27,38 @@ import { createURIDistributionTests } from "./uri-test.ts";
3327const crypto = new NobleCryptoPlugin ( ) ;
3428const base32 = new ScureBase32Plugin ( ) ;
3529
36- // Create Deno test context for URI
37- const uriCtx = createDenoTestContext (
38- { assertEquals, assertNotEquals, assertMatch, assertThrows, assertInstanceOf } ,
39- { } ,
40- ) ;
41-
42- createURIDistributionTests ( uriCtx ) ;
43- uriCtx . runTests ( ) ;
44-
45- // Create Deno test context for HOTP
46- const hotpCtx = createDenoTestContext (
47- { assertEquals, assertNotEquals, assertMatch, assertThrows, assertInstanceOf } ,
48- { crypto, base32 } ,
49- ) ;
50-
51- createHOTPDistributionTests ( hotpCtx ) ;
52- hotpCtx . runTests ( ) ;
53-
54- // Create Deno test context for TOTP
55- const totpCtx = createDenoTestContext (
56- { assertEquals, assertNotEquals, assertMatch, assertThrows, assertInstanceOf } ,
57- { crypto, base32 } ,
58- ) ;
30+ // Run URI distribution tests
31+ createURIDistributionTests ( {
32+ describe,
33+ it,
34+ expect,
35+ } ) ;
5936
60- createTOTPDistributionTests ( totpCtx ) ;
61- totpCtx . runTests ( ) ;
37+ // Run HOTP distribution tests
38+ createHOTPDistributionTests ( {
39+ describe,
40+ it,
41+ expect,
42+ crypto,
43+ base32,
44+ } ) ;
6245
63- // Create Deno test context for otplib
64- const otplibCtx = createDenoTestContext (
65- { assertEquals, assertNotEquals, assertMatch, assertThrows, assertInstanceOf } ,
66- { crypto, base32 } ,
67- ) ;
46+ // Run TOTP distribution tests
47+ createTOTPDistributionTests ( {
48+ describe,
49+ it,
50+ expect,
51+ crypto,
52+ base32,
53+ } ) ;
6854
55+ // Run otplib distribution tests
6956createOtplibDistributionTests ( {
70- ...otplibCtx ,
57+ describe,
58+ it,
59+ expect,
60+ crypto,
61+ base32,
7162 otplib : {
7263 generateSecret,
7364 generateURI,
@@ -79,4 +70,3 @@ createOtplibDistributionTests({
7970 OTP ,
8071 } ,
8172} ) ;
82- otplibCtx . runTests ( ) ;
0 commit comments