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 required = () => {throw Error('Parameter missing')}; | |
const myFn = (myArgument = required()) => {}; | |
it('throws error when argument is not present', () => { | |
assert.throws(() => { | |
myFn(); | |
}); | |
}); |
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
message = %w( | |
Lorem ipsum dolor sit amet, consetetur | |
sadipscing elitr, sed diam nonumy eirmod | |
tempor invidunt ut labore et dolore magna | |
).join(' ') |
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 { | |
assertThat, | |
equalTo, | |
} from 'hamjest'; | |
import { getDaysInMonth } from './day'; | |
describe('getDaysInMonth()', () => { | |
it('April has 30 days', () => | |
assertThat(getDaysInMonth(4, 2016), equalTo(30))); |
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
#!/bin/bash | |
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$CHANGELOG_BRANCH" ]; then | |
echo "This commit was made against the $TRAVIS_BRANCH and not $CHANGELOG_BRANCH! Changelog not updated!" | |
exit 0 | |
fi | |
gem install rack -v 1.6.4 | |
gem install github_changelog_generator |
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
export const executeAndReturn = (fn) => { | |
return (argument) => { | |
fn(); | |
return argument; | |
} | |
}; |
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
/^[+-]?\d+\b$|^[+-]?\d+\b-[+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}:[+-]?\d{2}(\.\d+)?$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}[+-]\d{2}(:\d{2})?|Z$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}[+-]\d{2}(:\d{2})?|Z$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}:[+-]?\d{2}(\.\d+)?[+-]\d{2}(:\d{2})?|Z/ |
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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
const createActions = () => { | |
const signIn = () => new Promise((resolve) => { | |
setTimeout(resolve, 1000) | |
}); | |
return { signIn }; | |
}; |
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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { waitAtLeast } from 'promise-frites'; | |
//... | |
class SignInScreen extends React.Component { | |
state = { | |
isLoading: false | |
} | |
render() { |
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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { waitAtLeast } from 'promise-frites'; | |
//... | |
class SignInScreen extends React.Component { | |
state = { | |
isLoading: false, | |
loadingText: "Please wait", | |
} |
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 waitAtLeast1Second = waitAtLeast(1); | |
const apiCall = Promise.resolve('my api data'); | |
Promise.resolve() | |
.then(waitAtLeast1Second(apiCall)) | |
.then((data) => data === 'my api data'); |