From 988fa73696c23504c60f89de86e9057a8acfa3ff Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 29 Sep 2014 15:24:01 +0800 Subject: [PATCH] spec: asar: fs.readdirSync --- spec/asar-spec.coffee | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index 43d880ba93a..069c532505b 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -147,3 +147,19 @@ describe 'asar package', -> stats = fs.lstat p, (err, stats) -> assert.equal err.code, 'ENOENT' done() + + describe 'fs.readdirSync', -> + it 'reads dirs from root', -> + p = path.join fixtures, 'asar', 'a.asar' + dirs = fs.readdirSync p + assert.deepEqual dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2'] + + it 'reads dirs from a normal dir', -> + p = path.join fixtures, 'asar', 'a.asar', 'dir1' + dirs = fs.readdirSync p + assert.deepEqual dirs, ['file1', 'file2', 'file3', 'link1', 'link2'] + + it 'reads dirs from a linked dir', -> + p = path.join fixtures, 'asar', 'a.asar', 'link2', 'link2' + dirs = fs.readdirSync p + assert.deepEqual dirs, ['file1', 'file2', 'file3', 'link1', 'link2']