Skip to content

Instantly share code, notes, and snippets.

@kpgavino
Last active July 29, 2017 20:26
Show Gist options
  • Save kpgavino/a5790772047ce1db3ce41fe3f9d847ef to your computer and use it in GitHub Desktop.
Save kpgavino/a5790772047ce1db3ce41fe3f9d847ef to your computer and use it in GitHub Desktop.
describe('getAllKeys', function() {
it('should_output_an_array_of_key_names', function(){
var input = {
foo: 'bar',
level: 1,
red: 'green',
number: true
}
var expected = Object.keys(input);
var actual = getAllKeys(input);
expect(actual).not.toBeUndefined();
expect(actual[0]).toBe(expected[0]);
expect(actual[1]).toBe(expected[1]);
expect(actual[2]).toBe(expected[2]);
expect(actual[3]).toBe(expected[3]);
});
it ('should_not_use_restricted_methods', function() {
var body = getAllKeys.toString();
expect(/Object\.keys/.test(body)).toBe(false);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment