Skip to content

Commit c6a9bd1

Browse files
committed
Fix unit test (mainly function output change)
1 parent 5c86ab7 commit c6a9bd1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/formatter/formatFunction.spec.ts

+2-2
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

+3-1
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

+4-6
Original file line numberDiff line numberDiff line change
@@ -927,10 +927,9 @@ describe('reactElementToJSXString(ReactElement)', () => {
927927
});
928928

929929
it('should return the actual functions when "showFunctions" is true', () => {
930-
/* eslint-disable arrow-body-style */
931-
const fn = () => {
930+
function fn() {
932931
return 'value';
933-
};
932+
}
934933

935934
expect(
936935
reactElementToJSXString(<div fn={fn} />, {
@@ -940,10 +939,9 @@ describe('reactElementToJSXString(ReactElement)', () => {
940939
});
941940

942941
it('should expose the multiline "functionValue" formatter', () => {
943-
/* eslint-disable arrow-body-style */
944-
const fn = () => {
942+
function fn() {
945943
return 'value';
946-
};
944+
}
947945

948946
expect(
949947
reactElementToJSXString(<div fn={fn} />, {

0 commit comments

Comments
 (0)