Skip to content

Commit aff1c64

Browse files
authored
Merge pull request #43 from codingtools/fix/issue-newline-4
Fixes issue#4
2 parents 433b187 + 7fcb8e1 commit aff1c64

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/utilities/utilities.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export default class Utilities {
1111
} else {
1212
fileStr = fs.readFileSync(filePath, 'utf8')
1313

14-
// TODO: fix this Issue #3
15-
if (fileStr.charAt(fileStr.length - 1) === '\n') {
16-
fileStr = fileStr.substring(0, fileStr.length - 1)
17-
}
1814
}
1915
return fileStr
2016
}

test/commands/hash.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ describe('hash', () => {
8888
.stdout()
8989
.command(['hash', '-f', 'test/resources/test.txt'])
9090
.it("File Hashing -> cdt hash -f 'test/resources/test.txt'", ctx => {
91-
expect(ctx.stdout).to.contain('97ee6255ffc855e79e2324d5495b6538e29034f9')
91+
expect(ctx.stdout).to.contain('d246b69fd991a1256f9e00f6914c8bd2d52b432e')
92+
})
93+
94+
//file input sha512
95+
test
96+
.stdout()
97+
.command(['hash', '-f', 'test/resources/test.txt', '-t', 'sha512'])
98+
.it("File Hashing -> cdt hash -t sha512 -f 'test/resources/test.txt'", ctx => {
99+
expect(ctx.stdout).to.contain('4493b97b4a0d21fc561070c48d4a62a9bfbeb78c5d9b3c59abf6d41f70da2e9bd45af63d8c62812cf41e50e352ec41b4f407f71d5778b575c503b70081e7a151')
92100
})
93101

94102
//file input - file not found

0 commit comments

Comments
 (0)