|
@@ -29,6 +29,10 @@ import { consumerGroupPayload } from 'redux/reducers/consumerGroups/__test__/fix
|
|
import fetchMock from 'fetch-mock-jest';
|
|
import fetchMock from 'fetch-mock-jest';
|
|
import mockStoreCreator from 'redux/store/configureStore/mockStoreCreator';
|
|
import mockStoreCreator from 'redux/store/configureStore/mockStoreCreator';
|
|
import { getTypeAndPayload } from 'lib/testHelpers';
|
|
import { getTypeAndPayload } from 'lib/testHelpers';
|
|
|
|
+import {
|
|
|
|
+ alertAdded,
|
|
|
|
+ showSuccessAlert,
|
|
|
|
+} from 'redux/reducers/alerts/alertsSlice';
|
|
|
|
|
|
const topic = {
|
|
const topic = {
|
|
name: 'topic',
|
|
name: 'topic',
|
|
@@ -658,6 +662,17 @@ describe('topics Slice', () => {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
describe('updateTopicPartitionsCount', () => {
|
|
describe('updateTopicPartitionsCount', () => {
|
|
|
|
+ const RealDate = Date.now;
|
|
|
|
+
|
|
|
|
+ beforeAll(() => {
|
|
|
|
+ global.Date.now = jest.fn(() =>
|
|
|
|
+ new Date('2019-04-07T10:20:30Z').getTime()
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ afterAll(() => {
|
|
|
|
+ global.Date.now = RealDate;
|
|
|
|
+ });
|
|
it('updateTopicPartitionsCount/fulfilled', async () => {
|
|
it('updateTopicPartitionsCount/fulfilled', async () => {
|
|
fetchMock.patchOnce(
|
|
fetchMock.patchOnce(
|
|
`/api/clusters/${clusterName}/topics/${topicName}/partitions`,
|
|
`/api/clusters/${clusterName}/topics/${topicName}/partitions`,
|
|
@@ -670,9 +685,21 @@ describe('topics Slice', () => {
|
|
partitions: 1,
|
|
partitions: 1,
|
|
})
|
|
})
|
|
);
|
|
);
|
|
-
|
|
|
|
expect(getTypeAndPayload(store)).toEqual([
|
|
expect(getTypeAndPayload(store)).toEqual([
|
|
{ type: updateTopicPartitionsCount.pending.type },
|
|
{ type: updateTopicPartitionsCount.pending.type },
|
|
|
|
+ { type: showSuccessAlert.pending.type },
|
|
|
|
+ {
|
|
|
|
+ type: alertAdded.type,
|
|
|
|
+ payload: {
|
|
|
|
+ id: 'message-topic-local-1',
|
|
|
|
+ title: '',
|
|
|
|
+ type: 'success',
|
|
|
|
+ createdAt: global.Date.now(),
|
|
|
|
+ message: 'Number of partitions successfully increased!',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ { type: fetchTopicDetails.pending.type },
|
|
|
|
+ { type: showSuccessAlert.fulfilled.type },
|
|
{
|
|
{
|
|
type: updateTopicPartitionsCount.fulfilled.type,
|
|
type: updateTopicPartitionsCount.fulfilled.type,
|
|
},
|
|
},
|