From 18c0dea3ae09436bd2afbd8924f54ce64cadbc0e Mon Sep 17 00:00:00 2001 From: ashish Date: Tue, 3 Dec 2019 01:49:52 +0530 Subject: [PATCH 1/2] [ISSUE]: removed new line handle code Signed-off-by: ashish --- src/utilities/utilities.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/utilities/utilities.ts b/src/utilities/utilities.ts index 70c5f07..536a35e 100644 --- a/src/utilities/utilities.ts +++ b/src/utilities/utilities.ts @@ -11,10 +11,6 @@ export default class Utilities { } else { fileStr = fs.readFileSync(filePath, 'utf8') - // TODO: fix this Issue #3 - if (fileStr.charAt(fileStr.length - 1) === '\n') { - fileStr = fileStr.substring(0, fileStr.length - 1) - } } return fileStr } From 7fcb8e1f53320c836889bc1fab80847fda92ac1a Mon Sep 17 00:00:00 2001 From: ashish Date: Tue, 3 Dec 2019 01:54:10 +0530 Subject: [PATCH 2/2] [ISSUE]: closes issue #4 Signed-off-by: ashish --- test/commands/hash.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/commands/hash.test.ts b/test/commands/hash.test.ts index 10ca580..9de7c41 100644 --- a/test/commands/hash.test.ts +++ b/test/commands/hash.test.ts @@ -88,7 +88,15 @@ describe('hash', () => { .stdout() .command(['hash', '-f', 'test/resources/test.txt']) .it("File Hashing -> cdt hash -f 'test/resources/test.txt'", ctx => { - expect(ctx.stdout).to.contain('97ee6255ffc855e79e2324d5495b6538e29034f9') + expect(ctx.stdout).to.contain('d246b69fd991a1256f9e00f6914c8bd2d52b432e') + }) + + //file input sha512 + test + .stdout() + .command(['hash', '-f', 'test/resources/test.txt', '-t', 'sha512']) + .it("File Hashing -> cdt hash -t sha512 -f 'test/resources/test.txt'", ctx => { + expect(ctx.stdout).to.contain('4493b97b4a0d21fc561070c48d4a62a9bfbeb78c5d9b3c59abf6d41f70da2e9bd45af63d8c62812cf41e50e352ec41b4f407f71d5778b575c503b70081e7a151') }) //file input - file not found