chore: add comments about all the tests that need to be added

This commit is contained in:
thecodrr
2019-12-04 18:33:01 +05:00
parent fd7b50b5c8
commit 9ec5772cbe
3 changed files with 7 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ class Database {
*/ */
async addNote(note) { async addNote(note) {
if (!note || !note.content || (!note.title && !note.content)) if (!note || !note.content || (!note.title && !note.content))
return undefined; return undefined; //TODO add test
let timestamp = note.dateCreated || Date.now(); let timestamp = note.dateCreated || Date.now();
//add or update a note into the database //add or update a note into the database
@@ -108,6 +108,7 @@ class Database {
const id = notebook.dateCreated || Date.now(); const id = notebook.dateCreated || Date.now();
let topics = {}; let topics = {};
if (notebook.topics) { if (notebook.topics) {
//TODO add test
for (let topic of notebook.topics) { for (let topic of notebook.topics) {
topics[topic] = []; topics[topic] = [];
} }
@@ -224,6 +225,7 @@ class Database {
this.notes[notebookId] = notebook; this.notes[notebookId] = notebook;
return this.storage.write(KEYS.notebooks, this.notebooks); return this.storage.write(KEYS.notebooks, this.notebooks);
} }
//TODO add test
return Promise.resolve(); return Promise.resolve();
} }
@@ -235,7 +237,7 @@ class Database {
async delete(items, key) { async delete(items, key) {
if (!items || items.length <= 0 || !this[key] || this[key].length <= 0) if (!items || items.length <= 0 || !this[key] || this[key].length <= 0)
return; return; //TODO add test
for (let item of items) { for (let item of items) {
if (this[key].hasOwnProperty(item.dateCreated)) { if (this[key].hasOwnProperty(item.dateCreated)) {
delete this[key][item.dateCreated]; delete this[key][item.dateCreated];

View File

@@ -12,10 +12,10 @@ class Storage {
return Convert.fromString(data); return Convert.fromString(data);
} }
clear() { clear() {
this.storage.clear(); this.storage.clear(); //TODO add test
} }
remove(key) { remove(key) {
this.storage.remove(key); this.storage.remove(key); //TODO add test
} }
} }

View File

@@ -1,3 +1,4 @@
//TODO add tests
export default class Convert { export default class Convert {
static toString(input) { static toString(input) {
try { try {