-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathreact.test.ts
More file actions
executable file
·64 lines (60 loc) · 1.91 KB
/
react.test.ts
File metadata and controls
executable file
·64 lines (60 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as prettier from "prettier";
import { AllOptions } from "../src/types";
function subject(code: string, options: Partial<AllOptions> = {}) {
return prettier.format(code, {
plugins: ["prettier-plugin-jsdoc"],
jsdocSpaces: 1,
parser: "babel",
...options,
} as AllOptions);
}
test("JS code should be formatted as usuall", async () => {
const result = await subject(`
import React, { memo } from "react";
import { Text, View, StyleSheet } from "react-native";
import * as d3Scale from "d3-scale";
import * as array from "d3-array";
import Svg, { G, Text as SVGText } from "react-native-svg";
import { useLayout, useInlineStyle } from "./hooks";
/**
* @typedef {object} XAxisProps
* @property {number} [spacingOuter]
* Spacing between the labels. Only applicable if
* \`scale=d3Scale.scaleBand\` and should then be equal to \`spacingOuter\` prop on the
* actual BarChart
*
* Default is \`0.05\`
* @property {number} [spacingInner] Spacing between the labels. Only applicable if
* \`scale=d3Scale.scaleBand\` and should then be equal to \`spacingInner\` prop on the
* actual BarChart
*
* Default is \`0.05\`
* @property {d3Scale.scaleLinear} [scale] Should be the same as passed into the charts \`xScale\`
* Default is \`d3Scale.scaleLinear\`
*
* @property {()=>any} [xAccessor] Default is \`({index}) => index\`
* @property {number} [max]
* @property {number} [min]
*/
/**
* @type {React.FC<XAxisProps & import("react-native-svg").TextProps>}
*/
const XAxis = memo(
({
contentInset: { left = 0, right = 0 } = {},
style,
data,
numberOfTicks,
children,
min,
max,
spacingInner = 0.05,
spacingOuter = 0.05,
xAccessor = ({ index }) => index,
scale = d3Scale.scaleLinear,
formatLabel = value => value,
...svg
})=>{})
`);
expect(result).toMatchSnapshot();
});