Skip to content

Commit

Permalink
chore: test point values
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Sep 18, 2023
1 parent 9d28e69 commit b05ab2b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/client/test/unit/util/point.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ describe('point', () => {
.setField('b', 1)
.setTag('c', 'd')
.setTimestamp(150)
const p = v.asPoint()
let p = v.asPoint()
expect('a,c=d b=1 150').equals(p.toString())
p = v.asPoint('x')
expect('x,c=d b=1 150').equals(p.toString())
})
it('convert point values to point with undefined measurement', () => {
const v = new PointValues()
Expand Down Expand Up @@ -255,11 +257,23 @@ describe('point', () => {
.setField('c', 'xyz')
.setField('d', false)
.setField('e', 3.45)
.setUintegerField('f', 8)
.setStringField('g', 88)
.setTimestamp(150)
expect(1).deep.equals(v.getIntegerField('b'))
expect('xyz').deep.equals(v.getStringField('c'))
expect(false).deep.equals(v.getBooleanField('d'))
expect(3.45).deep.equals(v.getFloatField('e'))
expect(8).deep.equals(v.getUintegerField('f'))
expect('88').deep.equals(v.getStringField('g'))
})
})
it('undefined field', () => {
const v = new PointValues()
.setMeasurement('a')
.setField('c', 'xyz')
.setTimestamp(150)
expect(undefined).deep.equals(v.getField('x'))
expect(undefined).deep.equals(v.getFieldType('x'))
})
})

0 comments on commit b05ab2b

Please sign in to comment.