From 411e58185e7baa18e784c5b43d27d53161766dd7 Mon Sep 17 00:00:00 2001 From: Basile Bruneau Date: Sun, 13 Feb 2022 17:49:11 +0100 Subject: [PATCH] feat: add basic tests checking the lib is not crashing --- .gitignore | 1 - package.json | 3 ++- test.js | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test.js diff --git a/.gitignore b/.gitignore index 180354f..20ed762 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules/ -test.js *.svg /index.js /without-countries.js diff --git a/package.json b/package.json index e448291..e844aa1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ }, "module": "./src/with-countries.js", "scripts": { - "build": "webpack" + "build": "webpack", + "test": "node test.js" }, "keywords": [ "map", diff --git a/test.js b/test.js new file mode 100644 index 0000000..a738380 --- /dev/null +++ b/test.js @@ -0,0 +1,18 @@ +const DottedMap = require('./index').default; + +// The tests can only be ran after the lib has been built. + +const map = new DottedMap({ height: 60, grid: 'diagonal' }); + +map.addPin({ + lat: 40.73061, + lng: -73.935242, + svgOptions: { color: '#d6ff79', radius: 0.4 }, +}); +map.getPin({ lat: 40.73061, lng: -73.935242 }); +map.getSVG({ + radius: 0.22, + color: '#423B38', + shape: 'circle', + backgroundColor: '#020300', +});