Skip to content

Commit

Permalink
Eslint format js
Browse files Browse the repository at this point in the history
  • Loading branch information
rsonghuster committed Feb 12, 2018
1 parent 6d9a4ef commit f89e416
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions es5/client.js
Expand Up @@ -447,11 +447,11 @@ var Client = function () {
}

if (opts.memorySize) {
opts.memorySize = parseInt(opts.memorySize);
opts.memorySize = parseInt(opts.memorySize, 10);
}

if (opts.timeout) {
opts.timeout = parseInt(opts.timeout);
opts.timeout = parseInt(opts.timeout, 10);
}
}

Expand Down
18 changes: 9 additions & 9 deletions lib/client.js
Expand Up @@ -182,8 +182,8 @@ class Client {
}

return {
'headers': response.headers,
'data': responseBody,
'headers': response.headers,
'data': responseBody,
};
}

Expand Down Expand Up @@ -322,29 +322,29 @@ class Client {
* @return {Promise} 返回 Function 信息
*/
createFunction(serviceName, options, headers) {
this.normalizeParams(options)
this.normalizeParams(options);
return this.post(`/services/${serviceName}/functions`, options, headers);
}

normalizeParams(opts) {
if (opts.functionName){
opts.functionName = String(opts.functionName)
opts.functionName = String(opts.functionName);
}

if (opts.runtime){
opts.runtime = String(opts.runtime)
opts.runtime = String(opts.runtime);
}

if (opts.handler){
opts.handler = String(opts.handler)
opts.handler = String(opts.handler);
}

if (opts.memorySize){
opts.memorySize = parseInt(opts.memorySize)
opts.memorySize = parseInt(opts.memorySize, 10);
}

if (opts.timeout){
opts.timeout = parseInt(opts.timeout)
opts.timeout = parseInt(opts.timeout, 10);

}
}
Expand Down Expand Up @@ -397,7 +397,7 @@ class Client {
* @return {Promise} 返回 Object(包含headers和data属性[Function信息])
*/
updateFunction(serviceName, functionName, options, headers) {
this.normalizeParams(options)
this.normalizeParams(options);
const path = `/services/${serviceName}/functions/${functionName}`;
return this.put(path, options, headers);
}
Expand Down
26 changes: 13 additions & 13 deletions test/client.test.js
Expand Up @@ -307,16 +307,16 @@ describe('client test', function () {
it('createFunction with invalid runtime should fail', async function() {
try {
await client.createFunction(serviceName, {
functionName: "test_invalid_runtime_function",
description: 'function desc',
memorySize: 128,
handler: 'main.handler',
runtime: 10,
timeout: 10,
code: {
zipFile: fs.readFileSync(path.join(__dirname, 'figures/test.zip'), 'base64')
}
});
functionName: 'test_invalid_runtime_function',
description: 'function desc',
memorySize: 128,
handler: 'main.handler',
runtime: 10,
timeout: 10,
code: {
zipFile: fs.readFileSync(path.join(__dirname, 'figures/test.zip'), 'base64')
}
});
} catch (ex) {
expect(ex.stack).to.contain('FCInvalidArgumentError');
expect(ex.stack).to.contain('Runtime is set to an invalid value');
Expand All @@ -327,9 +327,9 @@ describe('client test', function () {
it('updateFunction with invalid runtime should fail', async function() {
try {
await client.updateFunction(serviceName, functionName, {
description: 'updated function desc',
runtime: 10
});
description: 'updated function desc',
runtime: 10
});
} catch (ex) {
expect(ex.stack).to.contain('FCInvalidArgumentError');
expect(ex.stack).to.contain('Runtime is set to an invalid value');
Expand Down

0 comments on commit f89e416

Please sign in to comment.