Last active
April 7, 2016 19:45
-
-
Save bahmutov/35838baa52329c411a442d59fbd0edd2 to your computer and use it in GitHub Desktop.
Grid of individual tests
This file contains 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 our data is more complicated and has to form things from items for example | |
// just pass around list of functions | |
const API = { | |
github: (username) => 'http://github.com/' + username, | |
photo: (username) => `http://github.com/${username}/avatar/` | |
} | |
const users = ['bahmutov', 'adity'] | |
Object.keys(API).forEach((apiName) => { | |
const formApiUrl = API[apiName] | |
describe('api ' + apiName, () => { | |
users.forEach((user) => { | |
const url = formApiUrl(user) | |
// assert url works | |
}) | |
}) | |
}) |
This file contains 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
// simple static data1 / data2 grid | |
function length(x) { return x.length } | |
function double(x) { return x + x } | |
const items = ['foo', 'bar', 'baz'] | |
const actions = [length, double] | |
actions.forEach((action) => { | |
describe(action.name, () => { | |
items.forEach((item) => { | |
it('is computes truthy for item ' + item, () => { | |
la(action(item), 'failed action', action.name, 'for item', item) | |
}) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
will output something like this