tests for note properties

This commit is contained in:
zadam
2020-05-23 20:52:55 +02:00
parent bb03a8714a
commit a2e1fb35b8
5 changed files with 151 additions and 4 deletions

View File

@@ -10,6 +10,20 @@ class Note {
this.noteId = row.noteId;
/** @param {string} */
this.title = row.title;
/** @param {string} */
this.type = row.type;
/** @param {string} */
this.mime = row.mime;
/** @param {number} */
this.contentLength = row.contentLength;
/** @param {string} */
this.dateCreated = row.dateCreated;
/** @param {string} */
this.dateModified = row.dateModified;
/** @param {string} */
this.utcDateCreated = row.utcDateCreated;
/** @param {string} */
this.utcDateModified = row.utcDateModified;
/** @param {boolean} */
this.isProtected = !!row.isProtected;
/** @param {boolean} */
@@ -224,6 +238,26 @@ class Note {
return arr.flat();
}
get parentCount() {
return this.parents.length;
}
get childrenCount() {
return this.children.length;
}
get labelCount() {
return this.attributes.filter(attr => attr.type === 'label').length;
}
get relationCount() {
return this.attributes.filter(attr => attr.type === 'relation').length;
}
get attributeCount() {
return this.attributes.length;
}
/** @return {Note[]} - returns only notes which are templated, does not include their subtrees
* in effect returns notes which are influenced by note's non-inheritable attributes */
get templatedNotes() {