From ddf3d65a05d1440e2db1bbfc2bbe2f3e28dcaa25 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Thu, 22 Aug 2019 06:41:00 -0700 Subject: [PATCH] Avoid messagebox logs in our tests This was a fun one --- modern/src/integration.test.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modern/src/integration.test.js b/modern/src/integration.test.js index 472e87e2..6e88939a 100644 --- a/modern/src/integration.test.js +++ b/modern/src/integration.test.js @@ -65,11 +65,14 @@ async function runSkin(skinDirectory) { const zip = new JSZip(); buildZipFromDirectory(skinDirectoryPath, zip, skinDirectoryPath); - const actual = System.prototype.messagebox; + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ + function fakeMessageBox(a, b, c, d) { + // This function has four fake arguments because we check the arity of the + // method in the VM to determine how many values to pop off the stack. + } + expect(fakeMessageBox.length).toBe(System.prototype.messagebox.length); - // I have no idea why calling out to the actual method (which just calls - // console.log) is requried. - const mockMessageBox = jest.fn(actual); + const mockMessageBox = jest.fn(fakeMessageBox); System.prototype.messagebox = mockMessageBox; const store = create();