1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00
This commit is contained in:
AWolf81
2019-06-30 00:03:54 +02:00
parent 390f6d545f
commit f67175e628
2 changed files with 8 additions and 20 deletions

View File

@@ -76,7 +76,7 @@ function createNoteFromUrl (url, storage, folder, dispatch = null, location = nu
title: '', title: '',
content: markdownHTML content: markdownHTML
}).then((note) => { }).then((note) => {
resolve({result: true, error: null}) resolve({result: true, note, error: null})
}) })
} }
}) })

View File

@@ -12,7 +12,6 @@ const TestDummy = require('../fixtures/TestDummy')
const sander = require('sander') const sander = require('sander')
const os = require('os') const os = require('os')
const CSON = require('@rokt33r/season') const CSON = require('@rokt33r/season')
// const faker = require('faker')
const storagePath = path.join(os.tmpdir(), 'test/create-note-from-url') const storagePath = path.join(os.tmpdir(), 'test/create-note-from-url')
@@ -27,25 +26,14 @@ test.serial('Create a note from URL', (t) => {
const url = 'https://shapeshed.com/writing-cross-platform-node/' const url = 'https://shapeshed.com/writing-cross-platform-node/'
return Promise.resolve() return createNoteFromUrl(url, storageKey, folderKey)
.then(function doTest () { .then(function assert ({ note }) {
return Promise.all([ t.is(storageKey, note.storage)
createNoteFromUrl(url, storageKey, folderKey) const jsonData = CSON.readFileSync(path.join(storagePath, 'notes', note.key + '.cson'))
])
})
.then(function assert (data) {
const data1 = data[0]
console.log('STORM LOOK HERE', data1) // Test if saved content is matching the created in memory note
t.is(note.content, jsonData.content)
t.is(storageKey, data1.storage) t.is(note.tags.length, jsonData.tags.length)
const jsonData2 = CSON.readFileSync(path.join(storagePath, 'notes', data1.key + '.cson'))
// <<<<<< fix me - input2 & data not defined
/* t.is(input2.content, data2.content)
t.is(input2.content, jsonData2.content)
t.is(input2.tags.length, data2.tags.length)
t.is(input2.tags.length, jsonData2.tags.length) */
}) })
}) })