1
- import { expect } from "chai " ;
1
+ import { describe , it , expect } from "vitest " ;
2
2
import { ForkInfo } from "@lodestar/config" ;
3
3
import { allForks , capella } from "@lodestar/types" ;
4
4
import { isForkExecution } from "@lodestar/params" ;
9
9
isBlindedBytes ,
10
10
serializeFullOrBlindedSignedBeaconBlock ,
11
11
} from "../../../src/util/fullOrBlindedBlock.js" ;
12
- import { chainConfig , mockBlocks } from "../../utils/ mocks/block.js" ;
12
+ import { chainConfig , mockBlocks } from "../../mocks/block.js" ;
13
13
import { byteArrayEquals } from "../../../src/util/bytes.js" ;
14
14
15
15
type FullOrBlind = "full" | "blinded" ;
@@ -28,7 +28,7 @@ const fullOrBlindedBlocks = Object.values(mockBlocks)
28
28
describe ( "isBlindedBytes" , ( ) => {
29
29
for ( const [ fullOrBlinded , { seq, name} , , block ] of fullOrBlindedBlocks ) {
30
30
it ( `should return ${ fullOrBlinded === "blinded" } for ${ fullOrBlinded } ${ name } blocks` , ( ) => {
31
- expect ( isBlindedBytes ( seq , block ) ) . to . equal ( isForkExecution ( name ) && fullOrBlinded === "blinded" ) ;
31
+ expect ( isBlindedBytes ( seq , block ) ) . toEqual ( isForkExecution ( name ) && fullOrBlinded === "blinded" ) ;
32
32
} ) ;
33
33
}
34
34
} ) ;
@@ -37,7 +37,7 @@ describe("serializeFullOrBlindedSignedBeaconBlock", () => {
37
37
for ( const [ fullOrBlinded , { name} , block , expected ] of fullOrBlindedBlocks ) {
38
38
it ( `should serialize ${ fullOrBlinded } ${ name } block` , ( ) => {
39
39
const serialized = serializeFullOrBlindedSignedBeaconBlock ( chainConfig , block ) ;
40
- expect ( byteArrayEquals ( serialized , expected ) ) . to . be . true ;
40
+ expect ( byteArrayEquals ( serialized , expected ) ) . toBeTruthy ( ) ;
41
41
} ) ;
42
42
}
43
43
} ) ;
@@ -50,7 +50,7 @@ describe("deserializeFullOrBlindedSignedBeaconBlock", () => {
50
50
isForkExecution ( name ) && fullOrBlinded === "blinded"
51
51
? chainConfig . getBlindedForkTypes ( block . message . slot ) . SignedBeaconBlock
52
52
: chainConfig . getForkTypes ( block . message . slot ) . SignedBeaconBlock ;
53
- expect ( type . equals ( deserialized as any , block as any ) ) . to . be . true ;
53
+ expect ( type . equals ( deserialized as any , block as any ) ) . toBeTruthy ( ) ;
54
54
} ) ;
55
55
}
56
56
} ) ;
@@ -69,15 +69,15 @@ describe("blindedOrFullBlockToBlinded", function () {
69
69
chainConfig . getBlindedForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , blinded ! )
70
70
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
71
chainConfig . getForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , isExecution ? blinded ! : full ) ;
72
- expect ( isEqual ) . to . be . true ;
72
+ expect ( isEqual ) . toBeTruthy ( ) ;
73
73
} ) ;
74
74
if ( ! blinded ) continue ;
75
75
it ( `should convert blinded ${ name } to blinded block` , ( ) => {
76
76
const result = blindedOrFullBlockToBlinded ( chainConfig , blinded ) ;
77
77
const isEqual = isForkExecution ( name )
78
78
? chainConfig . getBlindedForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , blinded )
79
79
: chainConfig . getForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , blinded ) ;
80
- expect ( isEqual ) . to . be . true ;
80
+ expect ( isEqual ) . toBeTruthy ( ) ;
81
81
} ) ;
82
82
}
83
83
} ) ;
@@ -94,12 +94,12 @@ describe("blindedOrFullBlockToFull", function () {
94
94
} ;
95
95
it ( `should convert full ${ name } to full block` , ( ) => {
96
96
const result = blindedOrFullBlockToFull ( chainConfig , seq , full , transactionsAndWithdrawals ) ;
97
- expect ( chainConfig . getForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , full ) ) . to . be . true ;
97
+ expect ( chainConfig . getForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , full ) ) . toBeTruthy ( ) ;
98
98
} ) ;
99
99
if ( ! blinded ) continue ;
100
100
it ( `should convert blinded ${ name } to full block` , ( ) => {
101
101
const result = blindedOrFullBlockToFull ( chainConfig , seq , blinded , transactionsAndWithdrawals ) ;
102
- expect ( chainConfig . getForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , full ) ) . to . be . true ;
102
+ expect ( chainConfig . getForkTypes ( full . message . slot ) . SignedBeaconBlock . equals ( result , full ) ) . toBeTruthy ( ) ;
103
103
} ) ;
104
104
}
105
105
} ) ;
0 commit comments