diff --git a/src/index.js b/src/index.js index dde47b3..8ee93ca 100644 --- a/src/index.js +++ b/src/index.js @@ -36,6 +36,10 @@ export class Flags extends Component { return ( {(flags) => { + if (!Array.isArray(flags)) { + throw new Error('You should not use outside a '); + } + const matchingFlags = this.matchingFlags(flags); if (exactFlags) { return matchingFlags.length === authorizedFlags.length diff --git a/src/test.js b/src/test.js index b4b4914..10bd9ff 100644 --- a/src/test.js +++ b/src/test.js @@ -176,6 +176,13 @@ describe('Flags', () => { expect(result).toEqual(

renderOn props

); }) }) + + describe('without context', () => { + it('without FlagsProvider or context', () => { + return expect(() => mount()) + .toThrow('You should not use outside a ') + }) + }) }) describe('FlagsProvider', () => {