Skip to content

Commit

Permalink
Merge pull request #17 from Luligu/dev
Browse files Browse the repository at this point in the history
Release 1.2.3
  • Loading branch information
Luligu authored Feb 2, 2025
2 parents 65ccb55 + dbd6ebd commit e62536a
Show file tree
Hide file tree
Showing 8 changed files with 524 additions and 428 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ replay_pid*
temp
src/mock
jest
matterstorage
matterstorage.backup
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,5 @@ create-release.js
tsconfig.*
temp
jest
matterstorage
matterstorage.backup
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ If you like this project and find it useful, please consider giving it a star on

All notable changes to this project will be documented in this file.

## [1.2.3] - 2025-02-02

### Changed

- [package]: Requires matterbridge 2.1.0.
- [package]: Updated package.
- [package]: Updated dependencies.

<a href="https://www.buymeacoffee.com/luligugithub">
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
</a>

## [1.2.2] - 2024-12-23

### Added
Expand Down
395 changes: 206 additions & 189 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matterbridge-somfy-tahoma",
"version": "1.2.2",
"version": "1.2.3",
"description": "Matterbridge somfy tahoma plugin",
"author": "https://github.com/Luligu",
"license": "Apache-2.0",
Expand Down Expand Up @@ -37,6 +37,7 @@
},
"scripts": {
"build": "tsc",
"buildProduction": "tsc --project tsconfig.production.json",
"watch": "tsc --watch",
"start:frontend": "matterbridge",
"start:bridge": "matterbridge -bridge",
Expand All @@ -45,22 +46,23 @@
"test:verbose": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose",
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
"test:index": "node --experimental-vm-modules node_modules/jest/bin/jest.js src/index.test.ts --verbose --coverage",
"test:platform": "node --experimental-vm-modules node_modules/jest/bin/jest.js src/platform.test.ts --verbose --coverage",
"lint": "eslint --max-warnings=0",
"lint:fix": "eslint --max-warnings=0 --fix",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
"clean": "npx rimraf tsconfig.tsbuildinfo ./dist",
"cleanBuild": "npm run clean && tsc",
"cleanBuild": "npm run clean && npm run build",
"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 link matterbridge && npm run build",
"checkDependencies": "npx npm-check-updates",
"updateDependencies": "npx npm-check-updates -u && npm install && npm link matterbridge && npm run build",
"prepublishOnly": "npm pkg delete devDependencies && npm pkg delete scripts && npm install --omit=dev && npm shrinkwrap",
"buildProduction": "npm run clean && tsc --project tsconfig.production.json",
"npmPack": "copy package.json package.log && npm run buildProduction && npm pkg delete devDependencies && npm pkg delete scripts && npm pkg delete types && npx rimraf ./node_modules && npm install --omit=dev && npm shrinkwrap && npm pack && copy package.log package.json && npm run deepCleanBuild",
"npmPublishTagDev": "copy package.json package.log && npm run buildProduction && npm pkg delete devDependencies && npm pkg delete scripts && npm pkg delete types && npx rimraf ./node_modules && npm install --omit=dev && npm shrinkwrap && npm publish --tag dev && copy package.log package.json && npm run deepCleanBuild",
"npmPublishTagLatest": "copy package.json package.log && npm run buildProduction && npm pkg delete devDependencies && npm pkg delete scripts && npm pkg delete types && npx rimraf ./node_modules && npm install --omit=dev && npm shrinkwrap && npm publish --tag latest && copy package.log package.json && npm run deepCleanBuild",
"updateDependencies": "npx npm-check-updates -u && npm run deepCleanBuild",
"prepublishOnly": "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 prepublishOnly && npm pack && copy package.log package.json && npm run deepCleanBuild",
"npmPublishTagDev": "copy package.json package.log && npm run prepublishOnly && npm publish --tag dev && copy package.log package.json && npm run deepCleanBuild",
"npmPublishTagLatest": "copy package.json package.log && npm run prepublishOnly && npm publish --tag latest && copy package.log package.json && npm run deepCleanBuild",
"matterbridge:add": "matterbridge -add .\\",
"matterbridge:remove": "matterbridge -remove .\\",
"matterbridge:enable": "matterbridge -enable .\\",
Expand All @@ -80,18 +82,18 @@
"overkiz-client": "1.0.20"
},
"devDependencies": {
"@eslint/js": "9.17.0",
"@eslint/js": "9.19.0",
"@types/eslint__js": "8.42.3",
"@types/jest": "29.5.14",
"@types/node": "22.10.2",
"eslint": "9.17.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.10.0",
"eslint-plugin-prettier": "5.2.1",
"@types/node": "22.13.0",
"eslint": "9.19.0",
"eslint-config-prettier": "10.0.1",
"eslint-plugin-jest": "28.11.0",
"eslint-plugin-prettier": "5.2.3",
"jest": "29.7.0",
"prettier": "3.4.2",
"ts-jest": "29.2.5",
"typescript": "5.7.2",
"typescript-eslint": "8.18.1"
"typescript": "5.7.3",
"typescript-eslint": "8.22.0"
}
}
115 changes: 69 additions & 46 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,84 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Matterbridge, MatterbridgeDevice, MatterbridgeEndpoint, PlatformConfig } from 'matterbridge';
import { Matterbridge, MatterbridgeEndpoint, PlatformConfig } from 'matterbridge';
import { AnsiLogger } from 'matterbridge/logger';
import { SomfyTahomaPlatform } from './platform.js';
import initializePlugin from './index';
import { jest } from '@jest/globals';

describe('initializePlugin', () => {
let mockMatterbridge: Matterbridge;
let mockLog: AnsiLogger;
let mockConfig: PlatformConfig;
const mockLog = {
fatal: jest.fn((message: string, ...parameters: any[]) => {
// console.log('mockLog.fatal', message, parameters);
}),
error: jest.fn((message: string, ...parameters: any[]) => {
// console.log('mockLog.error', message, parameters);
}),
warn: jest.fn((message: string, ...parameters: any[]) => {
// console.log('mockLog.warn', message, parameters);
}),
notice: jest.fn((message: string, ...parameters: any[]) => {
// console.log('mockLog.notice', message, parameters);
}),
info: jest.fn((message: string, ...parameters: any[]) => {
// console.log('mockLog.info', message, parameters);
}),
debug: jest.fn((message: string, ...parameters: any[]) => {
// console.log('mockLog.debug', message, parameters);
}),
} as unknown as AnsiLogger;

const mockMatterbridge = {
matterbridgeDirectory: './jest/matterbridge',
matterbridgePluginDirectory: './jest/plugins',
systemInformation: { ipv4Address: undefined, ipv6Address: undefined, osRelease: 'xx.xx.xx.xx.xx.xx', nodeVersion: '22.1.10' },
matterbridgeVersion: '2.1.0',
edge: true,
log: mockLog,
getDevices: jest.fn(() => {
// console.log('getDevices called');
return [];
}),
getPlugins: jest.fn(() => {
// console.log('getDevices called');
return [];
}),
addBridgedEndpoint: jest.fn(async (pluginName: string, device: MatterbridgeEndpoint) => {
// console.log('addBridgedEndpoint called');
}),
removeBridgedEndpoint: jest.fn(async (pluginName: string, device: MatterbridgeEndpoint) => {
// console.log('removeBridgedEndpoint called');
}),
removeAllBridgedEndpoints: jest.fn(async (pluginName: string) => {
// console.log('removeAllBridgedEndpoints called');
}),
} as unknown as Matterbridge;

const mockConfig = {
'name': 'matterbridge-somfy-tahoma',
'type': 'DynamicPlatform',
'username': 'None',
'password': 'None',
'service': 'somfy_europe',
'blackList': [],
'whiteList': [],
'debug': false,
'unregisterOnShutdown': false,
} as PlatformConfig;

beforeEach(() => {
mockMatterbridge = {
matterbridgeDirectory: './jest/matterbridge',
matterbridgePluginDirectory: './jest/plugins',
systemInformation: { ipv4Address: undefined },
matterbridgeVersion: '1.6.7',
getDevices: jest.fn(() => {
// console.log('getDevices called');
return [];
}),
addBridgedDevice: jest.fn(async (pluginName: string, device: MatterbridgeDevice) => {
// console.log('addBridgedDevice called');
}),
addBridgedEndpoint: jest.fn(async (pluginName: string, device: MatterbridgeEndpoint) => {
// console.log('addBridgedEndpoint called');
// await aggregator.add(device);
}),
removeBridgedDevice: jest.fn(async (pluginName: string, device: MatterbridgeDevice) => {
// console.log('removeBridgedDevice called');
}),
removeBridgedEndpoint: jest.fn(async (pluginName: string, device: MatterbridgeEndpoint) => {
// console.log('removeBridgedEndpoint called');
}),
removeAllBridgedDevices: jest.fn(async (pluginName: string) => {
// console.log('removeAllBridgedDevices called');
}),
removeAllBridgedEndpoints: jest.fn(async (pluginName: string) => {
// console.log('removeAllBridgedEndpoints called');
}),
} as unknown as Matterbridge;
mockLog = { error: jest.fn(), warn: jest.fn(), info: jest.fn(), debug: jest.fn() } as unknown as AnsiLogger;
mockConfig = {
'name': 'matterbridge-somfy-tahoma',
'type': 'DynamicPlatform',
'username': 'None',
'password': 'None',
'service': 'somfy_europe',
'blackList': [],
'whiteList': [],
'debug': false,
'unregisterOnShutdown': false,
} as PlatformConfig;
// Clear all mocks.
jest.clearAllMocks();
});

afterAll(async () => {
// Restore all mocks.
jest.restoreAllMocks();
});

it('should return an instance of SomfyTahomaPlatform', () => {
it('should return an instance of SomfyTahomaPlatform', async () => {
const result = initializePlugin(mockMatterbridge, mockLog, mockConfig);
expect(result).toBeInstanceOf(SomfyTahomaPlatform);
await result.onShutdown();
});
});
Loading

0 comments on commit e62536a

Please sign in to comment.