kong-js-pdk icon indicating copy to clipboard operation
kong-js-pdk copied to clipboard

Question: How to wrote Unit tests using plugin_test.js

Open chrismatheson opened this issue 2 years ago • 1 comments

from the docs

kong-js-pdk provides a mock framework to test plugin code correctness through jest.

there are examples in the repo - https://github.com/Kong/kong-js-pdk/blob/master/tests/js-hello.test.js

however when I try to setup something simple myself I seem to fall over at the first hurdle

Kong = require('kong-pdk');
Uncaught:
Error: Cannot find module '/Users/....../node_modules/kong-pdk/app.js'. Please verify that the package.json has a valid "main" entry

and I think this is actually a valid error because the current package.json shows app.js as the main entry point https://github.com/Kong/kong-js-pdk/blob/master/package.json#L5 and there are no app.js files in the repo.

Before I make a pull request to try and clean things up a little I just wanted to check im not missing something basic.

chrismatheson avatar Aug 23 '22 10:08 chrismatheson