1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Chore: Sync fuzzer: Add actions for publishing and unpublishing notes (#13062)

This commit is contained in:
Henry Heino
2025-09-08 04:02:53 -07:00
committed by GitHub
parent 1f0a98999f
commit 88f687ba6a
4 changed files with 82 additions and 1 deletions

View File

@@ -59,12 +59,17 @@ const doRandomAction = async (context: FuzzContext, client: Client, clientPool:
return parentId;
};
const defaultNoteProperties = {
published: false,
};
const selectOrCreateWriteableNote = async () => {
const options = { includeReadOnly: false };
let note = await client.randomNote(options);
if (!note) {
await client.createNote({
...defaultNoteProperties,
parentId: await selectOrCreateParentFolder(),
id: uuid.create(),
title: 'Test note',
@@ -104,6 +109,7 @@ const doRandomAction = async (context: FuzzContext, client: Client, clientPool:
newNote: async () => {
const parentId = await selectOrCreateParentFolder();
await client.createNote({
...defaultNoteProperties,
parentId: parentId,
title: `Test (x${context.randInt(0, 1000)})`,
body: 'Testing...',
@@ -247,6 +253,7 @@ const doRandomAction = async (context: FuzzContext, client: Client, clientPool:
for (let i = 0; i < welcomeNoteCount; i++) {
await client.createNote({
...defaultNoteProperties,
parentId: testNotesFolderId,
id: uuid.create(),
title: `Test note ${i}/${welcomeNoteCount}`,
@@ -287,6 +294,22 @@ const doRandomAction = async (context: FuzzContext, client: Client, clientPool:
}
return true;
},
publishNote: async () => {
const note = await client.randomNote({
includeReadOnly: true,
});
if (!note || note.published) return false;
await client.publishNote(note.id);
return true;
},
unpublishNote: async () => {
const note = await client.randomNote({ includeReadOnly: true });
if (!note || !note.published) return false;
await client.unpublishNote(note.id);
return true;
},
};
const actionKeys = [...Object.keys(actions)] as (keyof typeof actions)[];