This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yield Nightmare() | |
.goto('http://yahoo.com') | |
.type('input[title="Search"]', 'github nightmare') | |
.click('.searchsubmit') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import test from 'ava' | |
test('arrays are equal', t => { | |
t.deepEqual([1, 2], [1, 2]) | |
}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react' | |
class ChildComponent extends Component { | |
componentDidMount() { | |
console.log('ChildComponent Component Did Mount') | |
} | |
componentWillUnmount() { | |
console.log('ChildComponent Un-mount :*(') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expect(fn(5)).to.be(10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flyDroneButton = document.getElementById('fly-drone-button') | |
flyDroneButton.click() | |
assert(isDroneFlyingCommandSent()) | |
//or even | |
drone.checkIfFlyingViaBluetooth() | |
.then(isFlying => assert(isFlying)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to page "https://localhost:3303" | |
Type "test-user" in the field "#username" | |
Type "test-pass" in the field "#password" | |
Click on "#login" | |
Expect Page Url to be https://localhost:3303/dashboard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Karma: | |
npm install karma --save-dev | |
# Install plugins that your project needs: | |
npm install karma-jasmine jasmine-core karma-chrome-launcher karma-firefox-launcher --save-dev | |
# Run on | |
npx karma start karma.conf.js --log-level debug --single-run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (hookState.num !== newHookState.num){ | |
setHookState(newHookState) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useNumState(defState){ | |
const [state, setState] = React.useState(defState) | |
function smartSetState(newState){ | |
if(state.num !== newState.num){ | |
setState(newState) | |
} | |
} | |
return [state, smartSetState] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reducer(state, action){ | |
switch(action.type){ | |
case 'broken-set-count': | |
return {count: action.payload.count} | |
case 'set-count': | |
if(action.payload.count === state.count){ | |
return state | |
} |