@@ 102-130 (lines=29) @@ | ||
99 | .and.with.a.string(stdout) |
|
100 | .and.with.a.string(stderr); |
|
101 | }) |
|
102 | it(`should reject when frames are arriving but score is 0`, function() { |
|
103 | let subinfo = `Success: Mars Lander landed hard but Opportunity is ok!`; |
|
104 | let infos = `¤GREEN¤${subinfo}§GREEN§\nX=2500m, Y=1167m, HSpeed=0m/s VSpeed=-47m/s\nFuel=456l, Angle=0°, Power=4 (4.0m/s2)\n`; |
|
105 | let stdout = `0 0`; |
|
106 | let stderr = `debug information`; |
|
107 | let view = ` 0\n7000 3000 3.711 1.0 1.0 1 0 4 -90 90\n20 40 10 20 DIRECT 15 1\n7\n0 100\n1000 500\n1500 1500\n3000 1000\n4000 150\n5500 150\n6999 800\n2500 2700 0 0 550 0 0\n`; |
|
108 | let response = { |
|
109 | "success": { |
|
110 | "frames": [{ |
|
111 | "gameInformation": infos, |
|
112 | "stdout": stdout, |
|
113 | "stderr": stderr, |
|
114 | "view": view, |
|
115 | "keyframe": true |
|
116 | }], |
|
117 | "gameId": 154447808, |
|
118 | "scores": [ 0 ], |
|
119 | "metadata": { |
|
120 | "fuel": 0 |
|
121 | } |
|
122 | } |
|
123 | }; |
|
124 | let parse = cgparse.parse(response); |
|
125 | return expect(parse).to.be.rejected |
|
126 | .and.to.eventually.have.a.property(`message`) |
|
127 | .with.string(subinfo) |
|
128 | .and.with.a.string(stdout) |
|
129 | .and.with.a.string(stderr); |
|
130 | }) |
|
131 | it(`should reject when bundle cannot compile`, function() { |
|
132 | let message = `SyntaxError: EOL while scanning string literal`; |
|
133 | let stacktrace = [{ |
|
@@ 75-101 (lines=27) @@ | ||
72 | return expect(parse).to.be.rejected |
|
73 | .and.to.eventually.be.an.instanceof(Error); |
|
74 | }); |
|
75 | it(`should resolve with last information when frames are arriving`, function() { |
|
76 | let infos = `Landing phase starting\nX=2500m, Y=2700m, HSpeed=0m/s VSpeed=0m/s\nFuel=550l, Angle=0°, Power=0 (0.0m/s2)\n`; |
|
77 | let stdout = `0 0`; |
|
78 | let stderr = `debug information`; |
|
79 | let view = ` 0\n7000 3000 3.711 1.0 1.0 1 0 4 -90 90\n20 40 10 20 DIRECT 15 1\n7\n0 100\n1000 500\n1500 1500\n3000 1000\n4000 150\n5500 150\n6999 800\n2500 2700 0 0 550 0 0\n`; |
|
80 | let response = { |
|
81 | "success": { |
|
82 | "frames": [{ |
|
83 | "gameInformation": infos, |
|
84 | "stdout": stdout, |
|
85 | "stderr": stderr, |
|
86 | "view": view, |
|
87 | "keyframe": true |
|
88 | }], |
|
89 | "gameId": 154447808, |
|
90 | "scores": [ 1 ], |
|
91 | "metadata": { |
|
92 | "fuel": 0 |
|
93 | } |
|
94 | } |
|
95 | }; |
|
96 | let parse = cgparse.parse(response); |
|
97 | return expect(parse).to.be.fulfilled |
|
98 | .and.to.eventually.be.with.a.string(infos.trim()) |
|
99 | .and.with.a.string(stdout) |
|
100 | .and.with.a.string(stderr); |
|
101 | }) |
|
102 | it(`should reject when frames are arriving but score is 0`, function() { |
|
103 | let subinfo = `Success: Mars Lander landed hard but Opportunity is ok!`; |
|
104 | let infos = `¤GREEN¤${subinfo}§GREEN§\nX=2500m, Y=1167m, HSpeed=0m/s VSpeed=-47m/s\nFuel=456l, Angle=0°, Power=4 (4.0m/s2)\n`; |