Skip to content

Commit 51702a2

Browse files
authored
Merge pull request #166 from crishoj/configurable-target-in-tests
(v2) Configurable target `AMS_NET_ID` in tests
2 parents ebe879e + b69dbc6 commit 51702a2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

test/TC2/ads-client.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ About this test file:
3232
* This must match with .VERSION
3333
*/
3434
const PLC_PROJECT_VERSION = '2.0.0';
35-
const AMS_NET_ID = '5.19.100.19.1.1';
3635

36+
const AMS_NET_ID = process.env.AMS_NET_ID ?? '5.19.100.19.1.1';
37+
const LOCAL_AMS_NET_ID = process.env.LOCAL_AMS_NET_ID ?? '192.168.68.101.1.1';
3738

3839
const { Client, ADS } = require('../../dist/ads-client');
3940
const util = require('util');
@@ -89,7 +90,7 @@ describe('connection', () => {
8990
expect(Object.keys(client.connection)).toStrictEqual(Object.keys({
9091
connected: true,
9192
isLocal: false,
92-
localAmsNetId: '192.168.68.101.1.1',
93+
localAmsNetId: LOCAL_AMS_NET_ID,
9394
localAdsPort: 32891,
9495
targetAmsNetId: client.settings.targetAmsNetId,
9596
targetAdsPort: 851

test/TC3/ads-client.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ SOFTWARE.
2525
* This must match with GVL_AdsClientTests.VERSION
2626
*/
2727
const PLC_PROJECT_VERSION = '2.0.0';
28-
const AMS_NET_ID = '192.168.4.1.1.1';
28+
29+
const AMS_NET_ID = process.env.AMS_NET_ID ?? '192.168.4.1.1.1';
30+
const LOCAL_AMS_NET_ID = process.env.LOCAL_AMS_NET_ID ?? '192.168.68.101.1.1';
2931

3032
const { Client, ADS } = require('../../dist/ads-client');
3133
const util = require('util');
@@ -82,7 +84,7 @@ describe('connection', () => {
8284
expect(Object.keys(client.connection)).toStrictEqual(Object.keys({
8385
connected: true,
8486
isLocal: false,
85-
localAmsNetId: '192.168.68.101.1.1',
87+
localAmsNetId: LOCAL_AMS_NET_ID,
8688
localAdsPort: 32891,
8789
targetAmsNetId: client.settings.targetAmsNetId,
8890
targetAdsPort: 851

0 commit comments

Comments
 (0)