{"version":3,"sources":["../test/keysOf.jsx"],"names":["describe","it","to","TypeError","any","equal","assertPasses","validator","element","propName","assertFails","be","instanceOf","Error","number","foo","bar","not_validated","isRequired"],"mappings":";;AAAA;;AACA;;AACA;;AAEA;;AAEA;;;;;;AAEAA,QAAQ,CAAC,QAAD,EAAW,YAAM;AACvBC,EAAAA,EAAE,CAAC,wCAAD,EAA2C,YAAM;AACjD,sBAAO;AAAA,aAAM,eAAN;AAAA,KAAP,EAAuBC,EAAvB,UAAgCC,SAAhC;AACA,sBAAO;AAAA,aAAM,cAAO,IAAP,CAAN;AAAA,KAAP,EAA2BD,EAA3B,UAAoCC,SAApC;AACA,sBAAO;AAAA,aAAM,cAAO,EAAP,CAAN;AAAA,KAAP,EAAyBD,EAAzB,UAAkCC,SAAlC;AACA,sBAAO;AAAA,aAAM,cAAO,EAAP,CAAN;AAAA,KAAP,EAAyBD,EAAzB,UAAkCC,SAAlC;AACD,GALC,CAAF;AAOAF,EAAAA,EAAE,CAAC,oBAAD,EAAuB,YAAM;AAC7B,8BAAc,cAAOG,cAAP,CAAd,GAA2BF,EAA3B,CAA8BG,KAA9B,CAAoC,UAApC;AACD,GAFC,CAAF;;AAIA,WAASC,YAAT,CAAsBC,SAAtB,EAAiCC,OAAjC,EAA0CC,QAA1C,EAAoD;AAClD,sBAAO,+BAAcF,SAAd,EAAyBC,OAAzB,EAAkCC,QAAlC,EAA4C,eAA5C,CAAP,EAAqEP,EAArE,CAAwEG,KAAxE,CAA8E,IAA9E;AACD;;AAED,WAASK,WAAT,CAAqBH,SAArB,EAAgCC,OAAhC,EAAyCC,QAAzC,EAAmD;AACjD,sBAAO,+BAAcF,SAAd,EAAyBC,OAAzB,EAAkCC,QAAlC,EAA4C,eAA5C,CAAP,EAAqEP,EAArE,CAAwES,EAAxE,CAA2EC,UAA3E,CAAsFC,KAAtF;AACD;;AAEDZ,EAAAA,EAAE,CAAC,oCAAD,EAAuC,YAAM;AAC7CK,IAAAA,YAAY,CACV,cAAOQ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import { expect } from 'chai';\nimport { any, number, oneOf } from 'prop-types';\nimport React from 'react';\n\nimport { keysOf } from '..';\n\nimport callValidator from './_callValidator';\n\ndescribe('keysOf', () => {\n it('throws when not given a valid propType', () => {\n expect(() => keysOf()).to.throw(TypeError);\n expect(() => keysOf(null)).to.throw(TypeError);\n expect(() => keysOf({})).to.throw(TypeError);\n expect(() => keysOf([])).to.throw(TypeError);\n });\n\n it('returns a function', () => {\n expect(typeof keysOf(any)).to.equal('function');\n });\n\n function assertPasses(validator, element, propName) {\n expect(callValidator(validator, element, propName, '\"keysOf\" test')).to.equal(null);\n }\n\n function assertFails(validator, element, propName) {\n expect(callValidator(validator, element, propName, '\"keysOf\" test')).to.be.instanceOf(Error);\n }\n\n it('passes with an object with no keys', () => {\n assertPasses(\n keysOf(number),\n (
),\n 'a',\n );\n });\n\n it('passes when keys match the prop type', () => {\n assertPasses(\n keysOf(oneOf(['foo', 'bar'])),\n (),\n 'a',\n );\n });\n\n it('fails when keys do not match the prop type', () => {\n assertFails(\n keysOf(oneOf(['foo', 'bar'])),\n (),\n 'a',\n );\n });\n\n it('passes when the prop is not defined', () => {\n assertPasses(\n keysOf(number),\n (),\n 'a',\n );\n });\n\n it('is required with .isRequired', () => {\n assertFails(\n keysOf(number).isRequired,\n (),\n 'a',\n );\n });\n\n it('still passes with .isRequired if props are valid', () => {\n assertPasses(\n keysOf(oneOf(['foo', 'bar'])).isRequired,\n (),\n 'a',\n );\n });\n});\n"],"file":"keysOf.js"}