mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-10-22 13:44:10 +00:00
Migrate from ESLint to Oxlint and Oxfmt
This commit is contained in:
@@ -66,7 +66,6 @@ describe('remoteServersReducer', () => {
|
||||
url: 'http://localhost:8000',
|
||||
apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a',
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,17 +21,20 @@ describe('selectedServerReducer', () => {
|
||||
|
||||
it('returns selected server when action is SELECT_SERVER', () => {
|
||||
const payload = fromPartial<RegularServer>({ id: 'abc123' });
|
||||
expect(reducer(null, selectServer.fulfilled(payload, '', { serverId: '', buildShlinkApiClient }))).toEqual(payload);
|
||||
expect(reducer(null, selectServer.fulfilled(payload, '', { serverId: '', buildShlinkApiClient }))).toEqual(
|
||||
payload,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('selectServer', () => {
|
||||
const version = '1.19.0';
|
||||
const createGetStateMock = (id: string) => vi.fn().mockReturnValue({
|
||||
servers: {
|
||||
[id]: { id },
|
||||
},
|
||||
});
|
||||
const createGetStateMock = (id: string) =>
|
||||
vi.fn().mockReturnValue({
|
||||
servers: {
|
||||
[id]: { id },
|
||||
},
|
||||
});
|
||||
|
||||
it.each([
|
||||
[version, version, `v${version}`],
|
||||
|
||||
@@ -39,14 +39,16 @@ describe('serversReducer', () => {
|
||||
ghi789: { id: 'ghi789' },
|
||||
}));
|
||||
|
||||
it.each([
|
||||
[true],
|
||||
[false],
|
||||
])('returns state as it is when trying to set auto-connect on invalid server', (autoConnect) =>
|
||||
expect(serversReducer(list, setAutoConnect(fromPartial<ServerWithId>({ id: 'invalid' }), autoConnect))).toEqual({
|
||||
abc123: { id: 'abc123' },
|
||||
def456: { id: 'def456' },
|
||||
}));
|
||||
it.each([[true], [false]])(
|
||||
'returns state as it is when trying to set auto-connect on invalid server',
|
||||
(autoConnect) =>
|
||||
expect(serversReducer(list, setAutoConnect(fromPartial<ServerWithId>({ id: 'invalid' }), autoConnect))).toEqual(
|
||||
{
|
||||
abc123: { id: 'abc123' },
|
||||
def456: { id: 'def456' },
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
it('disables auto-connect on a server which is already set to auto-connect', () => {
|
||||
const listWithDisabledAutoConnect = {
|
||||
@@ -54,10 +56,9 @@ describe('serversReducer', () => {
|
||||
abc123: { ...list.abc123, autoConnect: true },
|
||||
};
|
||||
|
||||
expect(serversReducer(
|
||||
listWithDisabledAutoConnect,
|
||||
setAutoConnect(fromPartial<ServerWithId>({ id: 'abc123' }), false),
|
||||
)).toEqual({
|
||||
expect(
|
||||
serversReducer(listWithDisabledAutoConnect, setAutoConnect(fromPartial<ServerWithId>({ id: 'abc123' }), false)),
|
||||
).toEqual({
|
||||
abc123: { id: 'abc123', autoConnect: false },
|
||||
def456: { id: 'def456' },
|
||||
});
|
||||
@@ -69,10 +70,9 @@ describe('serversReducer', () => {
|
||||
abc123: { ...list.abc123, autoConnect: true },
|
||||
};
|
||||
|
||||
expect(serversReducer(
|
||||
listWithEnabledAutoConnect,
|
||||
setAutoConnect(fromPartial<ServerWithId>({ id: 'def456' }), true),
|
||||
)).toEqual({
|
||||
expect(
|
||||
serversReducer(listWithEnabledAutoConnect, setAutoConnect(fromPartial<ServerWithId>({ id: 'def456' }), true)),
|
||||
).toEqual({
|
||||
abc123: { id: 'abc123', autoConnect: false },
|
||||
def456: { id: 'def456', autoConnect: true },
|
||||
});
|
||||
@@ -108,10 +108,7 @@ describe('serversReducer', () => {
|
||||
});
|
||||
|
||||
describe('setAutoConnect', () => {
|
||||
it.each([
|
||||
[true],
|
||||
[false],
|
||||
])('returns expected action', (autoConnect) => {
|
||||
it.each([[true], [false]])('returns expected action', (autoConnect) => {
|
||||
const serverToEdit = fromPartial<RegularServer>({ id: 'abc123' });
|
||||
const { payload } = setAutoConnect(serverToEdit, autoConnect);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user