Skip to content

Commit

Permalink
fix: e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk committed Oct 4, 2023
1 parent 7298fa0 commit 1b554d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/api/mappers/sourceCodeMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const SOURCE_CODE_EMPTY_INFO: ContractSourceCodeDto = {

export const mapContractSourceCode = (data: ContractVerificationInfo): ContractSourceCodeDto => {
let sourceCode: string;
if (data.request.codeFormat.startsWith("vyper-multi-file")) {
if (data.request.codeFormat.startsWith("vyper-multi-file") && typeof data.request.sourceCode !== "string") {
const vyperFileNames = Object.keys(data.request.sourceCode);
if (vyperFileNames.length === 1) {
sourceCode = data.request.sourceCode[vyperFileNames[0]];
Expand Down
26 changes: 10 additions & 16 deletions packages/api/test/contract-api.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe("Contract API (e2e)", () => {
abi: [],
},
request: {
codeFormat: "solidity-single-file",
sourceCode: "sourceCode",
constructorArguments: "0x0001",
contractName: "contractName",
Expand Down Expand Up @@ -141,6 +142,7 @@ describe("Contract API (e2e)", () => {
abi: [],
},
request: {
codeFormat: "solidity-standard-json-input",
sourceCode: {
language: "Solidity",
settings: {
Expand Down Expand Up @@ -205,7 +207,10 @@ describe("Contract API (e2e)", () => {
abi: [],
},
request: {
sourceCode: "sourceCode",
codeFormat: "vyper-multi-file",
sourceCode: {
"Base.vy": "Base.vy content",
},
constructorArguments: "0x0001",
contractName: "contractName",
optimizationUsed: true,
Expand Down Expand Up @@ -234,7 +239,7 @@ describe("Contract API (e2e)", () => {
OptimizationUsed: "1",
Proxy: "0",
Runs: "",
SourceCode: "sourceCode",
SourceCode: "Base.vy content",
SwarmSource: "",
},
],
Expand All @@ -253,21 +258,10 @@ describe("Contract API (e2e)", () => {
abi: [],
},
request: {
codeFormat: "vyper-multi-file",
sourceCode: {
language: "Vyper",
settings: {
optimizer: {
enabled: true,
},
},
sources: {
"Base.vy": {
content: "Base.vy content",
},
"faucet.vy": {
content: "faucet.vy content",
},
},
"Base.vy": "Base.vy content",
"faucet.vy": "faucet.vy content",
},
constructorArguments: "0x0001",
contractName: "contractName",
Expand Down

0 comments on commit 1b554d0

Please sign in to comment.