diff --git a/packages/client/test/unit/util/point.test.ts b/packages/client/test/unit/util/point.test.ts index 31fa016e..ececa45d 100644 --- a/packages/client/test/unit/util/point.test.ts +++ b/packages/client/test/unit/util/point.test.ts @@ -196,7 +196,15 @@ describe('point', () => { const p = Point.fromValues(v) expect('a,c=d b=1 150').equals(p.toString()) }) - + it('as point', () => { + const v = new PointValues() + .setMeasurement('a') + .setField('b', 1) + .setTag('c', 'd') + .setTimestamp(150) + const p = v.asPoint() + expect('a,c=d b=1 150').equals(p.toString()) + }) it('convert point values to point with undefined measurement', () => { const v = new PointValues() .setMeasurement('') @@ -207,5 +215,28 @@ describe('point', () => { Point.fromValues(v) }).to.throw(`Cannot convert values to point without measurement set!`) }) + it('has fields', () => { + const v1 = new PointValues() + .setMeasurement('a') + .setTag('c', 'd') + .setTimestamp(150) + expect(false).equals(v1.hasFields()) + const v2 = new PointValues() + .setMeasurement('a') + .setField('b', 1) + .setTag('c', 'd') + .setTimestamp(150) + expect(true).equals(v2.hasFields()) + }) + it('remove field', () => { + const v = new PointValues() + .setMeasurement('a') + .setField('b', 1) + .setTag('c', 'd') + .setTimestamp(150) + expect(true).eq(v.hasFields()) + v.removeField('b') + expect(false).equals(v.hasFields()) + }) }) })