summaryrefslogtreecommitdiff
path: root/spec/frontend/helpers/fixtures.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/helpers/fixtures.js')
-rw-r--r--spec/frontend/helpers/fixtures.js38
1 files changed, 0 insertions, 38 deletions
diff --git a/spec/frontend/helpers/fixtures.js b/spec/frontend/helpers/fixtures.js
deleted file mode 100644
index a89ceab3f8e..00000000000
--- a/spec/frontend/helpers/fixtures.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-
-import { ErrorWithStack } from 'jest-util';
-
-export function getFixture(relativePath) {
- const basePath = relativePath.startsWith('static/')
- ? global.staticFixturesBasePath
- : global.fixturesBasePath;
- const absolutePath = path.join(basePath, relativePath);
- if (!fs.existsSync(absolutePath)) {
- throw new ErrorWithStack(
- `Fixture file ${relativePath} does not exist.
-
-Did you run bin/rake frontend:fixtures?`,
- getFixture,
- );
- }
-
- return fs.readFileSync(absolutePath, 'utf8');
-}
-
-export const getJSONFixture = relativePath => JSON.parse(getFixture(relativePath));
-
-export const resetHTMLFixture = () => {
- document.head.innerHTML = '';
- document.body.innerHTML = '';
-};
-
-export const setHTMLFixture = (htmlContent, resetHook = afterEach) => {
- document.body.innerHTML = htmlContent;
- resetHook(resetHTMLFixture);
-};
-
-export const loadHTMLFixture = (relativePath, resetHook = afterEach) => {
- const fileContent = getFixture(relativePath);
- setHTMLFixture(fileContent, resetHook);
-};