Skip to content

Commit f67175e

Browse files
committed
fix test
1 parent 390f6d5 commit f67175e

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

browser/main/lib/dataApi/createNoteFromUrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function createNoteFromUrl (url, storage, folder, dispatch = null, location = nu
7676
title: '',
7777
content: markdownHTML
7878
}).then((note) => {
79-
resolve({result: true, error: null})
79+
resolve({result: true, note, error: null})
8080
})
8181
}
8282
})

tests/dataApi/createNoteFromUrl-test.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const TestDummy = require('../fixtures/TestDummy')
1212
const sander = require('sander')
1313
const os = require('os')
1414
const CSON = require('@rokt33r/season')
15-
// const faker = require('faker')
1615

1716
const storagePath = path.join(os.tmpdir(), 'test/create-note-from-url')
1817

@@ -27,25 +26,14 @@ test.serial('Create a note from URL', (t) => {
2726

2827
const url = 'https://shapeshed.com/writing-cross-platform-node/'
2928

30-
return Promise.resolve()
31-
.then(function doTest () {
32-
return Promise.all([
33-
createNoteFromUrl(url, storageKey, folderKey)
34-
])
35-
})
36-
.then(function assert (data) {
37-
const data1 = data[0]
38-
39-
console.log('STORM LOOK HERE', data1)
40-
41-
t.is(storageKey, data1.storage)
42-
const jsonData2 = CSON.readFileSync(path.join(storagePath, 'notes', data1.key + '.cson'))
29+
return createNoteFromUrl(url, storageKey, folderKey)
30+
.then(function assert ({ note }) {
31+
t.is(storageKey, note.storage)
32+
const jsonData = CSON.readFileSync(path.join(storagePath, 'notes', note.key + '.cson'))
4333

44-
// <<<<<< fix me - input2 & data not defined
45-
/* t.is(input2.content, data2.content)
46-
t.is(input2.content, jsonData2.content)
47-
t.is(input2.tags.length, data2.tags.length)
48-
t.is(input2.tags.length, jsonData2.tags.length) */
34+
// Test if saved content is matching the created in memory note
35+
t.is(note.content, jsonData.content)
36+
t.is(note.tags.length, jsonData.tags.length)
4937
})
5038
})
5139

0 commit comments

Comments
 (0)