5663 i should be able to accept an invite even if i have an inactive workspace (#5839)

- make invitation and reset password available on every page
- add a sleep after setKeyPair as tokens are sometimes not updated when
redirecting to Index
- refactor sleep
This commit is contained in:
martmull
2024-06-13 11:47:00 +02:00
committed by GitHub
parent d93c2d6408
commit b26fd00a40
30 changed files with 95 additions and 75 deletions

View File

@ -6,24 +6,10 @@ import {
displayedExportProgress,
download,
generateCsv,
sleep,
} from '../useExportTableData';
jest.useFakeTimers();
describe('sleep', () => {
it('waits the provided number of milliseconds', async () => {
const spy = jest.fn();
sleep(1000).then(spy);
jest.advanceTimersByTime(999);
expect(spy).not.toHaveBeenCalled();
jest.advanceTimersByTime(1);
await Promise.resolve(); // let queued promises execute
expect(spy).toHaveBeenCalledTimes(1);
});
});
describe('download', () => {
it('creates a download link and clicks it', () => {
const link = document.createElement('a');

View File

@ -8,12 +8,10 @@ import { useRecordTableStates } from '@/object-record/record-table/hooks/interna
import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
import { isDefined } from '~/utils/isDefined';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
import { sleep } from '~/utils/sleep';
import { useFindManyParams } from '../../hooks/useLoadRecordIndexTable';
export const sleep = (ms: number) =>
new Promise((resolve) => setTimeout(resolve, ms));
export const download = (blob: Blob, filename: string) => {
const url = URL.createObjectURL(blob);
const link = document.createElement('a');

View File

@ -9,7 +9,7 @@ import { RelationPickerDecorator } from '~/testing/decorators/RelationPickerDeco
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { getPeopleMock } from '~/testing/mock-data/people';
import { sleep } from '~/testing/sleep';
import { sleep } from '~/utils/sleep';
import { EntityForSelect } from '../../types/EntityForSelect';
import { SingleEntitySelect } from '../SingleEntitySelect';