Skip to content

Commit db9a8e1

Browse files
committed
Fix unit test (mainly function output change)
1 parent 0395a7f commit db9a8e1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/formatter/formatFunction.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import formatFunction from './formatFunction';
22

33
jest.mock(
4-
'./formatReactElementNode.js',
4+
'./formatReactElementNode',
55
() => (node) => `<${node.displayName} />`
66
);
77

@@ -35,7 +35,7 @@ describe('formatFunction', () => {
3535
formatFunction(() => 1, {
3636
showFunctions: true,
3737
})
38-
).toEqual('function () {return 1;}');
38+
).toEqual('() => 1');
3939
});
4040

4141
it('should use the functionValue option', () => {

src/formatter/formatPropValue.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ describe('formatPropValue', () => {
4444
});
4545

4646
it('should show the function prop value implementation if "showFunctions" option is true', () => {
47-
const doThings = (a) => a * 2;
47+
function doThings(a) {
48+
return a * 2;
49+
}
4850

4951
expect(
5052
formatPropValue(doThings, false, 0, {

src/index.spec.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,9 @@ describe('reactElementToJSXString(ReactElement)', () => {
887887
});
888888

889889
it('should return the actual functions when "showFunctions" is true', () => {
890-
/* eslint-disable arrow-body-style */
891-
const fn = () => {
890+
function fn() {
892891
return 'value';
893-
};
892+
}
894893

895894
expect(
896895
reactElementToJSXString(<div fn={fn} />, {
@@ -900,10 +899,9 @@ describe('reactElementToJSXString(ReactElement)', () => {
900899
});
901900

902901
it('should expose the multiline "functionValue" formatter', () => {
903-
/* eslint-disable arrow-body-style */
904-
const fn = () => {
902+
function fn() {
905903
return 'value';
906-
};
904+
}
907905

908906
expect(
909907
reactElementToJSXString(<div fn={fn} />, {

0 commit comments

Comments
 (0)