@@ -59,23 +59,30 @@ beforeAll(async () => {
59
59
60
60
describe ( "Encoding" , ( ) => {
61
61
describe ( "Constructors" , ( ) => {
62
- let encoder : Encoder . ContractEncoder ;
63
- let bytecode : string ;
64
-
65
- beforeAll ( async ( ) => {
66
- encoder = await Encoder . forArtifact ( artifacts . TestContract , {
62
+ it ( "Encodes constructors" , async ( ) => {
63
+ const artifact = artifacts . TestContract ;
64
+ const encoder = await Encoder . forArtifact ( artifact , {
67
65
projectInfo : { compilations }
68
66
} ) ;
69
- bytecode = Shims . NewToLegacy . forBytecode ( artifacts . TestContract . bytecode ) ;
70
- } ) ;
71
-
72
- it ( "Encodes constructors" , async ( ) => {
67
+ const bytecode = Shims . NewToLegacy . forBytecode ( artifact . bytecode ) ;
73
68
const { data } = await encoder . encodeCreation ( [ 1 ] ) ;
74
69
assert . strictEqual (
75
70
data ,
76
71
bytecode +
77
72
"0000000000000000000000000000000000000000000000000000000000000001"
78
73
) ;
79
74
} ) ;
75
+
76
+ it ( "Encodes implicit default constructors" , async ( ) => {
77
+ const artifact = artifacts . AuxContract ;
78
+ //check that it really is implicit, that it's not in the ABI
79
+ assert ( ! artifact . abi . some ( abi => abi . type === "constructor" ) ) ;
80
+ const encoder = await Encoder . forArtifact ( artifact , {
81
+ projectInfo : { compilations }
82
+ } ) ;
83
+ const bytecode = Shims . NewToLegacy . forBytecode ( artifact . bytecode ) ;
84
+ const { data } = await encoder . encodeCreation ( [ ] ) ;
85
+ assert . strictEqual ( data , bytecode ) ;
86
+ } ) ;
80
87
} ) ;
81
88
} ) ;
0 commit comments