Skip to content

Commit

Permalink
refactor: move getObjFromFixture to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
RotemS committed Jan 21, 2021
1 parent 94afe8c commit 2b1f49f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 1 addition & 6 deletions test/system/detected-layers/detected-layers.spec.ts
Expand Up @@ -9,12 +9,7 @@ import {
} from "../../../lib/extractor/docker-archive/index";
import { ExtractAction } from "../../../lib/extractor/types";
import { AutoDetectedUserInstructions, ImageType } from "../../../lib/types";
import { getFixture } from "../../util";

const getObjFromFixture = (fixturePath) => {
const path = getFixture(fixturePath);
return JSON.parse(readFileSync(path, { encoding: "utf-8" }));
};
import { getFixture, getObjFromFixture } from "../../util";

const expectedNginxPackages = [
"gnupg1",
Expand Down
6 changes: 6 additions & 0 deletions test/util/index.ts
@@ -1,3 +1,4 @@
import { readFileSync } from "fs";
import { join } from "path";

export function getFixture(fixturePath: string | string[]): string {
Expand All @@ -10,3 +11,8 @@ export function getFixture(fixturePath: string | string[]): string {
}
return join(__dirname, "..", "fixtures", ...fixturePath);
}

export function getObjFromFixture(fixturePath) {
const path = getFixture(fixturePath);
return JSON.parse(readFileSync(path, { encoding: "utf-8" }));
}

0 comments on commit 2b1f49f

Please sign in to comment.