From 28c89e22d24c9240c392330bcc2f8e5a0d8cc230 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 25 Sep 2024 14:10:11 -0700 Subject: [PATCH] spec: update tests --- .../local-electron/test/LocalElectronPlugin_spec.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/plugin/local-electron/test/LocalElectronPlugin_spec.ts b/packages/plugin/local-electron/test/LocalElectronPlugin_spec.ts index df547f7691..4e06fbe206 100644 --- a/packages/plugin/local-electron/test/LocalElectronPlugin_spec.ts +++ b/packages/plugin/local-electron/test/LocalElectronPlugin_spec.ts @@ -9,6 +9,8 @@ import { LocalElectronPlugin } from '../src/LocalElectronPlugin'; describe('LocalElectronPlugin', () => { describe('start logic', () => { + const fakeForgeConfig = {} as ResolvedForgeConfig; + before(() => { delete process.env.ELECTRON_OVERRIDE_DIST_PATH; }); @@ -20,30 +22,30 @@ describe('LocalElectronPlugin', () => { it('should set ELECTRON_OVERRIDE_DIST_PATH when enabled', async () => { expect(process.env.ELECTRON_OVERRIDE_DIST_PATH).to.equal(undefined); const p = new LocalElectronPlugin({ electronPath: 'test/foo' }); - await p.startLogic(); + await p.getHooks().preStart?.(fakeForgeConfig); expect(process.env.ELECTRON_OVERRIDE_DIST_PATH).to.equal('test/foo'); }); it('should not set ELECTRON_OVERRIDE_DIST_PATH when disabled', async () => { expect(process.env.ELECTRON_OVERRIDE_DIST_PATH).to.equal(undefined); const p = new LocalElectronPlugin({ enabled: false, electronPath: 'test/foo' }); - await p.startLogic(); + await p.getHooks().preStart?.(fakeForgeConfig); expect(process.env.ELECTRON_OVERRIDE_DIST_PATH).to.equal(undefined); }); it("should throw an error if platforms don't match", async () => { const p = new LocalElectronPlugin({ electronPath: 'test/bar', electronPlatform: 'wut' }); - await expect(p.startLogic()).to.eventually.be.rejectedWith( + await expect(p.getHooks().preStart?.(fakeForgeConfig)).to.eventually.be.rejectedWith( `Can not use local Electron version, required platform "${process.platform}" but local platform is "wut"` ); }); it('should always return false', async () => { let p = new LocalElectronPlugin({ electronPath: 'test/bar' }); - expect(await p.startLogic()).to.equal(false); + expect(await p.getHooks().preStart?.(fakeForgeConfig)).to.equal(false); p = new LocalElectronPlugin({ enabled: false, electronPath: 'test/bar' }); - expect(await p.startLogic()).to.equal(false); + expect(await p.getHooks().preStart?.(fakeForgeConfig)).to.equal(false); }); });