Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 pass when used properly', () => {
fbt.param('age', 18);
fbt.param('age', 18, {});
fbt.param('age', 18, { number: true });
fbt.param('age', 18, { number: 1 });
fbt.param('age', 18, { gender: IntlVariations.GENDER_UNKNOWN });
fbt.param('age', 18, { gender: IntlVariations.GENDER_FEMALE });
});
it('should munge together fbt.param calls', function() {
expect(fbt('Hello ' + fbt.param('name', 'bubba'), 'description')).toEqual(
'Hello bubba',
);
});
});
filterConfig.name,
filterConfig.defaultOperator,
null,
)
}
onFiltersChanged={filters => setFilters(filters)}
exportPath={'/work_orders'}
entity={'WORK_ORDER'}
footer={
count !== 0
? count > QUERY_LIMIT
? fbt(
'1 to ' +
fbt.param('size of page', QUERY_LIMIT) +
' of ' +
fbt.param('total number possible rows', count),
'header to indicate partial results',
)
: fbt(
'1 to ' + fbt.param('number of results in page', count),
'header to indicate number of results',
)
: null
}
/>
),
actionButtons: [
};
const onRowClicked = ({_event, _index, rowData}) => {
onLinkSelected(rowData);
};
const linksByOrder = showLinksByOrder(equipment, links);
if (linksByOrder.length === 0) {
return (
<div>
</div>
);
}
return (
{({height, width}) => (
].map(type => ({
key: type.key,
value: type.key,
label: fbt(
fbt.param('policy type', type.value) + ' Policy',
'create policy of given type',
),
}))}
skin="primary"
useEffect(() => {
if (isOnNewGroup || group != null) {
return;
}
if (fetchedGroup == null) {
if (groupId != null) {
handleError(
`${fbt(
`Group with id ${fbt.param(
'group id url param',
groupId,
)} does not exist.`,
'',
)}`,
);
}
redirectToGroupsView();
}
setGroup(fetchedGroup);
}, [
fetchedGroup,
const deleteHandler = useCallback(() => {
confirm(
fbt(
'Are you sure you want to delete link ' +
fbt.param(
'Hyperlink display text',
!!hyperlink.displayName ? `'${hyperlink.displayName}' ` : '',
) +
`to '` +
fbt.param('Hyperlink target URL', hyperlink.url) +
`'?`,
'Hyperlink delete confirmation message',
),
).then(confirmed => {
if (!confirmed) {
return;
}
const variables: DeleteHyperlinkMutationVariables = {
id: hyperlink.id,
};
const summary = responseData.summary;
setErrors(responseData.errors ?? []);
if (
responseData.errors == null ||
(responseData.errors != null && !verifyBefore) ||
(responseData.summary.committed && summary.successLines > 0)
) {
onSuccess(
fbt(
'Successfully uploaded ' +
fbt.param('number of saved lines', summary.successLines) +
' of ' +
fbt.param('number of all lines', summary.allLines) +
' ' +
fbt.param('type that was saved', currentEntity) +
' items. ',
'message for a successful import',
),
);
return;
}
if (responseData.errors.length != null && verifyBefore) {
onWarning(
fbt(
'The following ' +
fbt.param(
'number of lines',
responseData.errors.length == 1
? 'line'
: responseData.errors.length.toString() + ' lines',
) +