31 lines
690 B
Markdown
31 lines
690 B
Markdown
|
# GPIO-mock test nodejs
|
||
|
|
||
|
test gpio in a container (without them being physically available)
|
||
|
|
||
|
idea/initial mock forked from: https://github.com/sitepoint-editors/TddWithGpio
|
||
|
|
||
|
Article: https://www.sitepoint.com/getting-started-with-the-raspberry-pi-gpio-pins-in-node-js/
|
||
|
|
||
|
## run dev
|
||
|
|
||
|
~~~shell
|
||
|
docker run -it --rm -v $(pwd):/app -w /app node:lts bash
|
||
|
~~~
|
||
|
|
||
|
followed by
|
||
|
|
||
|
~~~shell
|
||
|
npm install
|
||
|
npm run test
|
||
|
~~~
|
||
|
|
||
|
## Jest
|
||
|
|
||
|
https://jestjs.io/docs/using-matchers
|
||
|
|
||
|
## TODO
|
||
|
|
||
|
check this out: https://stackoverflow.com/questions/50066138/mock-fs-function-with-jest
|
||
|
|
||
|
is this going to be a problem? https://stackoverflow.com/questions/62568294/nodejs-fs-watch-inside-docker-container-detects-changes-twice
|