Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('uploaded file have the default bucket name pointing to the fs collection', t => {
const {result} = t.context;
t.true(hasOwn(result.file, 'bucketName'));
t.is(result.file.bucketName, 'fs');
});
test('uploaded file have a filename property', t => {
const {result} = t.context;
t.true(hasOwn(result.file, 'filename'));
t.is(typeof result.file.filename, 'string');
t.regex(result.file.filename, /^[0-9a-f]{32}$/);
});
test('uploaded file have the date of the upload', t => {
const {result} = t.context;
t.true(hasOwn(result.file, 'uploadDate'));
t.true(result.file.uploadDate instanceof Date);
});
test('uploaded file have a size property with the length of the file', t => {
const {result, size} = t.context;
t.true(hasOwn(result.file, 'size'));
t.is(result.file.size, size);
});
test('uploaded file have a metadata property', t => {
const {result} = t.context;
t.true(hasOwn(result.file, 'metadata'));
t.is(result.file.metadata, null);
});
export function closeConnections({db, client}) {
if (client) {
if (hasOwn(client, 'readyState') && client.readyState === 1) {
return client.close();
}
if (hasOwn(client, 'isConnected') && client.isConnected()) {
return client.close();
}
} else {
return db.close();
}
}
export function closeConnections({db, client}) {
if (client) {
if (hasOwn(client, 'readyState') && client.readyState === 1) {
return client.close();
}
if (hasOwn(client, 'isConnected') && client.isConnected()) {
return client.close();
}
} else {
return db.close();
}
}
['fieldname', 'originalname', 'encoding', 'mimetype'].every(k =>
t.true(hasOwn(file, k))
);
['body', 'query', 'params', 'files'].every(k => t.true(hasOwn(req, k)));
['fieldname', 'originalname', 'encoding', 'mimetype'].every(k =>