frontispiece / packages / ink-processor / src / test / test-data.ts
test-data.ts
Raw
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

import { VisualInkChoice } from "../types"
import { VisualInkLine } from "../types"
import { VisualInkSection } from "../types"

export const createTestLine = (existing: Partial<VisualInkLine> = {}): VisualInkLine => {
	return {
		type: 'line',
		text: 'Hello World',
		isHidden: false,
		...existing
	}
}

export const createTestChoice = (existing: Partial<VisualInkChoice> = {}): VisualInkChoice => {
	return {
		type: 'choice',
		text: "Choice",
		isHidden: false,
		index: 0,
		...existing
	}
}

export const createTestSection = (): VisualInkSection => {
	return {
		lines: [
			createTestLine(),
			createTestLine(),
			createTestLine(),
			createTestLine(),
		],
		choices: [
			createTestChoice({index: 0}),
			createTestChoice({index: 1})
		],
		allPaths: [],
		activeChoiceIndex: -1,
		activeLine: 0,
	}
}