Skip to content

Commit b940eb6

Browse files
committed
refactor: rework how nock is setup and used to harden tests
1 parent 6b03882 commit b940eb6

6 files changed

Lines changed: 133 additions & 412 deletions

File tree

tests/apiExecutor.test.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@ describe("OpenFgaClient.executeApiRequest", () => {
1616
credentials: { method: CredentialsMethod.None }
1717
};
1818

19-
beforeAll(() => {
20-
nock.restore();
21-
nock.cleanAll();
22-
nock.activate();
23-
nock.disableNetConnect();
24-
});
25-
26-
afterEach(() => {
27-
nock.cleanAll();
28-
});
29-
30-
afterAll(() => {
31-
nock.restore();
32-
});
33-
3419
describe("GET requests", () => {
3520
it("should make GET requests successfully", async () => {
3621
const fgaClient = new OpenFgaClient(testConfig);
@@ -337,21 +322,6 @@ describe("OpenFgaClient.executeApiRequest - path parameters", () => {
337322
credentials: { method: CredentialsMethod.None }
338323
};
339324

340-
beforeAll(() => {
341-
nock.restore();
342-
nock.cleanAll();
343-
nock.activate();
344-
nock.disableNetConnect();
345-
});
346-
347-
afterEach(() => {
348-
nock.cleanAll();
349-
});
350-
351-
afterAll(() => {
352-
nock.restore();
353-
});
354-
355325
describe("path parameter replacement", () => {
356326
it("should replace path parameters with values (single_parameter)", async () => {
357327
const fgaClient = new OpenFgaClient(testConfig);

0 commit comments

Comments
 (0)