Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: retain publishing isolation with operator draft preparation

[._.]/ Adam Eivy0c8c8620291a
diff --git a/client/src/hooks/useMusicVideoPublishing.test.jsx b/client/src/hooks/useMusicVideoPublishing.test.jsx
index c820b9f735..09d18b8735 100644
--- a/client/src/hooks/useMusicVideoPublishing.test.jsx
+++ b/client/src/hooks/useMusicVideoPublishing.test.jsx
@@ -40,6 +40,7 @@ describe('music-video publishing project boundary', () => {
const view = render(<Posting id="project-a" />);
await screen.findByText('YouTube', { selector: 'div' });
fireEvent.change(within(row('Reddit')).getByLabelText('Subreddit'), { target: { value: 'example-community' } });
+ fireEvent.change(screen.getByLabelText('Instance password to prepare YouTube'), { target: { value: 'synthetic-password' } });
await act(async () => { fireEvent.click(within(row('YouTube')).getByRole('button', { name: 'Fill draft' })); });
expect(screen.getByText('Example A')).toBeInTheDocument();
@@ -59,16 +60,19 @@ describe('music-video publishing project boundary', () => {
api.submitMusicVideoPublishDraft.mockResolvedValue({ post: { url: 'https://example.com/post' } });
const view = render(<Posting id="project-a" />);
await screen.findByText('YouTube', { selector: 'div' });
+ fireEvent.change(screen.getByLabelText('Instance password to prepare YouTube'), { target: { value: 'synthetic-password' } });
fireEvent.click(within(row('YouTube')).getByRole('button', { name: 'Fill draft' }));
view.rerender(<Posting id="project-b" />);
+ fireEvent.change(screen.getByLabelText('Instance password to prepare YouTube'), { target: { value: 'synthetic-password' } });
fireEvent.click(within(row('YouTube')).getByRole('button', { name: 'Fill draft' }));
await act(async () => { first.resolve({ draftId: 'draft-a', summary: { title: 'Example A' } }); });
expect(screen.queryByText('Example A')).not.toBeInTheDocument();
expect(within(row('YouTube')).getByRole('button', { name: 'Filling…' })).toBeDisabled();
await act(async () => { second.resolve({ draftId: 'draft-b', summary: { title: 'Example B' } }); });
expect(screen.getByText('Example B')).toBeInTheDocument();
- await act(async () => { fireEvent.click(screen.getByRole('button', { name: 'Post to YouTube' })); });
- expect(api.submitMusicVideoPublishDraft).toHaveBeenCalledWith('project-b', 'draft-b', { silent: true });
+ expect(screen.queryByRole('button', { name: 'Post to YouTube' })).not.toBeInTheDocument();
+ expect(api.submitMusicVideoPublishDraft).not.toHaveBeenCalled();
+ expect(screen.getByLabelText('Instance password to prepare YouTube')).toHaveValue('');
});
it('ignores an old-project sign-in error after switching away and back', async () => {
@@ -76,11 +80,14 @@ describe('music-video publishing project boundary', () => {
api.prepareMusicVideoPublishDraft.mockReturnValueOnce(first.promise);
const view = render(<Posting id="project-a" />);
await screen.findByText('YouTube', { selector: 'div' });
+ fireEvent.change(screen.getByLabelText('Instance password to prepare YouTube'), { target: { value: 'synthetic-password' } });
fireEvent.click(within(row('YouTube')).getByRole('button', { name: 'Fill draft' }));
view.rerender(<Posting id="project-b" />);
view.rerender(<Posting id="project-a" />);
await act(async () => { first.reject({ message: 'Example sign-in required', code: 'PUBLISH_LOGIN_REQUIRED' }); });
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Instance password to prepare YouTube')).toHaveValue('');
+ fireEvent.change(screen.getByLabelText('Instance password to prepare YouTube'), { target: { value: 'synthetic-password' } });
expect(within(row('YouTube')).getByRole('button', { name: 'Fill draft' })).toBeEnabled();
});
});