Files
mostlymatter/webapp/channels/src/components/admin_console/database_settings.test.jsx
Agniva De Sarker 56bf1b695a MM-49984: Displaying active search backend in system console (#22721)
This will be shown in the system console to let users know
which search backend is active.

Implemented via adding an extra param in the ping response.

https://mattermost.atlassian.net/browse/MM-49984

```release-note
The database section in the system console now has an additional
read-only section which shows the active search backend in use.

This can be helpful to confirm which is the currently active
search engine when there are multiple of them configured.
```
---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-14 14:28:50 +05:30

57 строки
1.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme';
import DatabaseSettings from 'components/admin_console/database_settings.jsx';
jest.mock('actions/admin_actions.jsx', () => {
const pingFn = () => {
return jest.fn(() => {
return {ActiveSearchBackend: 'none'};
});
};
return {
recycleDatabaseConnection: jest.fn(),
ping: pingFn,
};
});
describe('components/DatabaseSettings', () => {
const baseProps = {
license: {
IsLicensed: 'true',
Cluster: 'true',
},
};
test('should match snapshot', () => {
const props = {
...baseProps,
value: [],
};
const config = {
SqlSettings: {
MaxIdleConns: 10,
MaxOpenConns: 100,
Trace: false,
DisableDatabaseSearch: true,
DataSource: 'postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable\u0026connect_timeout=10',
QueryTimeout: 10,
ConnMaxLifetimeMilliseconds: 10,
ConnMaxIdleTimeMilliseconds: 20,
},
ServiceSettings: {
MinimumHashtagLength: 10,
},
};
const wrapper = shallow(
<DatabaseSettings
{...props}
config={config}
/>,
);
expect(wrapper).toMatchSnapshot();
});
});