JavaScript/TypeScriptA good way to write our own Node-RED node for the testability I have used Node-RED for more than 3 years for my working project. I came up with a good idea to write our own node for... 2022.05.23JavaScript/TypeScript
JavaScript/TypeScriptTop-Level function cannot be stubbed if it is exported by an asterisk A top-level function is not a part of an object. If we need to stub it, we need to have an object that has the target f... 2022.05.04JavaScript/TypeScript
JavaScript/TypeScriptWhat is the difference between Stub and Mock In a unit test, we need to replace a real behavior with a test object but the variable name is sometimes xxxxStub for m... 2022.04.29JavaScript/TypeScript
JavaScript/TypeScriptTypeScript Stub Date and timer friends functions with sinon When Date class, timer friends functions like setTimeout, and setInterval are used in a function, we need to control th... 2022.04.15JavaScript/TypeScript
JavaScript/TypeScriptHow to determine test values for unit testing Are you a beginner at unit testing? Are you not confident enough to choose the test cases? You are not alone. Let's lea... 2022.04.04JavaScript/TypeScript
JavaScript/TypeScriptTypeScript Stub Top Level function by Sinon Functions called in a different function are not always class members. They are often top-level functions which are not... 2022.04.01JavaScript/TypeScript
JavaScript/TypeScriptHow to mock fs.readdir and fs.readFile for unit testing Reading a directory to get a file list and then, loading the file one by one. You might have seen such a function. If i... 2022.03.30JavaScript/TypeScript
JavaScript/TypeScriptHow to inject user input data for unit tests Some console applications require user inputs. For those inputs, we need to write unit tests. If we using readline modu... 2022.03.28JavaScript/TypeScript
JavaScript/TypeScriptHow to start Unit Testing in TypeScript with mocha and chai Writing unit tests is an important step to be an intermediate developer from a beginner. The developers who can't write... 2022.03.23JavaScript/TypeScript
JavaScript/TypeScriptChai Object array comparison I needed to write tests for object array but I spent time on how to write it. I write down how to do it to save my time... 2022.02.23JavaScript/TypeScript