TIL, 2018-08-06, Unit Tests in JS
7 Things to Start Being More Productive, Today
- Being productive: time management and managing your energy. Spending the least amount of energy to get the most benefits.
- Being overtired leads to having a negative perspective, which leads to a generalized low mood. This mindset is often accompanies by decreases in willingness to act proactively, control impulses, feel positive about yourself, empathize with others, and generally use emotional intelligence.
- Don’t say “yes” too often: Stop saying “yes” to tasks that yield little or no result. Try a split test: track everything you do, the time it takes to complete each task, and the results.
- “I can’t” vs “I don’t”.
- For activities you shouldn’t be engaging in, add an element of difficulty when starting that activity.
- Being a great content marketer: not about creating the best content, but building a great community that will generate high-quality content for you.
- Instead of wasting time and energy overloading yourself or trying to do it alone, let others share the burden and help.
- Distractable people get more done when there is someone else there, even if he isn’t coaching or assisting them.
- Stop guessing, and start backing up your decisions with data.
- Stop working, and take time to do nothing at all. It’s important to take time for reflection.
The Benefits and Pitfalls of Pair Programming in the Workplace
- Fewer mistakes, harder to procrastinate, shared best practices, faster on-boarding, can identify if the candidate can program with others, increase employee satisfaction.
-
1.5-2.5 hours, reward shared contribution, pair up and discuss on complex code.
- Testing a job perform, initialize the instance and reference it, so you can use
expect(job).to(receive)
- Push models, setup env
- Acceptance test: don’t introspect, prepare input, assert output, everything in the middle doesn’t matter
- What happens when user has no permission, server error codes, when everything goes well, and ensuring that validations work
- Fill in name etc
Integration test:
- Don’t rely on ember data, don’t use Ajax unless component is bound to it. You can just pass a hash instead of a model
- Unit test for components
- Component: edge cases
- One component, one test for that file, and
Unit tests:
- Only testing JS.
-
Test models, services, and serializers
- We can have prop types at some point.
- Always mock, like always.
renderApplication
: library methods,hooks
. You can also put thepermissions
or whatever things you needemberShadow
:semantic-assertions
- Acceptance test: Must not have CSS in them. The test (semantic-test-helpers) also makes sure from the Label name
-
Ideally no
wait
as long as the code is written correctly. - fat arrow behavior in ES6
- async function, await keyword on visit, click
- push before rendering the app
assert.url
QUnit