How to use the fbt.enum function in fbt

To help you get started, we’ve selected a few fbt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should raise an error when call `.sameParam()` with invalid argument', () => {
    // $ExpectError: first argument must be a number
    fbt.enum('1', ['test', 'test2']);

    // $ExpectError: first argument must be one key from object
    fbt.enum('MISSING_KEY', { CAR: 'car' });
  });
});
github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should raise an error when call `.sameParam()` with invalid argument', () => {
    // $ExpectError: first argument must be a number
    fbt.enum('1', ['test', 'test2']);

    // $ExpectError: first argument must be one key from object
    fbt.enum('MISSING_KEY', { CAR: 'car' });
  });
});
github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should pass when used properly', () => {
    fbt.enum(1, ['test', 'test2']);
    fbt.enum('BOAT', {
      CAR: 'car',
      HOUSE: 'house',
      BOAT: 'boat',
      HOUSEBOAT: 'houseboat',
    });
  });
github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should pass when used properly', () => {
    fbt.enum(1, ['test', 'test2']);
    fbt.enum('BOAT', {
      CAR: 'car',
      HOUSE: 'house',
      BOAT: 'boat',
      HOUSEBOAT: 'houseboat',
    });
  });