Skip to content

Commit

Permalink
fix(tests): ensure test project is clean between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed Aug 16, 2018
1 parent 448de75 commit b7f6664
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions garden-cli/test/src/util/ext-source-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import { makeTestContextA, cleanProject, expectError } from "../../helpers"
import { PluginContext } from "../../../src/plugin-context"

describe("ext-source-util", () => {

let ctx: PluginContext
const sources = [{ name: "name-a", path: "path-a" }, { name: "name-b", path: "path-b" }]
beforeEach(async () => {
ctx = await makeTestContextA()
})

afterEach(async () => {
cleanProject(ctx.projectRoot)
})

describe("getExtSourcesDirName", () => {
beforeEach(async () => {
ctx = await makeTestContextA()
})

afterEach(async () => {
await cleanProject(ctx.projectRoot)
})

it("should should return the project sources dir name", () => {
const dirName = getRemoteSourcesDirName("project")
expect(dirName).to.equal(".garden/sources/project")
Expand All @@ -34,6 +34,13 @@ describe("ext-source-util", () => {
})

describe("getLinkedSources", () => {
beforeEach(async () => {
ctx = await makeTestContextA()
})

afterEach(async () => {
await cleanProject(ctx.projectRoot)
})

it("should get linked project sources", async () => {
await ctx.localConfigStore.set(["linkedProjectSources"], sources)
Expand All @@ -48,6 +55,13 @@ describe("ext-source-util", () => {
})

describe("addLinkedSources", () => {
beforeEach(async () => {
ctx = await makeTestContextA()
})

afterEach(async () => {
await cleanProject(ctx.projectRoot)
})

it("should add linked project sources to local config", async () => {
await addLinkedSources({ ctx, sourceType: "project", sources })
Expand All @@ -73,6 +87,13 @@ describe("ext-source-util", () => {
})

describe("removeLinkedSources", () => {
beforeEach(async () => {
ctx = await makeTestContextA()
})

afterEach(async () => {
await cleanProject(ctx.projectRoot)
})

it("should remove linked project sources from local config", async () => {
await ctx.localConfigStore.set(["linkedModuleSources"], sources)
Expand Down

0 comments on commit b7f6664

Please sign in to comment.