Fix assertions in ControlLoopService test 62/126862/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Mon, 31 Jan 2022 12:05:36 +0000 (12:05 +0000)
committerDaniel Hanrahan <daniel.hanrahan@est.tech>
Mon, 31 Jan 2022 12:20:19 +0000 (12:20 +0000)
Fix assertion lines to check response status value.
Wrap responses in beforeEach so async calls are resolved before
assertions.

Issue-ID: POLICY-3351
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: If540831367a7e359739b9675a2800b426b3e7f20

gui-clamp/ui-react/src/api/ControlLoopService.test.js

index a460225..47fef71 100644 (file)
@@ -28,9 +28,11 @@ describe("Verify GetControlLoopInstantiation", () => {
       ok: true,
     })
   );
-  response = ControlLoopService.getControlLoopInstantiation(name, template);
+  beforeEach(async () => {
+    response = await ControlLoopService.getControlLoopInstantiation(name, template);
+  });
   it("Test getControlLoopInstantiation", () => {
-    expect(response.status).toEqual(response.status);
+    expect(response.status).toEqual("Success");
   });
 });
 describe("Verify DeleteInstantiation", () => {
@@ -43,8 +45,10 @@ describe("Verify DeleteInstantiation", () => {
       ok: true,
     })
   );
-  response = ControlLoopService.deleteInstantiation(name, version);
+  beforeEach(async () => {
+    response = await ControlLoopService.deleteInstantiation(name, version);
+  });
   it("Test deleteInstantiation", () => {
-    expect(response.status).toEqual(response.status);
+    expect(response.status).toEqual("Success");
   });
 });