chore: fix ContentType usage (#2353)
* chore: fix ContentType usage * chore: fix specs
This commit is contained in:
@@ -361,11 +361,11 @@ describe('app models', () => {
|
||||
|
||||
it('maintains editor reference when duplicating note', async function () {
|
||||
const editor = await this.application.mutator.createItem(
|
||||
ContentType.Component,
|
||||
ContentType.TYPES.Component,
|
||||
{ area: ComponentArea.Editor, package_info: { identifier: 'foo-editor' } },
|
||||
true,
|
||||
)
|
||||
const note = await Factory.insertItemWithOverride(this.application, ContentType.Note, {
|
||||
const note = await Factory.insertItemWithOverride(this.application, ContentType.TYPES.Note, {
|
||||
editorIdentifier: 'foo-editor',
|
||||
})
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ describe('importing', function () {
|
||||
|
||||
await application.mutator.emitItemsFromPayloads([notePayload, tagPayload], PayloadEmitSource.LocalChanged)
|
||||
expectedItemCount += 2
|
||||
const note = application.itemManager.getItems([ContentType.Note])[0]
|
||||
const tag = application.itemManager.getItems([ContentType.Tag])[0]
|
||||
const note = application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
const tag = application.itemManager.getItems([ContentType.TYPES.Tag])[0]
|
||||
|
||||
expect(tag.content.references.length).to.equal(1)
|
||||
expect(tag.noteCount).to.equal(1)
|
||||
@@ -352,8 +352,8 @@ describe('importing', function () {
|
||||
|
||||
const storedPayloads = await application.diskStorageService.getAllRawPayloads()
|
||||
expect(application.itemManager.items.length).to.equal(storedPayloads.length)
|
||||
const notes = storedPayloads.filter((p) => p.content_type === ContentType.Note)
|
||||
const itemsKeys = storedPayloads.filter((p) => p.content_type === ContentType.ItemsKey)
|
||||
const notes = storedPayloads.filter((p) => p.content_type === ContentType.TYPES.Note)
|
||||
const itemsKeys = storedPayloads.filter((p) => p.content_type === ContentType.TYPES.ItemsKey)
|
||||
expect(notes.length).to.equal(1)
|
||||
expect(itemsKeys.length).to.equal(1)
|
||||
})
|
||||
@@ -449,7 +449,7 @@ describe('importing', function () {
|
||||
version: oldVersion,
|
||||
})
|
||||
|
||||
const noteItem = await application.mutator.createItem(ContentType.Note, {
|
||||
const noteItem = await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'Encrypted note',
|
||||
text: 'On protocol version 003.',
|
||||
})
|
||||
@@ -530,7 +530,7 @@ describe('importing', function () {
|
||||
password: password,
|
||||
})
|
||||
|
||||
const noteItem = await application.mutator.createItem(ContentType.Note, {
|
||||
const noteItem = await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'Encrypted note',
|
||||
text: 'On protocol version 004.',
|
||||
})
|
||||
@@ -560,7 +560,7 @@ describe('importing', function () {
|
||||
password: password,
|
||||
})
|
||||
|
||||
const noteItem = await application.mutator.createItem(ContentType.Note, {
|
||||
const noteItem = await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'This is a valid, encrypted note',
|
||||
text: 'On protocol version 004.',
|
||||
})
|
||||
@@ -598,7 +598,7 @@ describe('importing', function () {
|
||||
version: oldVersion,
|
||||
})
|
||||
|
||||
await application.mutator.createItem(ContentType.Note, {
|
||||
await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'Encrypted note',
|
||||
text: 'On protocol version 003.',
|
||||
})
|
||||
@@ -635,7 +635,7 @@ describe('importing', function () {
|
||||
password: password,
|
||||
})
|
||||
|
||||
await application.mutator.createItem(ContentType.Note, {
|
||||
await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'This is a valid, encrypted note',
|
||||
text: 'On protocol version 004.',
|
||||
})
|
||||
@@ -666,7 +666,7 @@ describe('importing', function () {
|
||||
password: password,
|
||||
})
|
||||
|
||||
await application.mutator.createItem(ContentType.Note, {
|
||||
await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'Encrypted note',
|
||||
text: 'On protocol version 004.',
|
||||
})
|
||||
@@ -691,13 +691,13 @@ describe('importing', function () {
|
||||
})
|
||||
Factory.handlePasswordChallenges(application, password)
|
||||
|
||||
await application.mutator.createItem(ContentType.Note, {
|
||||
await application.mutator.createItem(ContentType.TYPES.Note, {
|
||||
title: 'Encrypted note',
|
||||
text: 'On protocol version 004.',
|
||||
})
|
||||
|
||||
const backupData = await application.createEncryptedBackupFileForAutomatedDesktopBackups()
|
||||
backupData.items = backupData.items.filter((payload) => payload.content_type !== ContentType.ItemsKey)
|
||||
backupData.items = backupData.items.filter((payload) => payload.content_type !== ContentType.TYPES.ItemsKey)
|
||||
|
||||
await Factory.safeDeinit(application)
|
||||
application = await Factory.createInitAppWithFakeCrypto()
|
||||
|
||||
@@ -118,7 +118,7 @@ describe('model manager mapping', () => {
|
||||
await this.application.mutator.emitItemsFromPayloads([payload], PayloadEmitSource.LocalChanged)
|
||||
const item = this.application.itemManager.items[0]
|
||||
return new Promise((resolve) => {
|
||||
this.application.itemManager.addObserver(ContentType.Any, ({ changed }) => {
|
||||
this.application.itemManager.addObserver(ContentType.TYPES.Any, ({ changed }) => {
|
||||
expect(changed[0].uuid === item.uuid)
|
||||
resolve()
|
||||
})
|
||||
|
||||
@@ -26,14 +26,14 @@ describe('notes and tags', () => {
|
||||
it('uses proper class for note', async function () {
|
||||
const payload = Factory.createNotePayload()
|
||||
await this.application.mutator.emitItemFromPayload(payload, PayloadEmitSource.LocalChanged)
|
||||
const note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
const note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
expect(note.constructor === SNNote).to.equal(true)
|
||||
})
|
||||
|
||||
it('properly constructs syncing params', async function () {
|
||||
const title = 'Foo'
|
||||
const text = 'Bar'
|
||||
const note = await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
const note = await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title,
|
||||
text,
|
||||
})
|
||||
@@ -41,7 +41,7 @@ describe('notes and tags', () => {
|
||||
expect(note.content.title).to.equal(title)
|
||||
expect(note.content.text).to.equal(text)
|
||||
|
||||
const tag = await this.application.items.createTemplateItem(ContentType.Tag, {
|
||||
const tag = await this.application.items.createTemplateItem(ContentType.TYPES.Tag, {
|
||||
title,
|
||||
})
|
||||
|
||||
@@ -74,8 +74,8 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
await this.application.mutator.emitItemsFromPayloads([mutatedNote, mutatedTag], PayloadEmitSource.LocalChanged)
|
||||
const note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
const tag = this.application.itemManager.getItems([ContentType.Tag])[0]
|
||||
const note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
const tag = this.application.itemManager.getItems([ContentType.TYPES.Tag])[0]
|
||||
|
||||
expect(note.content.references.length).to.equal(1)
|
||||
expect(this.application.itemManager.itemsReferencingItem(tag).length).to.equal(1)
|
||||
@@ -131,8 +131,8 @@ describe('notes and tags', () => {
|
||||
const tagPayload = pair[1]
|
||||
|
||||
await this.application.mutator.emitItemsFromPayloads(pair, PayloadEmitSource.LocalChanged)
|
||||
let note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.Tag])[0]
|
||||
let note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.TYPES.Tag])[0]
|
||||
|
||||
expect(note.content.references.length).to.equal(0)
|
||||
expect(tag.content.references.length).to.equal(1)
|
||||
@@ -178,8 +178,8 @@ describe('notes and tags', () => {
|
||||
const tagPayload = pair[1]
|
||||
|
||||
await this.application.mutator.emitItemsFromPayloads([notePayload, tagPayload], PayloadEmitSource.LocalChanged)
|
||||
const note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.Tag])[0]
|
||||
const note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.TYPES.Tag])[0]
|
||||
|
||||
expect(note.content.references.length).to.equal(0)
|
||||
expect(tag.content.references.length).to.equal(1)
|
||||
@@ -233,7 +233,7 @@ describe('notes and tags', () => {
|
||||
const notePayload = pair[0]
|
||||
const tagPayload = pair[1]
|
||||
await this.application.mutator.emitItemsFromPayloads([notePayload, tagPayload], PayloadEmitSource.LocalChanged)
|
||||
const note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
const note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
const duplicateNote = await this.application.mutator.duplicateItem(note, true)
|
||||
expect(note.uuid).to.not.equal(duplicateNote.uuid)
|
||||
|
||||
@@ -247,8 +247,8 @@ describe('notes and tags', () => {
|
||||
const notePayload = pair[0]
|
||||
const tagPayload = pair[1]
|
||||
await this.application.mutator.emitItemsFromPayloads([notePayload, tagPayload], PayloadEmitSource.LocalChanged)
|
||||
const note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.Tag])[0]
|
||||
const note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.TYPES.Tag])[0]
|
||||
|
||||
expect(tag.content.references.length).to.equal(1)
|
||||
expect(tag.noteCount).to.equal(1)
|
||||
@@ -264,7 +264,7 @@ describe('notes and tags', () => {
|
||||
it('modifying item content should not modify payload content', async function () {
|
||||
const notePayload = Factory.createNotePayload()
|
||||
await this.application.mutator.emitItemsFromPayloads([notePayload], PayloadEmitSource.LocalChanged)
|
||||
let note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
let note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
note = await this.application.changeAndSaveItem(
|
||||
note,
|
||||
(mutator) => {
|
||||
@@ -286,8 +286,8 @@ describe('notes and tags', () => {
|
||||
const tagPayload = pair[1]
|
||||
|
||||
await this.application.mutator.emitItemsFromPayloads([notePayload, tagPayload], PayloadEmitSource.LocalChanged)
|
||||
let note = this.application.itemManager.getItems([ContentType.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.Tag])[0]
|
||||
let note = this.application.itemManager.getItems([ContentType.TYPES.Note])[0]
|
||||
let tag = this.application.itemManager.getItems([ContentType.TYPES.Tag])[0]
|
||||
|
||||
await this.application.syncService.sync(syncOptions)
|
||||
await this.application.mutator.setItemToBeDeleted(tag)
|
||||
@@ -302,7 +302,7 @@ describe('notes and tags', () => {
|
||||
await Promise.all(
|
||||
['Y', 'Z', 'A', 'B'].map(async (title) => {
|
||||
return this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, { title }),
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, { title }),
|
||||
)
|
||||
}),
|
||||
)
|
||||
@@ -316,7 +316,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
it('setting a note dirty should collapse its properties into content', async function () {
|
||||
let note = await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
let note = await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'Foo',
|
||||
})
|
||||
await this.application.mutator.insertItem(note)
|
||||
@@ -339,7 +339,7 @@ describe('notes and tags', () => {
|
||||
mutator.e2ePendingRefactor_addItemAsRelationship(taggedNote)
|
||||
})
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -379,7 +379,7 @@ describe('notes and tags', () => {
|
||||
await Promise.all(
|
||||
['Y', 'Z', 'A', 'B'].map(async (title) => {
|
||||
return this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title,
|
||||
}),
|
||||
)
|
||||
@@ -413,17 +413,17 @@ describe('notes and tags', () => {
|
||||
describe('Smart views', function () {
|
||||
it('"title", "startsWith", "Foo"', async function () {
|
||||
const note = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'Foo 🎲',
|
||||
}),
|
||||
)
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'Not Foo 🎲',
|
||||
}),
|
||||
)
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Foo Notes',
|
||||
predicate: {
|
||||
keypath: 'title',
|
||||
@@ -447,7 +447,7 @@ describe('notes and tags', () => {
|
||||
|
||||
it('"pinned", "=", true', async function () {
|
||||
const note = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -455,13 +455,13 @@ describe('notes and tags', () => {
|
||||
mutator.pinned = true
|
||||
})
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'B',
|
||||
pinned: false,
|
||||
}),
|
||||
)
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Pinned',
|
||||
predicate: {
|
||||
keypath: 'pinned',
|
||||
@@ -485,7 +485,7 @@ describe('notes and tags', () => {
|
||||
|
||||
it('"pinned", "=", false', async function () {
|
||||
const pinnedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -493,12 +493,12 @@ describe('notes and tags', () => {
|
||||
mutator.pinned = true
|
||||
})
|
||||
const unpinnedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'B',
|
||||
}),
|
||||
)
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Not pinned',
|
||||
predicate: {
|
||||
keypath: 'pinned',
|
||||
@@ -522,19 +522,19 @@ describe('notes and tags', () => {
|
||||
|
||||
it('"text.length", ">", 500', async function () {
|
||||
const longNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
text: Array(501).fill(0).join(''),
|
||||
}),
|
||||
)
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'B',
|
||||
text: 'b',
|
||||
}),
|
||||
)
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Long',
|
||||
predicate: {
|
||||
keypath: 'text.length',
|
||||
@@ -563,7 +563,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const recentNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
true,
|
||||
@@ -572,7 +572,7 @@ describe('notes and tags', () => {
|
||||
await this.application.sync.sync()
|
||||
|
||||
const olderNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'B',
|
||||
text: 'b',
|
||||
}),
|
||||
@@ -584,13 +584,13 @@ describe('notes and tags', () => {
|
||||
|
||||
/** Create an unsynced note which shouldn't get an updated_at */
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'B',
|
||||
text: 'b',
|
||||
}),
|
||||
)
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'One day ago',
|
||||
predicate: {
|
||||
keypath: 'serverUpdatedAt',
|
||||
@@ -614,7 +614,7 @@ describe('notes and tags', () => {
|
||||
|
||||
it('"tags.length", "=", 0', async function () {
|
||||
const untaggedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -625,7 +625,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Untagged',
|
||||
predicate: {
|
||||
keypath: 'tags.length',
|
||||
@@ -653,13 +653,13 @@ describe('notes and tags', () => {
|
||||
mutator.e2ePendingRefactor_addItemAsRelationship(taggedNote)
|
||||
})
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'B-tags',
|
||||
predicate: {
|
||||
keypath: 'tags',
|
||||
@@ -688,7 +688,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const pinnedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -697,7 +697,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const lockedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -706,7 +706,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Pinned & Locked',
|
||||
predicate: {
|
||||
operator: 'and',
|
||||
@@ -736,7 +736,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const pinnedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -745,7 +745,7 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
const pinnedAndProtectedNote = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
@@ -755,13 +755,13 @@ describe('notes and tags', () => {
|
||||
})
|
||||
|
||||
await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.Note, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.Note, {
|
||||
title: 'A',
|
||||
}),
|
||||
)
|
||||
|
||||
const view = await this.application.mutator.insertItem(
|
||||
await this.application.items.createTemplateItem(ContentType.SmartView, {
|
||||
await this.application.items.createTemplateItem(ContentType.TYPES.SmartView, {
|
||||
title: 'Protected or Pinned',
|
||||
predicate: {
|
||||
operator: 'or',
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('mapping performance', () => {
|
||||
for (let i = 0; i < tagCount; i++) {
|
||||
var tag = {
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.Tag,
|
||||
content_type: ContentType.TYPES.Tag,
|
||||
content: {
|
||||
title: `${Math.random()}`,
|
||||
references: [],
|
||||
@@ -31,7 +31,7 @@ describe('mapping performance', () => {
|
||||
for (let i = 0; i < noteCount; i++) {
|
||||
const note = {
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
content: {
|
||||
title: `${Math.random()}`,
|
||||
text: `${Math.random()}`,
|
||||
@@ -40,7 +40,7 @@ describe('mapping performance', () => {
|
||||
}
|
||||
const randomTag = Factory.randomArrayValue(tags)
|
||||
randomTag.content.references.push({
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
uuid: note.uuid,
|
||||
})
|
||||
notes.push(note)
|
||||
@@ -65,7 +65,7 @@ describe('mapping performance', () => {
|
||||
const expectedRunTime = 3 // seconds
|
||||
expect(seconds).to.be.at.most(expectedRunTime)
|
||||
|
||||
for (const note of application.itemManager.getItems(ContentType.Note)) {
|
||||
for (const note of application.itemManager.getItems(ContentType.TYPES.Note)) {
|
||||
expect(application.itemManager.itemsReferencingItem(note).length).to.be.above(0)
|
||||
}
|
||||
await Factory.safeDeinit(application)
|
||||
@@ -84,7 +84,7 @@ describe('mapping performance', () => {
|
||||
|
||||
const tag = {
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.Tag,
|
||||
content_type: ContentType.TYPES.Tag,
|
||||
content: {
|
||||
title: `${Math.random()}`,
|
||||
references: [],
|
||||
@@ -94,7 +94,7 @@ describe('mapping performance', () => {
|
||||
for (let i = 0; i < noteCount; i++) {
|
||||
const note = {
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
content: {
|
||||
title: `${Math.random()}`,
|
||||
text: `${Math.random()}`,
|
||||
@@ -103,7 +103,7 @@ describe('mapping performance', () => {
|
||||
}
|
||||
|
||||
tag.content.references.push({
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
uuid: note.uuid,
|
||||
})
|
||||
notes.push(note)
|
||||
@@ -131,8 +131,8 @@ describe('mapping performance', () => {
|
||||
const MAX_RUN_TIME = 15.0 // seconds
|
||||
expect(seconds).to.be.at.most(MAX_RUN_TIME)
|
||||
|
||||
application.itemManager.getItems(ContentType.Tag)[0]
|
||||
for (const note of application.itemManager.getItems(ContentType.Note)) {
|
||||
application.itemManager.getItems(ContentType.TYPES.Tag)[0]
|
||||
for (const note of application.itemManager.getItems(ContentType.TYPES.Note)) {
|
||||
expect(application.itemManager.itemsReferencingItem(note).length).to.equal(1)
|
||||
}
|
||||
await Factory.safeDeinit(application)
|
||||
|
||||
Reference in New Issue
Block a user