trackler 2.2.1.154 → 2.2.1.155

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 891cfc46c3753f1097f043124ad3d933b970024b
4
- data.tar.gz: f77a21a3997e6167c19f64eace521749c90a8397
3
+ metadata.gz: 13a1a8a03a329b636cf83ebd78d896e2756b1281
4
+ data.tar.gz: 9a361980610d8be7d89a029ac726db23790694ee
5
5
  SHA512:
6
- metadata.gz: 0e47f625db64fa5a520715350120cf821dff4e07df8a6d640daf4c21cba9bcd21545a5a9ae6f33599aea4bd2413c2a4afc0ec2afd21fed91f1ffb048e3cf3f14
7
- data.tar.gz: 05c5ed9423ef4bb614a0476f8888ffefb753422189a6ae0a91ce0809994473dbea666cb39c8a9a6bab94af00a03479a0685fc65157e0ffaaf9db2a179dd44abe
6
+ metadata.gz: '058d36c01fb55f20184bc1b494f35965b889a662ba630be8e3cea926ec1a730c43359c1d7a66c67f7b8f9d87f49d48bc2f23b0f3494acbf41da8e3d97619efd0'
7
+ data.tar.gz: e2b61bc234a7c607d8f4336fdfb2754035a07e1f0f8c3735940a11d1876734d0a2fea984108d6e618a01f45cd4298b88aa9e934ff5c2aab493d5e30e0e722cfa
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.154"
2
+ VERSION = "2.2.1.155"
3
3
  end
@@ -1,3 +1,10 @@
1
+ export class InvalidInputError extends Error {
2
+ constructor(message) {
3
+ super();
4
+ this.message = message || 'Invalid Input';
5
+ }
6
+ }
7
+
1
8
  class Robot {
2
9
  constructor() {
3
10
  this.coordinates = [0, 0];
@@ -9,6 +16,11 @@ class Robot {
9
16
  }
10
17
 
11
18
  orient(direction) {
19
+ const validDirections = ['north', 'south', 'east', 'west'];
20
+ if (!validDirections.includes(direction)) {
21
+ throw new InvalidInputError('Invalid Robot Bearing');
22
+ }
23
+
12
24
  this.bearing = direction;
13
25
  return `The robot is pointed ${direction}`;
14
26
  }
@@ -1,4 +1,5 @@
1
1
  import Robot from './robot-simulator';
2
+ import { InvalidInputError } from './robot-simulator';
2
3
 
3
4
  describe('Robot', () => {
4
5
  const robot = new Robot();
@@ -13,11 +14,8 @@ describe('Robot', () => {
13
14
  });
14
15
 
15
16
  xtest('invalid robot bearing', () => {
16
- try {
17
- robot.orient('crood');
18
- } catch (exception) {
19
- expect(exception).toEqual('Invalid Robot Bearing');
20
- }
17
+ expect(InvalidInputError.prototype).toBeInstanceOf(Error);
18
+ expect(() => robot.orient('crood')).toThrow(InvalidInputError);
21
19
  });
22
20
 
23
21
  xtest('turn right from north', () => {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.154
4
+ version: 2.2.1.155
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-01 00:00:00.000000000 Z
11
+ date: 2018-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip