Skip to content

Commit

Permalink
tests: call agent.stop and agent.destroy for all createAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed May 11, 2021
1 parent 376dea9 commit 4c57048
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/runify.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ hosts.forEach(function (record) {
});
const result = await agent.evalScript(source);
expect(result.stdout.trim()).toBe("true");

await agent.stop();
await agent.destroy();
});
});

Expand Down Expand Up @@ -850,11 +853,12 @@ hosts.forEach(function (record) {
agent = await eshost.createAgent(type, options);
});

afterEach(() => {
afterEach(async () => {
jest.setTimeout(5_000);
records.length = 0;
if (agent) {
agent.destroy();
await agent.stop();
await agent.destroy();
}
});

Expand Down Expand Up @@ -893,7 +897,8 @@ hosts.forEach(function (record) {
const result = await agent.evalScript("print(typeof $testing)");
expect(result.error).toBe(null);
expect(result.stdout.trim()).toMatchInlineSnapshot(`"object"`);
agent.destroy();
await agent.stop();
await agent.destroy();
});
});

Expand All @@ -911,6 +916,9 @@ hosts.forEach(function (record) {
"2
"
`);

await agent.stop();
await agent.destroy();
});
});

Expand All @@ -923,7 +931,9 @@ hosts.forEach(function (record) {
const result = await agent.evalScript("print(typeof $262.IsHTMLDDA);");
expect(result.error === null).toBeTruthy();
expect(result.stdout.indexOf("function")).toBe(0);
agent.destroy();

await agent.stop();
await agent.destroy();
});
});
});
Expand Down

0 comments on commit 4c57048

Please sign in to comment.