Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const setupTest = () => {
const command = new BaseCommand();
return test
.stub(command, 'parse', sandbox.stub().returns({ flags: defaultFlags }))
.stub(command, 'error', sandbox.stub())
.stub(print, 'default', sandbox.stub().returns(printMethodStub))
.stub(config, 'getConfig', sandbox.stub().returns(defaultConfig))
.add('command', () => command);
};
it('should compile solidity code', async () => {
const path = __dirname + '/../../templates/contracts/example.sol';
const result: CompileResult = await compileSol(path, ({
solcVersion: '0.5.8',
} as any) as Option);
expect(result.contracts).to.not.equal(undefined);
expect(result.sources).to.not.equal(undefined);
}).timeout(10000);
.it('describe a integration', (ctx): void => {
expect(ctx.stdout).to.equal(
JSON.stringify(integration, undefined, 2) + '\n',
);
});
});
.it('should deploy a integration with update option', (ctx): void => {
expect(ctx.stdout).to.equal(
`${res.integrationId} has been deployed with force\n`,
);
});
},
.it('should be success to change https url', (ctx): void => {
expect(ctx.stdout).to.equal('Successfully set to https://asdf\n');
expect(configstore.get('endpoint')).to.equal('https://asdf');
});
it('should compile solidity code', async () => {
const path = __dirname + '/../../templates/contracts/example.sol';
const result: CompileResult = await compileSol(path, ({
solcVersion: '0.5.8',
} as any) as Option);
expect(result.contracts).to.not.equal(undefined);
expect(result.sources).to.not.equal(undefined);
}).timeout(10000);
it('should throw invalid response format error', async () => {
const invalidJson = { invalid: 'error' };
await mockServer.get('/integrations/v1').thenJSON(200, invalidJson);
try {
await integrationRpc.getIntegrations();
} catch (err) {
expect(err.toString()).to.equal(
'Error: Expected getIntegrationsList to return an array but it returned [object Object]',
);
}
});
});
.it('delete a integration', (ctx): void => {
expect(ctx.stdout).to.equal(`${id} has been deleted\n`);
});
});
it('should delete a integration', async () => {
const integration = newMockIntegration();
await mockServer
.delete('/integrations/v1/' + integration.integrationId)
.thenReply(200, undefined);
const response = await integrationRpc.deleteIntegration(
integration.integrationId,
);
expect(response).to.deep.equal(null);
});
});
.it('should be already login with message', (ctx): void => {
expect(ctx.stdout).to.equal(
'You are already logged in as yoonsung@haechi.io\n',
);
});