diff options
Diffstat (limited to 'spec/frontend/content_editor/markdown_processing_examples.js')
-rw-r--r-- | spec/frontend/content_editor/markdown_processing_examples.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/frontend/content_editor/markdown_processing_examples.js b/spec/frontend/content_editor/markdown_processing_examples.js new file mode 100644 index 00000000000..12bf2cbb747 --- /dev/null +++ b/spec/frontend/content_editor/markdown_processing_examples.js @@ -0,0 +1,19 @@ +import fs from 'fs'; +import path from 'path'; +import jsYaml from 'js-yaml'; +import { toArray } from 'lodash'; +import { getJSONFixture } from 'helpers/fixtures'; + +export const loadMarkdownApiResult = (testName) => { + const fixturePathPrefix = `api/markdown/${testName}.json`; + + return getJSONFixture(fixturePathPrefix); +}; + +export const loadMarkdownApiExamples = () => { + const apiMarkdownYamlPath = path.join(__dirname, '..', 'fixtures', 'api_markdown.yml'); + const apiMarkdownYamlText = fs.readFileSync(apiMarkdownYamlPath); + const apiMarkdownExampleObjects = jsYaml.safeLoad(apiMarkdownYamlText); + + return apiMarkdownExampleObjects.map((example) => toArray(example)); +}; |