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 with invalid argument', () => {
// $ExpectError: first argument must be an object
Asset.fromMetadata(true);
// $ExpectError: missing required props
Asset.fromMetadata({});
});
});
it('should raise an error when call with invalid argument', () => {
// $ExpectError: first argument must be an object
Asset.fromMetadata(true);
// $ExpectError: missing required props
Asset.fromMetadata({});
});
});
it('should passes when used properly', () => {
const requiredMeta = {
hash: 'str',
name: 'str',
type: 'str',
scales: [1, 2],
httpServerLocation: 'str',
};
Asset.fromMetadata(requiredMeta).downloadAsync();
Asset.fromMetadata({
width: 1,
height: 1,
uri: 'str',
fileHashes: ['str'],
fileUris: ['str'],
...requiredMeta,
}).downloadAsync();
Asset.fromMetadata({
width: undefined,
height: undefined,
uri: undefined,
fileHashes: undefined,
fileUris: undefined,
...requiredMeta,
}).downloadAsync();
it('should passes when used properly', () => {
const requiredMeta = {
hash: 'str',
name: 'str',
type: 'str',
scales: [1, 2],
httpServerLocation: 'str',
};
Asset.fromMetadata(requiredMeta).downloadAsync();
Asset.fromMetadata({
width: 1,
height: 1,
uri: 'str',
fileHashes: ['str'],
fileUris: ['str'],
...requiredMeta,
}).downloadAsync();
Asset.fromMetadata({
width: undefined,
height: undefined,
uri: undefined,
fileHashes: undefined,
fileUris: undefined,