rename package from @push.rocks/npmextra to @push.rocks/smartconfig
- Rename all source files from npmextra.* to simpler names (classes.appdata.ts, etc.) - Rename Npmextra class to Smartconfig - Config file changed from npmextra.json to smartconfig.json - KV store path changed from ~/.npmextra/kv to ~/.smartconfig/kv - Update all imports, tests, and metadata
This commit is contained in:
18
test/test.ts
18
test/test.ts
@@ -1,31 +1,31 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
|
||||
// module to test
|
||||
import * as npmextra from '../ts/index.js';
|
||||
import * as smartconfig from '../ts/index.js';
|
||||
|
||||
let testNpmextra: npmextra.Npmextra;
|
||||
let testSmartconfig: smartconfig.Smartconfig;
|
||||
|
||||
tap.test('should create a new Npmtextra instance', async () => {
|
||||
testNpmextra = new npmextra.Npmextra('./test/');
|
||||
expect(testNpmextra).toBeInstanceOf(npmextra.Npmextra);
|
||||
tap.test('should create a new Smartconfig instance', async () => {
|
||||
testSmartconfig = new smartconfig.Smartconfig('./test/');
|
||||
expect(testSmartconfig).toBeInstanceOf(smartconfig.Smartconfig);
|
||||
});
|
||||
|
||||
tap.test('should state wether a npmextra.json exists', async () => {
|
||||
tap.test('should state wether a smartconfig.json exists', async () => {
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testNpmextra.npmextraJsonExists).toBeTrue();
|
||||
expect(testSmartconfig.smartconfigJsonExists).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test(
|
||||
'should pass through default value, if not overriden by config from file',
|
||||
async () => {
|
||||
let testData = testNpmextra.dataFor('testTool', { someKey2: 'someValue2' });
|
||||
let testData = testSmartconfig.dataFor('testTool', { someKey2: 'someValue2' });
|
||||
console.log(testData);
|
||||
expect(testData).toHaveProperty('someKey2');
|
||||
},
|
||||
);
|
||||
|
||||
tap.test('should read a config file', async () => {
|
||||
let testData = testNpmextra.dataFor<any>('testTool', {
|
||||
let testData = testSmartconfig.dataFor<any>('testTool', {
|
||||
someKey2: 'someValue2',
|
||||
});
|
||||
expect(testData).toHaveProperty('someKey2');
|
||||
|
||||
Reference in New Issue
Block a user