11import { Tokenizer } from "../src" ;
22import type { Encoding } from "../src" ;
3- import { Metaspace , Whitespace } from "../src/pre-tokenizers " ;
4- import { BPE } from "../src/models " ;
3+ import { MetaspacePreTokenizer , Whitespace } from "../src" ;
4+ import { BPE } from "../src" ;
55
66describe ( "Additional exports" , ( ) => {
77 describe ( "Main exports" , ( ) => {
@@ -21,14 +21,14 @@ describe("Additional exports", () => {
2121 } ) ;
2222
2323 describe ( "Pre-tokenizer exports" , ( ) => {
24- it ( "should export Metaspace pre-tokenizer " , ( ) => {
25- expect ( Metaspace ) . toBeDefined ( ) ;
26- const metaspace = new Metaspace ( {
24+ it ( "should export MetaspacePreTokenizer " , ( ) => {
25+ expect ( MetaspacePreTokenizer ) . toBeDefined ( ) ;
26+ const metaspace = new MetaspacePreTokenizer ( {
2727 type : "Metaspace" ,
2828 replacement : "▁" ,
2929 add_prefix_space : true ,
3030 } ) ;
31- expect ( metaspace ) . toBeInstanceOf ( Metaspace ) ;
31+ expect ( metaspace ) . toBeInstanceOf ( MetaspacePreTokenizer ) ;
3232 } ) ;
3333
3434 it ( "should export Whitespace pre-tokenizer" , ( ) => {
@@ -37,8 +37,8 @@ describe("Additional exports", () => {
3737 expect ( whitespace ) . toBeInstanceOf ( Whitespace ) ;
3838 } ) ;
3939
40- it ( "Metaspace pre-tokenizer should work correctly" , ( ) => {
41- const metaspace = new Metaspace ( {
40+ it ( "MetaspacePreTokenizer should work correctly" , ( ) => {
41+ const metaspace = new MetaspacePreTokenizer ( {
4242 type : "Metaspace" ,
4343 replacement : "▁" ,
4444 add_prefix_space : true ,
@@ -71,23 +71,18 @@ describe("Additional exports", () => {
7171 } ) ;
7272 } ) ;
7373
74- describe ( "Integration test - import paths" , ( ) => {
75- it ( "should support the documented import syntax" , async ( ) => {
76- // This test verifies that the documented import paths work
77- // import { Tokenizer, Encoding } from "@huggingface/tokenizers";
78- const { Tokenizer : T1 } = await import ( "../src/index" ) ;
74+ describe ( "Integration test - import from main export" , ( ) => {
75+ it ( "should support importing everything from main export" , async ( ) => {
76+ // All exports should be available from the main index
77+ const {
78+ Tokenizer : T1 ,
79+ MetaspacePreTokenizer : M1 ,
80+ Whitespace : W1 ,
81+ BPE : B1 ,
82+ } = await import ( "../src/index" ) ;
7983 expect ( T1 ) . toBeDefined ( ) ;
80- // Encoding is a type-only export, so we can't test it at runtime
81-
82- // import { Metaspace, Whitespace } from "@huggingface/tokenizers/pre-tokenizers";
83- const { Metaspace : M1 , Whitespace : W1 } = await import (
84- "../src/pre-tokenizers"
85- ) ;
8684 expect ( M1 ) . toBeDefined ( ) ;
8785 expect ( W1 ) . toBeDefined ( ) ;
88-
89- // import { BPE } from "@huggingface/tokenizers/models";
90- const { BPE : B1 } = await import ( "../src/models" ) ;
9186 expect ( B1 ) . toBeDefined ( ) ;
9287 } ) ;
9388 } ) ;
0 commit comments