@@ -23,31 +23,34 @@ as an array isn't an object
2323// Given an empty object
2424// When passed to contains
2525// Then it should return false
26- test ( "contains on empty object returns false" , ( ) => {
27- expect ( contains ( { } ) ) . toEqual ( false ) ;
26+ test ( "contains on empty object returns false" , ( ) => {
27+ expect ( contains ( { } ) ) . toEqual ( false ) ;
2828} ) ;
2929
3030// Given an object with properties
3131// When passed to contains with an existing property name
3232// Then it should return true
33- test ( ' contains passed an object and a property name, returns true' , ( ) => {
34- expect ( contains ( { a : 1 , b : 2 } , "a" ) ) . toEqual ( true ) ;
33+ test ( " contains passed an object and a property name, returns true" , ( ) => {
34+ expect ( contains ( { a : 1 , b : 2 } , "a" ) ) . toEqual ( true ) ;
3535} ) ;
3636// Given an object with properties
3737// When passed to contains with a non-existent property name
3838// Then it should return false
39- test ( ' Contains passed with a non-existent property name, returns false' , ( ) => {
40- expect ( contains ( { a : 1 , b : 2 } , "c" ) ) . toEqual ( false ) ;
39+ test ( " Contains passed with a non-existent property name, returns false" , ( ) => {
40+ expect ( contains ( { a : 1 , b : 2 } , "c" ) ) . toEqual ( false ) ;
4141} ) ;
4242
43-
4443// Given a value that isn't an object - an array, a string, a number,
4544// null, or no argument at all
4645// When passed to contains
4746// Then it should throw Error("contains requires an object")
4847// (careful: typeof [] and typeof null are both "object")
49- test ( 'contains passed invalid input like an array, a string or a number will throw an error' , ( ) => {
50- expect ( contains ( [ 5 , "5" , 6 ] , "a" ) ) . toThrow ( new Error ( "contains require an object" ) ) ;
51- expect ( contains ( 'Ebra' , 'Ebra' ) ) . toThrow ( new Error ( "contains require an object" ) ) ;
52- expect ( contains ( 1 , 1 ) ) . toThrow ( new Error ( "contains require an object" ) ) ;
48+ test ( "contains passed invalid input like an array, a string or a number will throw an error" , ( ) => {
49+ expect ( ( ) => contains ( [ 5 , "5" , 6 ] , "a" ) ) . toThrow (
50+ new Error ( "contains require an object" )
51+ ) ;
52+ expect ( ( ) => contains ( "Ebra" , "Ebra" ) ) . toThrow (
53+ new Error ( "contains require an object" )
54+ ) ;
55+ expect ( ( ) => contains ( 1 , 1 ) ) . toThrow ( new Error ( "contains require an object" ) ) ;
5356} ) ;
0 commit comments