@prismicio/mock
Version:
Generate mock Prismic documents, fields, Slices, and models for development and testing environments
124 lines (123 loc) • 4.21 kB
JavaScript
"use strict";
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const createFaker = require("../lib/createFaker.cjs");
const boolean = require("./boolean.cjs");
const color = require("./color.cjs");
const contentRelationship = require("./contentRelationship.cjs");
const customType = require("./customType.cjs");
const date = require("./date.cjs");
const embed = require("./embed.cjs");
const geoPoint = require("./geoPoint.cjs");
const group = require("./group.cjs");
const image = require("./image.cjs");
const integration = require("./integration.cjs");
const keyText = require("./keyText.cjs");
const link = require("./link.cjs");
const linkToMedia = require("./linkToMedia.cjs");
const number = require("./number.cjs");
const index = require("./richText/index.cjs");
const select = require("./select.cjs");
const sharedSlice = require("./sharedSlice.cjs");
const sharedSliceVariation = require("./sharedSliceVariation.cjs");
const slice = require("./slice.cjs");
const sliceZone = require("./sliceZone.cjs");
const timestamp = require("./timestamp.cjs");
const title = require("./title.cjs");
const uid = require("./uid.cjs");
const table = require("./table.cjs");
const createValueMockFactory = (...args) => {
return new ValueMockFactory(...args);
};
class ValueMockFactory {
constructor(config) {
__publicField(this, "faker");
this.faker = "faker" in config ? config.faker : createFaker.createFaker(config.seed);
}
get seed() {
return this.faker.seed;
}
boolean(config) {
return boolean.boolean({ ...config, faker: this.faker });
}
color(config) {
return color.color({ ...config, faker: this.faker });
}
contentRelationship(config) {
return contentRelationship.contentRelationship({ ...config, faker: this.faker });
}
customType(config) {
return customType.customType({ ...config, faker: this.faker });
}
date(config) {
return date.date({ ...config, faker: this.faker });
}
document(config) {
return customType.customType({ ...config, faker: this.faker });
}
embed(config) {
return embed.embed({ ...config, faker: this.faker });
}
geoPoint(config) {
return geoPoint.geoPoint({ ...config, faker: this.faker });
}
group(config) {
return group.group({ ...config, faker: this.faker });
}
image(config) {
return image.image({ ...config, faker: this.faker });
}
integration(config) {
return integration.integration({ ...config, faker: this.faker });
}
keyText(config) {
return keyText.keyText({ ...config, faker: this.faker });
}
link(config) {
return link.link({ ...config, faker: this.faker });
}
linkToMedia(config) {
return linkToMedia.linkToMedia({ ...config, faker: this.faker });
}
number(config) {
return number.number({ ...config, faker: this.faker });
}
richText(config) {
return index.richText({ ...config, faker: this.faker });
}
select(config) {
return select.select({ ...config, faker: this.faker });
}
sharedSlice(config) {
return sharedSlice.sharedSlice({ ...config, faker: this.faker });
}
sharedSliceVariation(config) {
return sharedSliceVariation.sharedSliceVariation({ ...config, faker: this.faker });
}
slice(config) {
return slice.slice({ ...config, faker: this.faker });
}
sliceZone(config) {
return sliceZone.sliceZone({ ...config, faker: this.faker });
}
table(config) {
return table.table({ ...config, faker: this.faker });
}
timestamp(config) {
return timestamp.timestamp({ ...config, faker: this.faker });
}
title(config) {
return title.title({ ...config, faker: this.faker });
}
uid(config) {
return uid.uid({ ...config, faker: this.faker });
}
}
exports.ValueMockFactory = ValueMockFactory;
exports.createValueMockFactory = createValueMockFactory;
//# sourceMappingURL=createValueMockFactory.cjs.map