From d2047215577d611ae95aac9d96fcfe8012200305 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Sun, 9 Feb 2020 22:50:55 +0000 Subject: [PATCH] test: add meta for ipfs.get tests --- src/get.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/get.js b/src/get.js index 609359b6..539a8a6e 100644 --- a/src/get.js +++ b/src/get.js @@ -196,5 +196,27 @@ module.exports = (common, options) => { break } }) + + it('should get file with mode', async () => { + const mode = 0o777 + const content = String(Math.random() + Date.now()) + const [{ cid }] = await all(ipfs.add({ content, mode })) + + const res = await all(ipfs.get(cid)) + + expect(res).to.have.length(1) + expect(res[0]).to.have.property('mode').that.equals(mode) + }) + + it('should get file with mtime', async () => { + const mtime = { secs: Math.floor((Date.now() - (Math.random() * 1000)) / 1000) } + const content = String(Math.random() + Date.now()) + const [{ cid }] = await all(ipfs.add({ content, mtime })) + + const res = await all(ipfs.get(cid)) + + expect(res).to.have.length(1) + expect(res).to.have.nested.property('0.mtime.secs').that.deep.equals(mtime.secs) + }) }) }