Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
SillyFreak committed Jul 14, 2019
1 parent c06c99b commit 9cde63a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
7 changes: 6 additions & 1 deletion hedgehog/protocol/proto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ import * as process_pb from './process_pb';
import * as speaker_pb from './speaker_pb';
import * as subscription_pb from './subscription_pb';

export { hedgehog_pb, ack_pb, version_pb, emergency_pb, imu_pb, io_pb, motor_pb, servo_pb, process_pb, speaker_pb, subscription_pb };
export {
hedgehog_pb,
ack_pb, version_pb, emergency_pb,
imu_pb, io_pb, motor_pb, servo_pb,
process_pb, speaker_pb, subscription_pb,
};
26 changes: 21 additions & 5 deletions test/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import "@babel/polyfill";
import * as assert from 'assert';
import * as zmq from 'zeromq';

import { HedgehogClient, protocol, Message, ack, version, emergency, io, analog, digital, motor, servo, imu } from "../hedgehog";
import {
HedgehogClient, protocol, Message,
ack, version, emergency, io, analog, digital, motor, servo, imu,
} from "../hedgehog";

describe('Client', () => {
let server = null;
Expand Down Expand Up @@ -74,7 +77,11 @@ describe('Client', () => {
};

mock_server(
[[new version.Request()], [new version.Reply(versionResult.ucId, versionResult.hardwareVersion, versionResult.firmwareVersion, versionResult.serverVersion)]],
[
[new version.Request()],
[new version.Reply(versionResult.ucId, versionResult.hardwareVersion,
versionResult.firmwareVersion, versionResult.serverVersion)]
],
);

assert.deepStrictEqual(await hedgehog.getVersion(), versionResult);
Expand Down Expand Up @@ -154,23 +161,32 @@ describe('Client', () => {

it('`moveRelativePosition` should work', async () => {
mock_server(
[[new motor.Action(0, motor.MotorState.POWER, 1000, motor.MotorState.POWER, -1000, undefined)], [new ack.Acknowledgement()]],
[
[new motor.Action(0, motor.MotorState.POWER, 1000, motor.MotorState.POWER, -1000, undefined)],
[new ack.Acknowledgement()]
],
);

await hedgehog.moveRelativePosition(0, 1000, -1000);
});

it('`moveAbsolutePosition` should work', async () => {
mock_server(
[[new motor.Action(0, motor.MotorState.POWER, 1000, motor.MotorState.POWER, undefined, -1000)], [new ack.Acknowledgement()]],
[
[new motor.Action(0, motor.MotorState.POWER, 1000, motor.MotorState.POWER, undefined, -1000)],
[new ack.Acknowledgement()]
],
);

await hedgehog.moveAbsolutePosition(0, 1000, -1000);
});

it('`getMotorCommand` should work', async () => {
mock_server(
[[new motor.CommandRequest(0)], [new motor.CommandReply(0, {kind: motor.ConfigKind.DC}, motor.MotorState.POWER, 1000)]],
[
[new motor.CommandRequest(0)],
[new motor.CommandReply(0, {kind: motor.ConfigKind.DC}, motor.MotorState.POWER, 1000)]
],
);

assert.deepStrictEqual(await hedgehog.getMotorCommand(0), [motor.MotorState.POWER, 1000]);
Expand Down
12 changes: 9 additions & 3 deletions test/protocol.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import "@babel/polyfill";

import * as assert from 'assert';

import { hedgehog_pb, ack_pb, version_pb, emergency_pb, imu_pb, io_pb, motor_pb, servo_pb, process_pb, speaker_pb,
subscription_pb } from '../hedgehog/protocol/proto';
import { protocol, Message, ack, version, emergency, imu, io, analog, digital, motor, servo, process, speaker } from "../hedgehog";
import {
hedgehog_pb,
ack_pb, version_pb, emergency_pb, imu_pb, io_pb, motor_pb, servo_pb, process_pb, speaker_pb,
subscription_pb,
} from '../hedgehog/protocol/proto';
import {
protocol, Message,
ack, version, emergency, imu, io, analog, digital, motor, servo, process, speaker,
} from "../hedgehog";
import { ProtoContainerMessage } from "../hedgehog/utils/protobuf";

describe('Protocol', () => {
Expand Down

0 comments on commit 9cde63a

Please sign in to comment.