diff --git a/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts b/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts index 602c33885..496b61eb8 100644 --- a/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts +++ b/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts @@ -7,9 +7,9 @@ * @format */ +import mockfs from 'mock-fs'; import fs from 'fs-extra'; import path from 'path'; -import mockfs from 'mock-fs'; import {consoleMock} from 'flipper-test-utils'; import {finishPendingPluginInstallations} from '../pluginInstaller'; import { @@ -17,25 +17,6 @@ import { pluginInstallationDir, } from '../pluginPaths'; -jest.mock('../pluginPaths', () => { - return { - pluginInstallationDir: path.join( - '', - 'Users', - 'mock', - '.flipper', - 'thirdparty', - ), - pluginPendingInstallationDir: path.join( - '', - 'Users', - 'mock', - '.flipper', - 'pending', - ), - }; -}); - describe('pluginInstaller', () => { const realConsole = global.console; global.console = consoleMock as any; @@ -44,9 +25,7 @@ describe('pluginInstaller', () => { global.console = realConsole; }); - beforeEach(() => { - mockfs({}); - }); + beforeEach(() => {}); afterEach(() => { mockfs.restore(); @@ -63,11 +42,13 @@ describe('pluginInstaller', () => { }, 'flipper-plugin-test2': { '0.3.0': { - 'index.js': '<0.3.0>', + 'index.js': '', + '0.3.0.js': '', 'package.json': '', }, '0.2.0': { - 'index.js': '<0.2.0>', + 'index.js': '', + '0.2.0.js': '', 'package.json': '', }, }, @@ -83,6 +64,7 @@ describe('pluginInstaller', () => { "flipper-plugin-test2", ] `); + expect( await fs.readdir( path.join(pluginInstallationDir, 'flipper-plugin-test1'), @@ -93,23 +75,19 @@ describe('pluginInstaller', () => { "package.json", ] `); + expect( await fs.readdir( path.join(pluginInstallationDir, 'flipper-plugin-test2'), ), ).toMatchInlineSnapshot(` Array [ + "0.3.0.js", "index.js", "package.json", ] `); - expect( - ( - await fs.readFile( - path.join(pluginInstallationDir, 'flipper-plugin-test2', 'index.js'), - ) - ).toString(), - ).toBe('<0.3.0>'); + expect( await fs.readdir(pluginPendingInstallationDir), ).toMatchInlineSnapshot(`Array []`);