Skip to content

Commit

Permalink
Dev 2.1.6-dev.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Luligu committed Feb 12, 2025
1 parent 1fae8a5 commit 1180347
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"cleanBuildProduction": "npm run clean && npm run buildProduction",
"deepClean": "npx rimraf tsconfig.tsbuildinfo package-lock.json npm-shrinkwrap.json ./dist ./node_modules",
"deepCleanBuild": "npm run deepClean && npm install && npm run build && npm link",
"checkBeforePush": "npm run deepCleanBuild && npm run lint && npm run format && npm run test",
"prepublishOnly": "npm pkg delete devDependencies scripts && npm install --omit=dev && npm shrinkwrap",
"prepublishOnlyProduction": "npm run cleanBuildProduction && npm pkg delete devDependencies scripts types && npx rimraf ./node_modules && npm install --omit=dev && npm shrinkwrap",
"npmPack": "copy package.json package.log && npm run prepublishOnlyProduction && npm pack && copy package.log package.json && npm run deepCleanBuild",
Expand Down
12 changes: 12 additions & 0 deletions src/matterbridgePlatform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@ describe('Matterbridge platform', () => {
platform.config.deviceEntityBlackList = {};
});

it('should not create storage manager without a name', async () => {
const platform = new MatterbridgePlatform(matterbridge, new AnsiLogger({ logName: 'Matterbridge platform' }), { name: undefined, type: 'type', debug: false, unregisterOnShutdown: false });
expect(platform.storage).toBeUndefined();
expect(await platform.checkEndpointNumbers()).toBe(-1);
});

it('should not create storage manager with name empty', async () => {
const platform = new MatterbridgePlatform(matterbridge, new AnsiLogger({ logName: 'Matterbridge platform' }), { name: '', type: 'type', debug: false, unregisterOnShutdown: false });
expect(platform.storage).toBeUndefined();
expect(await platform.checkEndpointNumbers()).toBe(-1);
});

test('should check checkNotLatinCharacters', async () => {
const testDevice = new MatterbridgeEndpoint(contactSensor, { uniqueStorageKey: 'nonLatin' }, true);
testDevice.createDefaultBasicInformationClusterServer('nonLatin조명', 'serial012345', 0xfff1, 'Matterbridge', 0x8001, 'Test device');
Expand Down
2 changes: 1 addition & 1 deletion src/matterbridgePlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class MatterbridgePlatform {
this.config = config;

// create the NodeStorageManager for the plugin platform
if (!isValidString(this.config.name)) return;
if (!isValidString(this.config.name) || this.config.name === '') return;
this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
this.storage = new NodeStorageManager({
dir: path.join(this.matterbridge.matterbridgeDirectory, this.config.name),
Expand Down

0 comments on commit 1180347

Please sign in to comment.