Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c6a9bd1

Browse files
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

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
@@ -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)

AltStyle によって変換されたページ (->オリジナル) /