node-red-contrib-influxdb3 1.0.2 → 1.0.4

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.
@@ -0,0 +1,56 @@
1
+ const { Point } = require('@influxdata/influxdb3-client');
2
+
3
+ describe('@influxdata/influxdb3-client v2.x Point API', () => {
4
+ test('Point.setField exists and is a function', () => {
5
+ const point = new Point('test');
6
+ expect(typeof point.setField).toBe('function');
7
+ });
8
+
9
+ test('Point.setField accepts (name, value) for float', () => {
10
+ const point = new Point('test');
11
+ point.setField('temp', 23.5);
12
+ const lp = point.toLineProtocol();
13
+ expect(lp).toContain('temp=23.5');
14
+ });
15
+
16
+ test('Point.setField accepts (name, value, "integer") for integer', () => {
17
+ const point = new Point('test');
18
+ point.setField('count', 42, 'integer');
19
+ const lp = point.toLineProtocol();
20
+ expect(lp).toContain('count=42i');
21
+ });
22
+
23
+ test('Point.setField accepts (name, value) for string', () => {
24
+ const point = new Point('test');
25
+ point.setField('status', 'ok');
26
+ const lp = point.toLineProtocol();
27
+ expect(lp).toContain('status="ok"');
28
+ });
29
+
30
+ test('Point.setField accepts (name, value) for boolean', () => {
31
+ const point = new Point('test');
32
+ point.setField('active', true);
33
+ const lp = point.toLineProtocol();
34
+ // Library serializes booleans as T/F in line protocol
35
+ expect(lp).toContain('active=T');
36
+ });
37
+
38
+ test('Point.setTag exists and is a function', () => {
39
+ const point = new Point('test');
40
+ expect(typeof point.setTag).toBe('function');
41
+ });
42
+
43
+ test('Point.setTimestamp exists and is a function', () => {
44
+ const point = new Point('test');
45
+ expect(typeof point.setTimestamp).toBe('function');
46
+ });
47
+
48
+ test('type-specific methods exist alongside generic setField', () => {
49
+ const point = new Point('test');
50
+ expect(typeof point.setIntegerField).toBe('function');
51
+ expect(typeof point.setFloatField).toBe('function');
52
+ expect(typeof point.setStringField).toBe('function');
53
+ expect(typeof point.setBooleanField).toBe('function');
54
+ });
55
+ });
56
+