Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace old formatters #686

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
const config= {
const config = {
collectCoverage: true,
coverageDirectory: "coverage",
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [
"/node_modules/",
"src/test-utils",
'/node_modules/',
'src/test-utils',
'\\.config\\.ts$',
],
coverageProvider: "v8",
coverageProvider: 'v8',
coverageThreshold: {
global: {
branches: 85,
functions: 85,
lines: 85,
statements: 85
}
statements: 85,
},
},
projects: [
'<rootDir>/jest/browser/jest.config.ts',
'<rootDir>/jest/node/jest.config.ts',
'<rootDir>/jest/tsd/jest.config.ts',
],
}
export default config;
};
export default config;
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { completeActivityTaskEvent } from '@/views/workflow-history/__fixtures__/workflow-history-activity-events';

import formatTimestampToDatetime from '../format-timestamp-to-datetime';
import formatWorkflowHistory from '../format-workflow-history';
import formatWorkflowHistoryEvent from '../format-workflow-history-event';
import formatWorkflowHistoryEventType from '../format-workflow-history-event-type';

jest.mock('../format-timestamp-to-datetime');
jest.mock('../format-workflow-history-event');
Expand All @@ -16,10 +17,6 @@ const mockedFormatWorkflowHistoryEvent =
formatWorkflowHistoryEvent as jest.MockedFunction<
typeof formatWorkflowHistoryEvent
>;
const mockedFormatWorkflowHistoryEventType =
formatWorkflowHistoryEventType as jest.MockedFunction<
typeof formatWorkflowHistoryEventType
>;

describe('formatWorkflowHistory', () => {
beforeEach(() => {
Expand All @@ -29,21 +26,13 @@ describe('formatWorkflowHistory', () => {
it('should format workflow history correctly', () => {
const expectedTimestamp = new Date('2023-06-18T12:34:56.Z');
mockedFormatTimestampToDatetime.mockReturnValue(expectedTimestamp);
//@ts-expect-error using mock value that doesn't match formatting schema for easier validation
mockedFormatWorkflowHistoryEvent.mockReturnValue({ formattedEvent: true });
mockedFormatWorkflowHistoryEventType.mockReturnValue(
'ActivityTaskCanceled'
);

const input = {
archived: true,
history: {
events: [
{
eventId: '1',
eventTime: { seconds: '1234567890', nano: 0 },
attributes: 'workflowExecutionStartedEventAttributes',
},
],
events: [completeActivityTaskEvent],
},
rawHistory: ['raw event data'],
otherData: 'some other data',
Expand All @@ -54,10 +43,6 @@ describe('formatWorkflowHistory', () => {
history: {
events: [
{
eventId: 1,
timestamp: expectedTimestamp,
eventType: 'ActivityTaskCanceled',
attributes: 'workflowExecutionStartedEventAttributes',
formattedEvent: true,
},
],
Expand All @@ -67,16 +52,6 @@ describe('formatWorkflowHistory', () => {
};

expect(formatWorkflowHistory(input)).toEqual(expectedOutput);
expect(mockedFormatTimestampToDatetime).toHaveBeenCalledWith({
seconds: '1234567890',
nano: 0,
});
expect(mockedFormatWorkflowHistoryEvent).toHaveBeenCalledWith({
attributes: 'workflowExecutionStartedEventAttributes',
});
expect(formatWorkflowHistoryEventType).toHaveBeenCalledWith(
'workflowExecutionStartedEventAttributes'
);
});

it('should set archived to null if not provided', () => {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading