@@ -949,7 +949,8 @@ test("createId", () => {
949949
950950test ( "createIdFromString" , ( ) => {
951951 const id = createIdFromString ( "abc" ) ;
952- expect ( Id . from ( id ) ) . toEqual ( ok ( "QHMpZvrshcOs47aRxCvN-" ) ) ;
952+ expect ( Id . is ( id ) ) . toBe ( true ) ;
953+ expect ( id ) . toEqual ( "QHMpZvrshcOs47aRxCvN-" ) ;
953954
954955 const id1 = createIdFromString ( "user-api-123" ) ;
955956 const id2 = createIdFromString ( "user-api-123" ) ;
@@ -959,6 +960,27 @@ test("createIdFromString", () => {
959960 expect ( id1 ) . toBe ( id2 ) ; // Deterministic
960961 expectTypeOf < typeof id1 > ( ) . toEqualTypeOf < Id > ( ) ;
961962 expectTypeOf < typeof todoId > ( ) . toEqualTypeOf < Id & Brand < "Todo" > > ( ) ;
963+
964+ const emptyId = createIdFromString ( "" ) ;
965+ expect ( Id . is ( emptyId ) ) . toBe ( true ) ;
966+ expect ( emptyId ) . toHaveLength ( 21 ) ;
967+
968+ const longString = "a" . repeat ( 1000 ) ;
969+ const longId = createIdFromString ( longString ) ;
970+ expect ( Id . is ( longId ) ) . toBe ( true ) ;
971+ expect ( longId ) . toHaveLength ( 21 ) ;
972+
973+ const specialId = createIdFromString ( "test!@#$%^&*()_+-={}[]|\\:;\"'<>?,./" ) ;
974+ expect ( Id . is ( specialId ) ) . toBe ( true ) ;
975+ expect ( specialId ) . toHaveLength ( 21 ) ;
976+
977+ const unicodeId = createIdFromString ( "测试🚀💡" ) ;
978+ expect ( Id . is ( unicodeId ) ) . toBe ( true ) ;
979+ expect ( unicodeId ) . toHaveLength ( 21 ) ;
980+
981+ const id3 = createIdFromString ( "test1" ) ;
982+ const id4 = createIdFromString ( "test2" ) ;
983+ expect ( id3 ) . not . toBe ( id4 ) ;
962984} ) ;
963985
964986test ( "PositiveNumber" , ( ) => {
0 commit comments