Skip to content

Commit 0a9706a

Browse files
committed
Add a unit tests for typescript types (release-1.24 only)
Master will have a more robust test pipeline
1 parent 95866fd commit 0a9706a

File tree

4 files changed

+142
-2
lines changed

4 files changed

+142
-2
lines changed

package-lock.json

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"build:site": "cp dist/function-plot.js site/js/function-plot.js",
2323
"start": "webpack-dev-server",
2424
"docs": "typedoc --excludeExternals --externalPattern \"**/node_modules/**\" --out site/docs src/index.ts",
25-
"test": "jest"
25+
"test": "jest",
26+
"test:types": "check-dts test/** src/**"
2627
},
2728
"files": [
2829
"/dist"
@@ -67,6 +68,7 @@
6768
"@typescript-eslint/parser": "^5.37.0",
6869
"babel-eslint": "^10.1.0",
6970
"babel-loader": "^9.1.2",
71+
"check-dts": "^0.7.2",
7072
"core-js": "^3.25.2",
7173
"dox": "^1.0.0",
7274
"eslint": "^8.23.1",

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export interface FunctionPlotDatum {
149149
* - interval: uses the interval arithmetic sampler to render a disjoint set of rectangles
150150
* - scatter: dotted line
151151
*/
152-
graphType?: 'polyline' | 'interval' | 'scatter'
152+
graphType?: 'polyline' | 'interval' | 'scatter' | 'text'
153153

154154
/**
155155
* The type of function to render

test/types.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// test with `npx check-dts`
2+
import functionPlot from '../src/'
3+
4+
functionPlot({
5+
target: '#playground',
6+
data: [
7+
{
8+
graphType: 'text',
9+
location: [1, 1],
10+
text: 'hello world'
11+
},
12+
{
13+
graphType: 'text',
14+
location: [-1, -1],
15+
text: 'foo bar',
16+
attr: {
17+
'text-anchor': 'end'
18+
}
19+
}
20+
]
21+
})

0 commit comments

Comments
 (0)