Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test.serial('Delete a note', (t) => {
const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key
const input1 = {
type: 'SNIPPET_NOTE',
description: faker.lorem.lines(),
snippets: [{
name: faker.system.fileName(),
mode: 'text',
content: faker.lorem.lines()
}],
tags: faker.lorem.words().split(' '),
folder: folderKey
}
input1.title = input1.description.split('\n').shift()
return Promise.resolve()
.then(function doTest () {
return createNote(storageKey, input1)
.then(function (data) {
return deleteNote(storageKey, data.key)
})
})
.then(function assert (data) {
function dummyNote (override = {}) {
var data = Math.random() > 0.5
? {
type: 'MARKDOWN_NOTE',
content: faker.lorem.lines()
}
: {
type: 'SNIPPET_NOTE',
description: faker.lorem.lines(),
snippets: [{
name: faker.system.fileName(),
mode: 'text',
content: faker.lorem.lines()
}]
}
data.title = data.type === 'MARKDOWN_NOTE'
? data.content.split('\n').shift()
: data.description.split('\n').shift()
data.createdAt = faker.date.past()
data.updatedAt = faker.date.recent()
data.isStarred = false
data.tags = faker.lorem.words().split(' ')
if (override.key == null) data.key = keygen()
if (override.folder == null) data.folder = keygen()
Object.assign(data, override)
test.serial('Create a note', (t) => {
const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key
const input1 = {
type: 'SNIPPET_NOTE',
description: faker.lorem.lines(),
snippets: [{
name: faker.system.fileName(),
mode: 'text',
content: faker.lorem.lines()
}],
tags: faker.lorem.words().split(' '),
folder: folderKey
}
input1.title = input1.description.split('\n').shift()
const input2 = {
type: 'MARKDOWN_NOTE',
content: faker.lorem.lines(),
tags: faker.lorem.words().split(' '),
folder: folderKey
}
input2.title = input2.content.split('\n').shift()
describe("system", () => {
faker.system.fileName();
faker.system.fileName("ext");
faker.system.fileName("ext", "type");
faker.system.commonFileName();
faker.system.mimeType();
faker.system.commonFileType();
faker.system.commonFileType("ext");
faker.system.commonFileType("ext", "type");
faker.system.commonFileExt();
faker.system.commonFileExt("type");
faker.system.fileType();
faker.system.fileExt();
faker.system.fileExt("mimeType");
faker.system.directoryPath();
faker.system.filePath();
faker.system.semver();
});
import * as faker from 'faker'
import * as minimatch from 'minimatch'
import {
Item,
Container,
ContainerType,
ListItemsOptions,
} from '../src/types'
export class MockItem implements Item {
public key: string = faker.system.fileName('js', 'js')
public modtime: Date = faker.date.past()
public size: number = faker.random.number({ min: 64, max: 1024 })
public isSymbolicLink: boolean = false
constructor(item: Partial = {}) {
Object.assign(this, item)
}
public read(): Promise {
return Promise.resolve(new Buffer(this.size))
}
}
const randomContainerType = (): ContainerType =>
['FILE' as ContainerType, 'S3' as ContainerType][Math.floor(Math.random() * 2)]
describe("system", () => {
faker.system.fileName();
faker.system.fileName("ext");
faker.system.fileName("ext", "type");
faker.system.commonFileName();
faker.system.mimeType();
faker.system.commonFileType();
faker.system.commonFileType("ext");
faker.system.commonFileType("ext", "type");
faker.system.commonFileExt();
faker.system.commonFileExt("type");
faker.system.fileType();
faker.system.fileExt();
faker.system.fileExt("mimeType");
faker.system.directoryPath();
faker.system.filePath();
faker.system.semver();
});
__typename: null,
lat: faker.address.latitude(),
lng: faker.address.longitude(),
address: faker.address.city(),
placeId: faker.random.uuid()
};
break;
case 'dateTime':
result = faker.date.past().toISOString();
break;
case 'file':
result = {
__typename: null,
contentType: faker.system.mimeType(),
size: faker.random.number(),
name: faker.system.commonFileName(),
url: faker.internet.url()
};
break;
case 'image':
result = {
__typename: null,
contentType: 'image/jpeg',
size: faker.random.number(),
name: faker.system.commonFileName(),
url: randomImg()
};
break;
case 'boolean':
result = faker.random.boolean();
break;
case 'string': {
function getSystem(options){
return faker.system[options.type] &&
faker.system[options.type]();
}
function getSystem(options){
return faker.system[options.type] &&
faker.system[options.type]();
}
<i></i>
<i></i>
<div>
<span>
{ browserOs[index%4] }
</span> /
{ faker.system.semver() }
</div>
<span>
macOs { faker.system.semver() }
</span>
<div>
<samp>
{ faker.internet.ip() }
</samp>
</div>
<span>
-
</span>
<div></div>