|
@@ -368,7 +368,16 @@ describe('topics Slice', () => {
|
|
describe('Thunks', () => {
|
|
describe('Thunks', () => {
|
|
const store = mockStoreCreator;
|
|
const store = mockStoreCreator;
|
|
const topicName = topic.name;
|
|
const topicName = topic.name;
|
|
|
|
+ const RealDate = Date.now;
|
|
|
|
|
|
|
|
+ beforeAll(() => {
|
|
|
|
+ global.Date.now = jest.fn(() =>
|
|
|
|
+ new Date('2019-04-07T10:20:30Z').getTime()
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ afterAll(() => {
|
|
|
|
+ global.Date.now = RealDate;
|
|
|
|
+ });
|
|
afterEach(() => {
|
|
afterEach(() => {
|
|
fetchMock.restore();
|
|
fetchMock.restore();
|
|
store.clearActions();
|
|
store.clearActions();
|
|
@@ -495,6 +504,18 @@ describe('topics Slice', () => {
|
|
|
|
|
|
expect(getTypeAndPayload(store)).toEqual([
|
|
expect(getTypeAndPayload(store)).toEqual([
|
|
{ type: deleteTopic.pending.type },
|
|
{ type: deleteTopic.pending.type },
|
|
|
|
+ { type: showSuccessAlert.pending.type },
|
|
|
|
+ {
|
|
|
|
+ type: alertAdded.type,
|
|
|
|
+ payload: {
|
|
|
|
+ id: 'message-topic-local',
|
|
|
|
+ title: '',
|
|
|
|
+ type: 'success',
|
|
|
|
+ createdAt: global.Date.now(),
|
|
|
|
+ message: 'Topic successfully deleted!',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ { type: showSuccessAlert.fulfilled.type },
|
|
{
|
|
{
|
|
type: deleteTopic.fulfilled.type,
|
|
type: deleteTopic.fulfilled.type,
|
|
payload: { topicName },
|
|
payload: { topicName },
|
|
@@ -662,17 +683,6 @@ 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`,
|