1
0
mirror of synced 2025-12-19 18:11:23 -05:00
Files
blitz/packages/cli/test/commands/install.test.ts
Justin Hall b3814fc7c0 Standardize prettier options across all Blitz code bases (#703)
Co-authored-by: Brandon Bayer <b@bayer.ws> (meta)
2020-06-19 09:33:57 +07:00

35 lines
1.1 KiB
TypeScript

import {Install, RecipeLocation} from "../../src/commands/install"
import * as path from "path"
import tempInstaller from "../__fixtures__/installer"
jest.mock("../__fixtures__/installer")
jest.mock("@blitzjs/installer")
describe("`install` command", () => {
afterAll(() => {
jest.resetAllMocks()
})
it("runs local installer", async (done) => {
await Install.run([path.resolve(__dirname, "../__fixtures__/installer")])
expect(tempInstaller.run).toHaveBeenCalledWith({})
done()
})
it("properly parses remote installer args", () => {
const normalizePath = Install.prototype.normalizeRecipePath
expect(normalizePath("test-installer")).toEqual({
path: "https://github.com/blitz-js/blitz",
subdirectory: "recipes/test-installer",
location: RecipeLocation.Remote,
})
expect(normalizePath("user/test-installer")).toEqual({
path: "https://github.com/user/test-installer",
location: RecipeLocation.Remote,
})
expect(normalizePath("https://github.com/user/test-installer")).toEqual({
path: "https://github.com/user/test-installer",
location: RecipeLocation.Remote,
})
})
})