Skip to content

Commit

Permalink
test: remove empty options objects
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Aug 11, 2022
1 parent 1b48ee8 commit 78cd0b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
5 changes: 2 additions & 3 deletions test/integration/contract-aci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,8 @@ describe('Contract instance', () => {
}));

it('rejects not matching bytecode with enabled validation', async () => expect(aeSdk.getContractInstance({
bytecode: (await aeSdk.compilerApi.compileContract({
code: identityContractSourceCode, options: {},
})).bytecode,
bytecode: (await aeSdk.compilerApi.compileContract({ code: identityContractSourceCode }))
.bytecode,
aci: await aeSdk.compilerApi
.generateACI({ code: identityContractSourceCode, options: { fileSystem } }),
address: testContractAddress,
Expand Down
22 changes: 9 additions & 13 deletions test/integration/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ describe('Contract', () => {
});

it('compiles Sophia code', async () => {
bytecode = (await aeSdk.compilerApi.compileContract({
code: identityContract, options: {},
})).bytecode as Encoded.ContractBytearray;
bytecode = (await aeSdk.compilerApi.compileContract({ code: identityContract }))
.bytecode as Encoded.ContractBytearray;
expect(bytecode).to.satisfy((b: string) => b.startsWith('cb_'));
});

Expand Down Expand Up @@ -267,9 +266,8 @@ describe('Contract', () => {

describe('Sophia Compiler', () => {
it('compile', async () => {
bytecode = (await aeSdk.compilerApi.compileContract({
code: identityContract, options: {},
})).bytecode as Encoded.ContractBytearray;
bytecode = (await aeSdk.compilerApi.compileContract({ code: identityContract }))
.bytecode as Encoded.ContractBytearray;
expect(bytecode.split('_')[0]).to.be.equal('cb');
});

Expand All @@ -280,7 +278,6 @@ describe('Contract', () => {
+ ' entrypoint getArg(x : bar) = x\n'
+ ' entrypoint getArg(x : int) = baz\n'
+ ' entrypoint getArg1(x : int) = baz\n',
options: {},
})).to.be.rejectedWith(
'compile error:\n'
+ 'type_error:3:3: Duplicate definitions of `getArg` at\n'
Expand All @@ -292,27 +289,26 @@ describe('Contract', () => {
});

it('generate contract ACI', async () => {
const aci = await aeSdk.compilerApi.generateACI({ code: identityContract, options: {} });
const aci = await aeSdk.compilerApi.generateACI({ code: identityContract });
expect(aci).to.have.property('encodedAci');
expect(aci).to.have.property('externalEncodedAci');
expect(aci).to.have.property('interface');
});

it('throws clear exception if generating ACI with no arguments', async () => {
await expect(aeSdk.compilerApi.generateACI({ options: {} } as any))
await expect(aeSdk.compilerApi.generateACI({} as any))
.to.be.rejectedWith('Error "body.code cannot be null or undefined." occurred in serializing the payload - undefined');
});

it('validate bytecode', async () => {
expect(await aeSdk.compilerApi.validateByteCode({
bytecode, source: identityContract, options: {},
})).to.be.eql({ body: {} });
expect(await aeSdk.compilerApi.validateByteCode({ bytecode, source: identityContract }))
.to.be.eql({ body: {} });
});

it('Use invalid compiler url', async () => {
const url = aeSdk.compilerApi.$host;
aeSdk.setCompilerUrl('https://compiler.aepps.comas');
await expect(aeSdk.compilerApi.generateACI({ code: 'test', options: {} }))
await expect(aeSdk.compilerApi.generateACI({ code: 'test' }))
.to.be.rejectedWith('getaddrinfo ENOTFOUND compiler.aepps.comas');
aeSdk.setCompilerUrl(url);
});
Expand Down

0 comments on commit 78cd0b1

Please sign in to comment.