Skip to content

Commit 5d41d1d

Browse files
committed
test: add a test case for APB forced-error
APB always return an error. Add a test so we can confirm that error-behaviour does not change while doing some refactoring later.
1 parent 07172ad commit 5d41d1d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

test/APB.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright 2016 Signal K and contributors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
'use strict'
18+
19+
const Parser = require('../lib')
20+
const chai = require('chai')
21+
const should = require('chai').Should()
22+
23+
const heading = '$STALK,84,B6,10,00,00,00,00,00,00*14'
24+
const standby = '$STALK,84,E6,15,00,00,00,00,00,08*1E'
25+
const auto = '$STALK,84,56,5E,79,02,00,00,00,08*16'
26+
const wind = '$STALK,84,06,00,00,04,00,00,00,00*63'
27+
const route = '$STALK,84,06,00,00,08,00,00,00,00*6F'
28+
const rudder = '$STALK,84,06,00,00,08,00,FE,00,00*6C'
29+
const heading_nineC = '$STALK,9C,51,1E,00*4B'
30+
31+
chai.Should()
32+
chai.use(require('chai-things'))
33+
34+
describe('APB', done => {
35+
it('Doesn\'t parse APB sentences', done => {
36+
new Parser()
37+
.parse('$GPAPB,A,A,0.10,R,N,V,V,011,M,DEST,011,M,011,M*3C')
38+
.then(result => {
39+
should.equal(result, null)
40+
done()
41+
})
42+
.catch(e => {
43+
should.equal(e.message, "@FIXME: APB hook needs to be rewritten to fit latest version of SK")
44+
done()
45+
})
46+
})
47+
48+
})

0 commit comments

Comments
 (0)