// Delete branch locally git branch -d <local-branch-name> // Delete branch remotely git push origin --delete <remote-branch-name>
npm install --global --production windows-build-tools --vs2015
Tell Node to use the 2015 build tools.
npm config set msvs_version 2015 –global
Set your Node config to use Python 2.7.
npm config set python python2.7
npm install –no-optional
When getting data from a file
- Verify that if it has valid extensions/file type
- Verify that it does not exceeds certain file size
When getting data from a a user, the network, or some other external interface
- Check to be sure that the data falls within the allowable range.
- Make sure that numeric values are within tolerances
- Strings are short enough to handle.
- If a string is intended to represent a restricted range of values.
- Be sure that the string is valid for its intended purpose;
Otherwise reject it.
How to know in the browser?
Navigate to the console of the browser near you and type this simple function
Person shown below and hit enter. Next, type Person followed by dot (.) see the methods on Person function. Pretty simple.
We can call functions on function. Let’s invoke
call function and see the output.
Objects are keyed collection/associative array that has a hidden link to the prototype object. Try the following code in any browser console and understand it.
We can access the prototype object using Object.prototype.
We can get an original object back from the prototype object using constructor (Object.prototype.constructor) property.
Pictorial representation of Object and it’s prototype object.
Oh, wait! We were talking about Function.
Like Object, Function is linked to Function.prototype.
Let me show you using Person function, it’s prototype object and their linking in the browser console.
Pictorial representation of Person function and it’s prototype object.
A commonly applied structure for test cases has
- Setup: Arrange the state of the unit under test in order to run the test.
- Execution: Act on the unit under test so that it performs the expected behavior and receive output if needed.
- Validation: Assert/Verify the outcome of execution.
- Cleanup: Restore unit under test to a pre-test state.
- Design first: You understand requirement first via analysis, create use cases for it. Thus, the focus is on the requirement before writing the code.
- Good enough code for now: You write sufficient code against use cases that fulfills the user requirements. You don’t write extra lines of unnecessary code.
- Avoid rework: Due to design first approach, most of the doubts are cleared before writing code hence rework is avoided.
- Developer confidence: Continous delivery of requirement in small cycles gives developer a confidence.
- Regression catching.
- Safe Refactoring: Once the code is covered by multiple tests, a developer can safely improve code structure with confidence and can focus on simple and elegant design.
- A shared understanding of the business: Tests are the live documentation that is the communication channel between you and your future version or other developers that talks about business rules.
- Clean code reminder: IMO, TDD always reminds you to make your code better than you found it. Of course, after covering your code with test, make it better.