Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'fbt' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
it('should raise an error when call `.param()` with invalid argument', () => {
// $ExpectError: first argument must be a string
fbt.param(12, 18);
// $ExpectError: third argument must be an object
fbt.param('age', 18, 11);
// $ExpectError: `abcd` is missing
fbt.param('age', 18, { abcd: true });
// $ExpectError
fbt.param('age', 18, { number: 'need numeber' });
// $ExpectError: BITMASK_GENDER is missing in enum
fbt.param('age', 18, { gender: IntlVariations.BITMASK_GENDER });
});
});
it('should raise an error when call `.param()` with invalid argument', () => {
// $ExpectError: first argument must be a string
fbt.param(12, 18);
// $ExpectError: third argument must be an object
fbt.param('age', 18, 11);
// $ExpectError: `abcd` is missing
fbt.param('age', 18, { abcd: true });
// $ExpectError
fbt.param('age', 18, { number: 'need numeber' });
// $ExpectError: BITMASK_GENDER is missing in enum
fbt.param('age', 18, { gender: IntlVariations.BITMASK_GENDER });
});
});
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' });
});
});
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' });
});
});
it('should raise an error when mutate GENDER not opaque type', () => {
// $ExpectError: need opaque type from IntlVariations
IntlViewerContext.GENDER = 1;
});
it('should raise an error when mutate locale property not string', () => {
// $ExpectError: need string
IntlViewerContext.locale = 123;
});
it('should raise an error when call `.name()` with invalid argument', () => {
// $ExpectError: first argument must be a string
fbt.name(1, IntlVariations.GENDER_FEMALE);
// $ExpectError: `BITMASK_GENDER` is missing in enum
fbt.name('test', IntlVariations.BITMASK_GENDER);
});
});
it('should raise an error when call `.name()` with invalid argument', () => {
// $ExpectError: first argument must be a string
fbt.name(1, IntlVariations.GENDER_FEMALE);
// $ExpectError: `BITMASK_GENDER` is missing in enum
fbt.name('test', IntlVariations.BITMASK_GENDER);
});
});
it('should raise an error when call `.param()` with invalid argument', () => {
// $ExpectError: first argument must be a string
fbt.param(12, 18);
// $ExpectError: third argument must be an object
fbt.param('age', 18, 11);
// $ExpectError: `abcd` is missing
fbt.param('age', 18, { abcd: true });
// $ExpectError
fbt.param('age', 18, { number: 'need numeber' });
// $ExpectError: BITMASK_GENDER is missing in enum
fbt.param('age', 18, { gender: IntlVariations.BITMASK_GENDER });
});
});
it('should raise an error when call `.sameParam()` with invalid argument', () => {
// $ExpectError: first argument must be a string
fbt.sameParam(12);
});
});