trackler 2.2.1.154 → 2.2.1.155
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13a1a8a03a329b636cf83ebd78d896e2756b1281
|
4
|
+
data.tar.gz: 9a361980610d8be7d89a029ac726db23790694ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '058d36c01fb55f20184bc1b494f35965b889a662ba630be8e3cea926ec1a730c43359c1d7a66c67f7b8f9d87f49d48bc2f23b0f3494acbf41da8e3d97619efd0'
|
7
|
+
data.tar.gz: e2b61bc234a7c607d8f4336fdfb2754035a07e1f0f8c3735940a11d1876734d0a2fea984108d6e618a01f45cd4298b88aa9e934ff5c2aab493d5e30e0e722cfa
|
data/lib/trackler/version.rb
CHANGED
@@ -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
|
-
|
17
|
-
|
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.
|
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-
|
11
|
+
date: 2018-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|