Fixes: 1. media.ts: wrap placeholder generation in try-catch 2. toolbar.ts: check r.ok, display error message in popover
56 lines
965 B
TypeScript
56 lines
965 B
TypeScript
import type { CreateContentInput } from "../../src/database/repositories/types.js";
|
|
|
|
/**
|
|
* Fixture for creating a post
|
|
*/
|
|
export function createPostFixture(overrides: Partial<CreateContentInput> = {}): CreateContentInput {
|
|
return {
|
|
type: "post",
|
|
slug: "hello-world",
|
|
data: {
|
|
title: "Hello World",
|
|
content: [
|
|
{
|
|
_type: "block",
|
|
style: "normal",
|
|
children: [
|
|
{
|
|
_type: "span",
|
|
text: "This is a test post",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
status: "draft",
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Fixture for creating a page
|
|
*/
|
|
export function createPageFixture(overrides: Partial<CreateContentInput> = {}): CreateContentInput {
|
|
return {
|
|
type: "page",
|
|
slug: "about",
|
|
data: {
|
|
title: "About",
|
|
content: [
|
|
{
|
|
_type: "block",
|
|
style: "normal",
|
|
children: [
|
|
{
|
|
_type: "span",
|
|
text: "About page content",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
status: "draft",
|
|
...overrides,
|
|
};
|
|
}
|