mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-07 17:23:05 +02:00
Fix unscoped flood-scope handling
This commit is contained in:
@@ -154,10 +154,10 @@ const publicChannel = {
|
||||
// contacts, unreads) that must all settle before conversation selection
|
||||
// renders. This suite passes in isolation, but under the full parallel suite
|
||||
// (~70 files) CPU contention can stretch that startup well past RTL's 1000ms
|
||||
// default — and even past vitest's 5000ms test timeout — for any waitFor in
|
||||
// this file. It's starvation, not a hang, so give this file generous headroom
|
||||
// on both timeouts: a healthy render still settles in ~100ms (nothing is
|
||||
// slowed), only a starved run waits longer.
|
||||
// default — and occasionally past 10s on GitHub's shared runners — for any
|
||||
// waitFor in this file. It's starvation, not a hang, so give this file generous
|
||||
// headroom on both timeouts: a healthy render still settles in ~100ms (nothing
|
||||
// is slowed), only a starved run waits longer.
|
||||
//
|
||||
// These MUST run at module scope, not in beforeAll: vitest bakes each test's
|
||||
// timeout in when it() registers the test (during collection, before any
|
||||
@@ -167,8 +167,8 @@ const publicChannel = {
|
||||
// 10s but the test killed at 5s) that flaked under load. vi.setConfig is scoped
|
||||
// to this file (each file runs in its own isolated worker), so other files are
|
||||
// unaffected.
|
||||
vi.setConfig({ testTimeout: 15000 });
|
||||
configure({ asyncUtilTimeout: 10000 });
|
||||
vi.setConfig({ testTimeout: 45000 });
|
||||
configure({ asyncUtilTimeout: 30000 });
|
||||
|
||||
describe('App startup hash resolution', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -360,8 +360,34 @@ describe('ChatHeader key visibility', () => {
|
||||
|
||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
||||
fireEvent.change(screen.getByLabelText('Region'), { target: { value: 'Esperance' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Use Esperance region for #flightless' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Scope #flightless to Esperance' }));
|
||||
|
||||
expect(onSetChannelFloodScopeOverride).toHaveBeenCalledWith(key, 'Esperance');
|
||||
});
|
||||
|
||||
it('forces the channel unscoped via the modal (issue #303)', async () => {
|
||||
const key = 'CD'.repeat(16);
|
||||
const channel = makeChannel(key, '#flightless', true);
|
||||
const conversation: Conversation = { type: 'channel', id: key, name: '#flightless' };
|
||||
const onSetChannelFloodScopeOverride = vi.fn();
|
||||
|
||||
render(
|
||||
<ChatHeader
|
||||
{...baseProps}
|
||||
conversation={conversation}
|
||||
channels={[channel]}
|
||||
onSetChannelFloodScopeOverride={onSetChannelFloodScopeOverride}
|
||||
/>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByTitle('Set regional override'));
|
||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
||||
fireEvent.click(
|
||||
screen.getByRole('button', {
|
||||
name: 'Always send #flightless unscoped (ignore global region)',
|
||||
})
|
||||
);
|
||||
|
||||
expect(onSetChannelFloodScopeOverride).toHaveBeenCalledWith(key, '*');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user