mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Fixed selectedServer reucer test
This commit is contained in:
parent
27099aa7fb
commit
37ac6cebc1
1 changed files with 7 additions and 6 deletions
|
@ -39,11 +39,12 @@ describe('selectedServerReducer', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('selectServer', () => {
|
describe('selectServer', () => {
|
||||||
const selectedServer = {
|
|
||||||
id: 'abc123',
|
|
||||||
};
|
|
||||||
const version = '1.19.0';
|
const version = '1.19.0';
|
||||||
const createGetStateMock = (id: string) => jest.fn().mockReturnValue({ servers: { [id]: selectedServer } });
|
const createGetStateMock = (id: string) => jest.fn().mockReturnValue({
|
||||||
|
servers: {
|
||||||
|
[id]: { id },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[version, version, `v${version}`],
|
[version, version, `v${version}`],
|
||||||
|
@ -53,7 +54,7 @@ describe('selectedServerReducer', () => {
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
const getState = createGetStateMock(id);
|
const getState = createGetStateMock(id);
|
||||||
const expectedSelectedServer = {
|
const expectedSelectedServer = {
|
||||||
...selectedServer,
|
id,
|
||||||
version: expectedVersion,
|
version: expectedVersion,
|
||||||
printableVersion: expectedPrintableVersion,
|
printableVersion: expectedPrintableVersion,
|
||||||
};
|
};
|
||||||
|
@ -84,7 +85,7 @@ describe('selectedServerReducer', () => {
|
||||||
it('dispatches error when health endpoint fails', async () => {
|
it('dispatches error when health endpoint fails', async () => {
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
const getState = createGetStateMock(id);
|
const getState = createGetStateMock(id);
|
||||||
const expectedSelectedServer = Mock.of<NonReachableServer>({ ...selectedServer, serverNotReachable: true });
|
const expectedSelectedServer = Mock.of<NonReachableServer>({ id, serverNotReachable: true });
|
||||||
|
|
||||||
health.mockRejectedValue({});
|
health.mockRejectedValue({});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue