From 3658d0e03958ef6b8bcb5307646b172a8056c4dd Mon Sep 17 00:00:00 2001 From: Kazuki-Nakanishi Date: Wed, 8 Mar 2017 10:00:40 +0000 Subject: [PATCH] Add wait for writing a library entry into a file. (#1186) --- .../runtime/storage/localfilesystem_spec.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/red/runtime/storage/localfilesystem_spec.js b/test/red/runtime/storage/localfilesystem_spec.js index 4251fcb62..05e8fe10e 100644 --- a/test/red/runtime/storage/localfilesystem_spec.js +++ b/test/red/runtime/storage/localfilesystem_spec.js @@ -589,17 +589,19 @@ describe('LocalFileSystem', function() { flows.should.eql([ 'C', { ghi: 'jkl', fn: 'file2.js' }, {fn:'flow.json'} ]); var ft = path.join("B","D","file3.js"); localfilesystem.saveLibraryEntry('object',ft,{mno:'pqr'},"// another non meta line\n\n Hi There").then(function() { - localfilesystem.getLibraryEntry('object',path.join("B","D")).then(function(flows) { - flows.should.eql([ { mno: 'pqr', fn: 'file3.js' } ]); - localfilesystem.getLibraryEntry('object',ft).then(function(body) { - body.should.eql("// another non meta line\n\n Hi There"); - done(); + setTimeout(function() { + localfilesystem.getLibraryEntry('object',path.join("B","D")).then(function(flows) { + flows.should.eql([ { mno: 'pqr', fn: 'file3.js' } ]); + localfilesystem.getLibraryEntry('object',ft).then(function(body) { + body.should.eql("// another non meta line\n\n Hi There"); + done(); + }).otherwise(function(err) { + done(err); + }); }).otherwise(function(err) { done(err); - }); - }).otherwise(function(err) { - done(err); - }); + })} + , 50); }).otherwise(function(err) { done(err); });