[nodejs] Re: Passing parameters of multiple types in http post

2019-06-06 Thread Lukas Wilkeer
Hi madana. You can see a exemple of how to post data on this link . You will need to use the querystring module to parse the content. Regards. Em sexta-feira, 29 de março de 2019 01:28:45 UTC-3, madana gopal escreveu: > > Hi, > >

[nodejs] Sinon Stubs not called.

2019-10-06 Thread Lukas Wilkeer
I have a question about sinon stubs on Stack Overflow therer's not answered yet. I neet to ensure that sinon stub was called, but always returns false. How to assert this method? -- Job board: http://jobs.node

[nodejs] writeFileSync stub causing reference error.

2019-11-01 Thread Lukas Wilkeer
I'm attempt to stub the fs.writeFileSync method, but it's causing a Reference Error. In that case, oeverloading the fs method causes troubes as sinon.restore() doesn't work. *My stub.* const writeImageStub = sinon.stub(fs, 'writeFileSync') .callsFake((file, data, (err) => { expec

[nodejs] Re: Is file closing explicitly needed after fs.readFileSync()?

2019-11-01 Thread Lukas Wilkeer
Em quarta-feira, 23 de outubro de 2019 12:45:02 UTC-3, Peng Yu escreveu: > > I'd like to fs.writeFileSync() to the same file after reading its content > by fs.readFileSync(). It is not clear to me whether fs.closeSync() (or any > other file closing function) is needed between writeFileSync() an

[nodejs] Re: Node.js - Formidable for multipart/form-data upload is not working

2019-11-14 Thread Lukas Wilkeer
Adding the express-body-parser should work (if is not a problem with formidable) Said that, i think that the data that has been send through HTTP has not been parsed. const bodyParser = require('body-paraer') app.use('bodyParser', { urlencoded: true }) // for the xxx-url-form-urlencoded. Prin

[nodejs] Converting BSON to a Object String (Mongo/Mongoose)

2019-12-16 Thread Lukas Wilkeer
Hi folks, In mongo db, a ObjectId is composed by a random string hash and timestamp, converting do BSON type is an array like [Buffer, something, timestamp]. When saved to DB is converted do a hex string. Currently I'm stuck on a problem with BSON types.

[nodejs] jwt decode mock function

2020-05-12 Thread Lukas Wilkeer
Hi folks. I have a socket.io server that verify the extra headers for authorization tokens, in that case, I use the jwt to validate de token and validate the connection. Therefore, um a unit test case, I need to mock the decode function to test the connection. Where is a simple unit test case