diff --git a/src/version.spec.ts b/src/version.spec.ts new file mode 100644 index 0000000..96722de --- /dev/null +++ b/src/version.spec.ts @@ -0,0 +1,13 @@ +import { LIB_VERSION } from './version'; + +describe('Version Module', () => { + it('should export a LIB_VERSION constant', () => { + expect(LIB_VERSION).toBeDefined(); + }); + + it('should match the version specified in package.json', () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const packageJson = require('../package.json'); + expect(LIB_VERSION).toBe(packageJson.version); + }); +}); diff --git a/src/version.ts b/src/version.ts index 9a1f5e2..cb065ce 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1,3 @@ -export const LIB_VERSION = '3.0.0'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const packageJson = require('../package.json'); +export const LIB_VERSION = packageJson.version;