@@ -82,14 +82,6 @@ describe('CID', () => {
82
82
assert . throws ( ( ) => CID . create ( 0 , 113 , hash ) , msg )
83
83
} )
84
84
85
- // This was failing for quite some time, test just missed await so it went
86
- // unnoticed. Not sure we still care about checking fourth argument.
87
- // it('throws on trying to pass specific base encoding [deprecated]', async () => {
88
- // const hash = await sha256.digest(textEncoder.encode('abc'))
89
- // const msg = 'No longer supported, cannot specify base encoding in instantiation'
90
- // assert.throws(() => CID.create(0, 112, hash, 'base32'), msg)
91
- // })
92
-
93
85
it ( 'throws on trying to base encode CIDv0 in other base than base58btc' , async ( ) => {
94
86
const mhStr = 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n'
95
87
const cid = CID . parse ( mhStr )
@@ -286,18 +278,6 @@ describe('CID', () => {
286
278
)
287
279
} )
288
280
289
- it ( '.isCid' , ( ) => {
290
- assert . ok ( CID . isCID ( CID . parse ( h1 ) ) )
291
-
292
- assert . ok ( ! CID . isCID ( false ) )
293
-
294
- assert . ok ( ! CID . isCID ( textEncoder . encode ( 'hello world' ) ) )
295
-
296
- assert . ok ( CID . isCID ( CID . parse ( h1 ) . toV0 ( ) ) )
297
-
298
- assert . ok ( CID . isCID ( CID . parse ( h1 ) . toV1 ( ) ) )
299
- } )
300
-
301
281
it ( 'works with deepEquals' , ( ) => {
302
282
const ch1 = CID . parse ( h1 )
303
283
assert . deepStrictEqual ( ch1 , CID . parse ( h1 ) )
@@ -515,12 +495,6 @@ describe('CID', () => {
515
495
assert . ok ( equals ( json . hash , hash . bytes ) )
516
496
} )
517
497
518
- it ( 'isCID' , async ( ) => {
519
- const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
520
- const cid = CID . create ( 1 , 112 , hash )
521
- assert . strictEqual ( OLDCID . isCID ( cid ) , false )
522
- } )
523
-
524
498
it ( 'asCID' , async ( ) => {
525
499
const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
526
500
class IncompatibleCID {
@@ -545,7 +519,6 @@ describe('CID', () => {
545
519
const code = 112
546
520
547
521
const incompatibleCID = new IncompatibleCID ( version , code , hash )
548
- assert . ok ( CID . isCID ( incompatibleCID ) )
549
522
assert . strictEqual ( incompatibleCID . toString ( ) , '[object Object]' )
550
523
// @ts -expect-error - no such method
551
524
assert . strictEqual ( typeof incompatibleCID . toV0 , 'undefined' )
@@ -719,59 +692,8 @@ describe('CID', () => {
719
692
)
720
693
} )
721
694
722
- describe ( 'deprecations' , async ( ) => {
723
- it ( 'codec' , async ( ) => {
724
- const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
725
- const cid = CID . create ( 1 , 112 , hash )
726
-
727
- assert . throws (
728
- ( ) => cid . codec ,
729
- '"codec" property is deprecated, use integer "code" property instead'
730
- )
731
- assert . throws (
732
- // @ts -expect-error - 'string' is not assignable to parameter of type 'number'
733
- ( ) => CID . create ( 1 , 'dag-pb' , hash ) ,
734
- 'String codecs are no longer supported'
735
- )
736
- } )
737
-
738
- it ( 'multibaseName' , async ( ) => {
739
- const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
740
- const cid = CID . create ( 1 , 112 , hash )
741
- assert . throws (
742
- ( ) => cid . multibaseName ,
743
- '"multibaseName" property is deprecated'
744
- )
745
- } )
746
-
747
- it ( 'prefix' , async ( ) => {
748
- const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
749
- const cid = CID . create ( 1 , 112 , hash )
750
- assert . throws ( ( ) => cid . prefix , '"prefix" property is deprecated' )
751
- } )
752
-
753
- it ( 'toBaseEncodedString()' , async ( ) => {
754
- const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
755
- const cid = CID . create ( 1 , 112 , hash )
756
- assert . throws (
757
- // @ts -expect-error - deprecated
758
- ( ) => cid . toBaseEncodedString ( ) ,
759
- 'Deprecated, use .toString()'
760
- )
761
- } )
762
- } )
763
-
764
695
it ( 'invalid CID version' , async ( ) => {
765
696
const encoded = varint . encodeTo ( 2 , new Uint8Array ( 32 ) )
766
697
assert . throws ( ( ) => CID . decode ( encoded ) , 'Invalid CID version 2' )
767
698
} )
768
-
769
- it ( 'buffer' , async ( ) => {
770
- const hash = await sha256 . digest ( textEncoder . encode ( 'abc' ) )
771
- const cid = CID . create ( 1 , 112 , hash )
772
- assert . throws (
773
- ( ) => cid . buffer ,
774
- 'Deprecated .buffer property, use .bytes to get Uint8Array instead'
775
- )
776
- } )
777
699
} )
0 commit comments