ads-client 1.13.2 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.14.0] - 23.07.2022
8
+ ### Added
9
+ - Created end-to-end testing for the library using Jest
10
+ - Separate PLC project required for testing: https://github.com/jisotalo/ads-client-test-plc-project
11
+ - Test is started using command `npm test`
12
+ - First version tests
13
+ - Connecting
14
+ - Reading
15
+ - Writing
16
+ - RPC methods
17
+
18
+ ### Changed
19
+ - Bug fix: Value converted to Javascript variable incorrectly in some edge cases [See issue #94](https://github.com/jisotalo/ads-client/issues/94)
20
+
7
21
  ## [1.13.2] - 17.05.2022
8
22
  ### Changed
9
23
  - Bug fix: Incorrect parsing of ARRAY OF ARRAY, now works as should [See issue #91](https://github.com/jisotalo/ads-client/issues/91)
package/README.md CHANGED
@@ -89,6 +89,7 @@ Check out the [node-red-contrib-ads-client](https://www.npmjs.com/package/node-r
89
89
  * [Enabling debug from code](#enabling-debug-from-code)
90
90
  * [Enabling debugging from terminal](#enabling-debugging-from-terminal)
91
91
  - [FAQ](#faq)
92
+ - [Automatic testing](#automatic-testing)
92
93
  - [Documentation](#documentation)
93
94
  - [License](#license)
94
95
 
@@ -1755,7 +1756,12 @@ Another option is to use setting `bareClient: true` (since v.1.13.0). However, w
1755
1756
 
1756
1757
  I would suggest to use ads-client normally without any special settings. If the target is at config mode, use separate client instance to start it, and the again the normal instance to connect to a running system. This way the client works the best.
1757
1758
 
1759
+ # Automatic testing
1760
+ Since version 1.14.0 the library has automatic testing using Jest. Idea is to run the tests before updates to make sure everything works OK (this should have been done much earlier...)
1758
1761
 
1762
+ Separate PLC project is required for testing, see https://github.com/jisotalo/ads-client-test-plc-project for more project and more info.
1763
+
1764
+ Tests are run with command `npm test` (not in npm version, please clone this repository).
1759
1765
 
1760
1766
  # Documentation
1761
1767
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "ads-client",
3
- "version": "1.13.2",
3
+ "version": "1.14.0",
4
4
  "description": "Beckhoff TwinCAT ADS client library for Node.js (unofficial). Connects to Beckhoff TwinCAT automation systems using ADS protocol.",
5
5
  "main": "./src/ads-client.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
7
+ "test": "jest --runInBand",
8
8
  "generate-docs": "jsdoc ./src/ads-client.js ./README.md -c ./jsdoc-conf.json -d ./docs/ -t ./node_modules/docdash/"
9
9
  },
10
10
  "keywords": [
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "docdash": "^1.2.0",
42
+ "jest": "^28.1.3",
42
43
  "jsdoc": "^3.6.7"
43
44
  },
44
45
  "files": [
package/src/ads-client.js CHANGED
@@ -5230,8 +5230,8 @@ function _parseJsObjectToBuffer(value, dataType, objectPathStr = '', isArraySubI
5230
5230
 
5231
5231
  //Struct or array subitem - Go through each subitem
5232
5232
  if ((dataType.arrayData.length === 0 || isArraySubItem) && dataType.subItems.length > 0) {
5233
- buffer = Buffer.alloc(dataType.offset + dataType.size)
5234
-
5233
+ buffer = Buffer.alloc(dataType.size)
5234
+
5235
5235
  for (const subItem of dataType.subItems) {
5236
5236
  //Try the find the subitem from javascript object
5237
5237
  let key = null