From adb8a00c1f4993aedc8d61e22b28e3f3234899aa Mon Sep 17 00:00:00 2001
From: Ethan Lane <ethan@vylpes.com>
Date: Mon, 22 Jul 2024 18:13:59 +0100
Subject: [PATCH 1/3] Add a newline character to the output of a file

---
 src/helpers/cliHelper.ts        | 2 +-
 tests/helpers/cliHelper.test.ts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/helpers/cliHelper.ts b/src/helpers/cliHelper.ts
index 2776f2e..f4f5c63 100644
--- a/src/helpers/cliHelper.ts
+++ b/src/helpers/cliHelper.ts
@@ -9,7 +9,7 @@ export default class CliHelper {
             const output = OutputHelper.GenerateOutput(response, options);
 
             if (options.o) {
-                writeFileSync(options.o, output);
+                writeFileSync(options.o, `${output}\n`);
             } else {
                 console.log(output);
             }
diff --git a/tests/helpers/cliHelper.test.ts b/tests/helpers/cliHelper.test.ts
index 3ea6687..0deb946 100644
--- a/tests/helpers/cliHelper.test.ts
+++ b/tests/helpers/cliHelper.test.ts
@@ -35,7 +35,7 @@ describe("Endpoint", () => {
             expect(OutputHelper.GenerateOutput).toHaveBeenCalledWith(response, options);
 
             expect(fs.writeFileSync).toHaveBeenCalledTimes(1);
-            expect(fs.writeFileSync).toHaveBeenCalledWith("file.txt", "test output");
+            expect(fs.writeFileSync).toHaveBeenCalledWith("file.txt", "test output\n");
 
             expect(console.log).not.toHaveBeenCalled();
 

From 7c9411b4e290b7686dbbf445d52f983b34a1a30a Mon Sep 17 00:00:00 2001
From: Ethan Lane <ethan@vylpes.com>
Date: Fri, 26 Jul 2024 18:17:21 +0100
Subject: [PATCH 2/3] Fix deprecated toBeCalledWith function call (#195)

- Remove the missed deprecated `toBeCalledWith` function call and replaced with `toHaveBeenCalledWith`
- There should now no longer be any deprecated functions

#138

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/195
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
---
 tests/index.test.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/index.test.ts b/tests/index.test.ts
index ffa9015..874f129 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -122,7 +122,7 @@ describe('randomBunny', () => {
         expect(result.Error!.Code).toBe(ErrorCode.NoImageResultsFound);
         expect(result.Error!.Message).toBe(ErrorMessages.NoImageResultsFound);
 
-        expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
+        expect(fetchMock).toHaveBeenCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
     });
 
     test('GIVEN randomSelect does NOT find a valid response, EXPECT failure result', async () => {

From 19e7bf6c7f7c01a1200c3a82456f3bf5e5cf1718 Mon Sep 17 00:00:00 2001
From: Ethan Lane <ethan@vylpes.com>
Date: Mon, 22 Jul 2024 18:13:59 +0100
Subject: [PATCH 3/3] Add a newline character to the output of a file

---
 src/helpers/cliHelper.ts        | 2 +-
 tests/helpers/cliHelper.test.ts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/helpers/cliHelper.ts b/src/helpers/cliHelper.ts
index 2776f2e..f4f5c63 100644
--- a/src/helpers/cliHelper.ts
+++ b/src/helpers/cliHelper.ts
@@ -9,7 +9,7 @@ export default class CliHelper {
             const output = OutputHelper.GenerateOutput(response, options);
 
             if (options.o) {
-                writeFileSync(options.o, output);
+                writeFileSync(options.o, `${output}\n`);
             } else {
                 console.log(output);
             }
diff --git a/tests/helpers/cliHelper.test.ts b/tests/helpers/cliHelper.test.ts
index 3ea6687..0deb946 100644
--- a/tests/helpers/cliHelper.test.ts
+++ b/tests/helpers/cliHelper.test.ts
@@ -35,7 +35,7 @@ describe("Endpoint", () => {
             expect(OutputHelper.GenerateOutput).toHaveBeenCalledWith(response, options);
 
             expect(fs.writeFileSync).toHaveBeenCalledTimes(1);
-            expect(fs.writeFileSync).toHaveBeenCalledWith("file.txt", "test output");
+            expect(fs.writeFileSync).toHaveBeenCalledWith("file.txt", "test output\n");
 
             expect(console.log).not.toHaveBeenCalled();