Skip to content

ooboqoo/nodejs-demo

Repository files navigation

Node.js Demo

How to test non-exported functions

All non-exported functions are exposed under an exported __test__ object.

// index.js
const privateFunction = () => {
  return 'private'
}
export const __test__ = {
  privateFunction,
}
// index.test.js
import { __test__ } from './index.js'
const { privateFunction } = __test__
expect(privateFunction()).toBe('private')

References

https://github.com/sindresorhus/awesome-nodejs

About

Node.js demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published