Skip to content

Commit

Permalink
Using Array.isArray, removing console.logs and renaming the protonewr…
Browse files Browse the repository at this point in the history
…oute to protomultiple
  • Loading branch information
merighifacundo committed Jul 4, 2021
1 parent 154c362 commit f520378
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Mali extends Emitter {
protoFilePath = path.file
if (!loadOptions.includeDirs) {
// Support either multiple or single paths.
loadOptions.includeDirs = path.root instanceof Array ? path.root : [path.root]
loadOptions.includeDirs = Array.isArray(path.root) ? path.root : [path.root]
}
}

Expand Down
8 changes: 2 additions & 6 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ test.cb('should handle multiple protos request', t => {

const app = new Mali()
t.truthy(app)
console.log(PROTO_ROOT_MULTIPLE)
console.log(PROTO_ROOT_FOLDER)
app.addService({ root: [PROTO_ROOT_MULTIPLE, PROTO_ROOT_FOLDER], file: 'helloworld.proto' }, 'helloworld.Greeter')
app.use('helloworld.Greeter', 'SayHello', sayHello)
app.start(APP_HOST).then(server => {
Expand All @@ -285,17 +283,15 @@ test.cb('should handle multiple protos with second folder definitions request',
t.plan(5)
const APP_HOST = tu.getHost()
const PROTO_ROOT_FOLDER = path.resolve(__dirname, './protos')
const PROTO_ROOT_MULTIPLE = path.resolve(__dirname, './protosnewroute')
const PROTO_PATH = path.resolve(__dirname, './protosnewroute/hellomultiple.proto')
const PROTO_ROOT_MULTIPLE = path.resolve(__dirname, './protosmultiple')
const PROTO_PATH = path.resolve(__dirname, './protosmultiple/hellomultiple.proto')

function sayMultiple (ctx) {
ctx.res = { message: 'Hello Multiple ' + ctx.req.name }
}

const app = new Mali()
t.truthy(app)
console.log(PROTO_ROOT_MULTIPLE)
console.log(PROTO_ROOT_FOLDER)
app.addService({ root: [PROTO_ROOT_MULTIPLE, PROTO_ROOT_FOLDER], file: 'hellomultiple.proto' }, 'multiple.hello.GreeterMultiple')
app.use('multiple.hello.GreeterMultiple', 'SayMultiple', sayMultiple)
app.start(APP_HOST).then(server => {
Expand Down
File renamed without changes.

0 comments on commit f520378

Please sign in to comment.