Skip to content

Commit

Permalink
Fix errors relating to line-endings. (Issue #467)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchv committed Jan 3, 2018
1 parent 57f832d commit b3c7819
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/platforms/github/_tests/_github_git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ import { GitDSL } from "../../../dsl/GitDSL"

const fixtures = resolve(__dirname, "..", "..", "_tests", "fixtures")

/** Returns a fixture. */
const loadFixture = (path: string): string =>
readFileSync(pathJoin(fixtures, path), {})
.toString()
.replace(/\r/g, "")

/** Returns JSON from the fixtured dir */
export const requestWithFixturedJSON = async (path: string): Promise<() => Promise<any>> => () =>
Promise.resolve(JSON.parse(readFileSync(pathJoin(fixtures, path), {}).toString()))
Promise.resolve(JSON.parse(loadFixture(path)))

/** Returns arbitrary text value from a request */
export const requestWithFixturedContent = async (path: string): Promise<() => Promise<string>> => () =>
Promise.resolve(readFileSync(pathJoin(fixtures, path), {}).toString())
Promise.resolve(loadFixture(path))

/**
* HACKish: Jest on Windows seems to include some additional
Expand Down

0 comments on commit b3c7819

Please sign in to comment.