From fb2f5ca5fdb134ddd6928e56586424067f5ca3c8 Mon Sep 17 00:00:00 2001 From: Nick Young Date: Sun, 18 Mar 2018 00:03:27 -0400 Subject: [PATCH 1/4] Fix broken test. --- js/src/files.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/files.js b/js/src/files.js index ff68065b..7bd371de 100644 --- a/js/src/files.js +++ b/js/src/files.js @@ -441,9 +441,10 @@ module.exports = (common) => { return ipfs.files.cat(smallFile.cid + '/does-not-exist') .catch((err) => { expect(err).to.exist() - expect(err.message).to.oneOf([ + expect(err.message).to.contain.oneOf([ 'No such file', - 'no link named "does-not-exist" under Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP']) + 'no link named "does-not-exist" under Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' + ]) }) }) From 715a0e8f2bcaef60f001d80fcded00d047bb7626 Mon Sep 17 00:00:00 2001 From: Nick Young Date: Tue, 20 Mar 2018 23:54:53 -0400 Subject: [PATCH 2/4] Add nested cat error tests. --- js/src/files.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/js/src/files.js b/js/src/files.js index 7bd371de..6dee2385 100644 --- a/js/src/files.js +++ b/js/src/files.js @@ -441,10 +441,29 @@ module.exports = (common) => { return ipfs.files.cat(smallFile.cid + '/does-not-exist') .catch((err) => { expect(err).to.exist() - expect(err.message).to.contain.oneOf([ - 'No such file', + expect(err.message).to.contain( 'no link named "does-not-exist" under Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' - ]) + ) + }) + }) + + it('specifies missing directory in a nested link', () => { + return ipfs.files.cat(directory.cid + '/files/missing-dir/does-not-exist') + .catch((err) => { + expect(err).to.exist() + expect(err.message).to.contain( + 'no link named "missing-dir" under QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74' + ) + }) + }) + + it('specifies missing file in a nested link', () => { + return ipfs.files.cat(directory.cid + '/files/does-not-exist') + .catch((err) => { + expect(err).to.exist() + expect(err.message).to.contain( + 'no link named "does-not-exist" under QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74' + ) }) }) From 9423a7ab4e40dc517242b13787694cfdc5e690c1 Mon Sep 17 00:00:00 2001 From: Nick Young Date: Wed, 21 Mar 2018 16:50:29 -0400 Subject: [PATCH 3/4] More specific cat errors. --- js/src/files.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/js/src/files.js b/js/src/files.js index 6dee2385..9f6c1017 100644 --- a/js/src/files.js +++ b/js/src/files.js @@ -441,9 +441,6 @@ module.exports = (common) => { return ipfs.files.cat(smallFile.cid + '/does-not-exist') .catch((err) => { expect(err).to.exist() - expect(err.message).to.contain( - 'no link named "does-not-exist" under Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' - ) }) }) @@ -452,7 +449,7 @@ module.exports = (common) => { .catch((err) => { expect(err).to.exist() expect(err.message).to.contain( - 'no link named "missing-dir" under QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74' + 'no directory named "missing-dir" under QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files' ) }) }) @@ -462,7 +459,17 @@ module.exports = (common) => { .catch((err) => { expect(err).to.exist() expect(err.message).to.contain( - 'no link named "does-not-exist" under QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74' + 'no file named "does-not-exist" under QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files' + ) + }) + }) + + it('specifies a link is not a directory', () => { + return ipfs.files.cat(directory.cid + '/files/hello.txt/does-not-exist') + .catch((err) => { + expect(err).to.exist() + expect(err.message).to.contain( + '"hello.txt" is a file not a directory under QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files' ) }) }) From d59ea0388c256370fc87af399bd26a24312184a3 Mon Sep 17 00:00:00 2001 From: Nick Young Date: Sat, 24 Mar 2018 18:33:47 -0400 Subject: [PATCH 4/4] Add go-ipfs cat errors --- js/src/files.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/src/files.js b/js/src/files.js index 9f6c1017..ad177f78 100644 --- a/js/src/files.js +++ b/js/src/files.js @@ -448,9 +448,10 @@ module.exports = (common) => { return ipfs.files.cat(directory.cid + '/files/missing-dir/does-not-exist') .catch((err) => { expect(err).to.exist() - expect(err.message).to.contain( + expect(err.message).to.contain.oneOf([ + 'no link named "missing-dir" under QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74', 'no directory named "missing-dir" under QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files' - ) + ]) }) }) @@ -458,9 +459,10 @@ module.exports = (common) => { return ipfs.files.cat(directory.cid + '/files/does-not-exist') .catch((err) => { expect(err).to.exist() - expect(err.message).to.contain( + expect(err.message).to.contain.oneOf([ + 'no link named "does-not-exist" under QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74', 'no file named "does-not-exist" under QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files' - ) + ]) }) }) @@ -468,9 +470,10 @@ module.exports = (common) => { return ipfs.files.cat(directory.cid + '/files/hello.txt/does-not-exist') .catch((err) => { expect(err).to.exist() - expect(err.message).to.contain( + expect(err.message).to.contain.oneOf([ + 'no link named "does-not-exist" under QmY9cxiHqTFoWamkQVkpmmqzBrY3hCBEL2XNu3NtX74Fuu', '"hello.txt" is a file not a directory under QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files' - ) + ]) }) })