TLDR; very quick setup to add vitest, jsdom and react testing library
install dependencies
pnpm i --save-dev vitest jsdom @testing-library/react @testing-library/jest-dom
I followed the recommendation provided by the react docs that suggest how to use a reducer in conjuction with context.
There is a lot of boiler plate just to add 1 action and a reducer that handles the action.
This is what it looks like before my simplified API, which at first glance doesn't look bad for small demo apps, but quickly adds up over time.
{ | |
"env": { | |
"browser": true, | |
"es2021": true | |
}, | |
"extends": [ | |
"airbnb", | |
"airbnb/hooks" | |
], | |
"rules": { |
const readline = require("readline"); | |
/** | |
* Writes a certain percentage number to the node js console | |
*/ | |
const writePercentate = percentage => { | |
readline.clearLine(process.stdout, 0); | |
readline.cursorTo(process.stdout, 0); | |
process.stdout.write(`loading... ${percentage}%`); |
const Couchbase = require('couchbase'); | |
const Promise = require('bluebird'); | |
class Bucket { | |
constructor(options) { | |
this.options = options; | |
} | |
async connect() { | |
const { |