mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-11 10:03:51 +00:00
Remove dependency on uuid package
This commit is contained in:
@@ -68,12 +68,15 @@ describe('<ImportServersBtn />', () => {
|
||||
{ btnName: 'Save anyway',savesDuplicatedServers: true },
|
||||
{ btnName: 'Discard', savesDuplicatedServers: false },
|
||||
])('creates expected servers depending on selected option in modal', async ({ btnName, savesDuplicatedServers }) => {
|
||||
const existingServer: ServerWithId = {
|
||||
const existingServerData: ServerData = {
|
||||
name: 'existingServer',
|
||||
id: 'existingserver-s.test',
|
||||
url: 'http://s.test/existingUrl',
|
||||
apiKey: 'existingApiKey',
|
||||
};
|
||||
const existingServer: ServerWithId = {
|
||||
...existingServerData,
|
||||
id: 'existingserver-s.test',
|
||||
};
|
||||
const newServer: ServerData = { name: 'newServer', url: 'http://s.test/newUrl', apiKey: 'newApiKey' };
|
||||
const { user } = setUp({}, { [existingServer.id]: existingServer });
|
||||
|
||||
@@ -86,7 +89,7 @@ describe('<ImportServersBtn />', () => {
|
||||
|
||||
expect(createServersMock).toHaveBeenCalledWith(
|
||||
savesDuplicatedServers
|
||||
? [existingServer, expect.objectContaining(newServer)]
|
||||
? [expect.objectContaining(existingServerData), expect.objectContaining(newServer)]
|
||||
: [expect.objectContaining(newServer)],
|
||||
);
|
||||
expect(onImportMock).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
selectedServerReducerCreator,
|
||||
selectServer as selectServerCreator,
|
||||
} from '../../../src/servers/reducers/selectedServer';
|
||||
import { randomUUID } from '../../../src/utils/utils';
|
||||
|
||||
describe('selectedServerReducer', () => {
|
||||
const dispatch = vi.fn();
|
||||
@@ -41,7 +40,7 @@ describe('selectedServerReducer', () => {
|
||||
['latest', MAX_FALLBACK_VERSION, 'latest'],
|
||||
['%invalid_semver%', MIN_FALLBACK_VERSION, '%invalid_semver%'],
|
||||
])('dispatches proper actions', async (serverVersion, expectedVersion, expectedPrintableVersion) => {
|
||||
const id = randomUUID();
|
||||
const id = crypto.randomUUID();
|
||||
const getState = createGetStateMock(id);
|
||||
const expectedSelectedServer = {
|
||||
id,
|
||||
@@ -60,7 +59,7 @@ describe('selectedServerReducer', () => {
|
||||
});
|
||||
|
||||
it('dispatches error when health endpoint fails', async () => {
|
||||
const id = randomUUID();
|
||||
const id = crypto.randomUUID();
|
||||
const getState = createGetStateMock(id);
|
||||
const expectedSelectedServer = fromPartial<NonReachableServer>({ id, serverNotReachable: true });
|
||||
|
||||
@@ -73,7 +72,7 @@ describe('selectedServerReducer', () => {
|
||||
});
|
||||
|
||||
it('dispatches error when server is not found', async () => {
|
||||
const id = randomUUID();
|
||||
const id = crypto.randomUUID();
|
||||
const getState = vi.fn(() => fromPartial<ShlinkState>({ servers: {} }));
|
||||
const expectedSelectedServer: NotFoundServer = { serverNotFound: true };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user