From 13c896ac326029a33038a2d4953fdb968be2f60b Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Thu, 28 Mar 2024 18:20:30 +0800 Subject: [PATCH] test(filesystem): add insertLink test Signed-off-by: Kevin Cui --- test/filesystem-spec.js | 16 ++++++++++++++++ .../private/var/app/real.txt | 0 .../private/var/app/symbol/real.txt | 1 + test/input/srcpath-include-symlink/var | 1 + 4 files changed, 18 insertions(+) create mode 100644 test/filesystem-spec.js create mode 100644 test/input/srcpath-include-symlink/private/var/app/real.txt create mode 120000 test/input/srcpath-include-symlink/private/var/app/symbol/real.txt create mode 120000 test/input/srcpath-include-symlink/var diff --git a/test/filesystem-spec.js b/test/filesystem-spec.js new file mode 100644 index 00000000..50c021f1 --- /dev/null +++ b/test/filesystem-spec.js @@ -0,0 +1,16 @@ +'use strict' + +const assert = require('assert') +const path = require('path') + +const Filesystem = require('../lib/filesystem') + +describe('filesystem', function () { + it('should does not throw error when src path include symbol link', async () => { + const src = 'test/input/srcpath-include-symlink/var/app' + const filesystem = new Filesystem(src) + assert.doesNotThrow(() => { + filesystem.insertLink(path.join(src, 'symbol', 'real.txt')) + }) + }) +}) diff --git a/test/input/srcpath-include-symlink/private/var/app/real.txt b/test/input/srcpath-include-symlink/private/var/app/real.txt new file mode 100644 index 00000000..e69de29b diff --git a/test/input/srcpath-include-symlink/private/var/app/symbol/real.txt b/test/input/srcpath-include-symlink/private/var/app/symbol/real.txt new file mode 120000 index 00000000..50996025 --- /dev/null +++ b/test/input/srcpath-include-symlink/private/var/app/symbol/real.txt @@ -0,0 +1 @@ +../real.txt \ No newline at end of file diff --git a/test/input/srcpath-include-symlink/var b/test/input/srcpath-include-symlink/var new file mode 120000 index 00000000..3ec7299f --- /dev/null +++ b/test/input/srcpath-include-symlink/var @@ -0,0 +1 @@ +private/var \ No newline at end of file