Skip to content

Commit 2b79fc8

Browse files
committed
style: autoformatter
1 parent 72f5837 commit 2b79fc8

File tree

1 file changed

+56
-53
lines changed

1 file changed

+56
-53
lines changed

test/integration.test.ts

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readFileSync } from "node:fs";
22
import { describe, it, before } from "node:test";
33
import assert from "node:assert";
4-
import semver from 'semver'
4+
import semver from "semver";
55

66
import { GenericContainer } from "testcontainers";
77
import createClient from "openapi-fetch";
@@ -15,7 +15,7 @@ import { AnyValidateFunction } from "ajv/dist/core.js";
1515
const Ajv = _Ajv.default;
1616
const addFormats = _addFormats.default;
1717

18-
const ZT_VERSION = process.env.ZT_VERSION || "1.12.2"
18+
const ZT_VERSION = process.env.ZT_VERSION || "1.12.2";
1919

2020
function createCreateClient(token: string, port: number) {
2121
const authToken = token;
@@ -57,7 +57,7 @@ function assertValid(
5757

5858
const ZEROTIER_API_SECRET = "asdf";
5959

60-
describe("API exercise", async function() {
60+
describe("API exercise", async function () {
6161
let network_id: string;
6262
const node_id = "1122334455";
6363
let container;
@@ -81,7 +81,7 @@ describe("API exercise", async function() {
8181
client = createCreateClient(ZEROTIER_API_SECRET, apiPort);
8282
});
8383

84-
describe("GET endpoints", async function() {
84+
describe("GET endpoints", async function () {
8585
const map: { path: PathsWithMethod<paths, "get">; id: string }[] = [
8686
{ path: "/status", id: "NodeStatus" },
8787
{ path: "/controller", id: "ControllerStatus" },
@@ -227,64 +227,67 @@ describe("API exercise", async function() {
227227
});
228228
});
229229

230-
describe("Unstable APIs", { skip: semver.lte(ZT_VERSION, "1.12.2") }, async () => {
231-
it("Sets the member name", async () => {
232-
const { data } = await client.POST(
233-
"/controller/network/{network_id}/member/{node_id}",
234-
{
235-
params: { path: { network_id, node_id } },
236-
body: { authorized: true, name: "bob" },
237-
},
238-
);
239-
assert(data);
240-
241-
const validator = createValidator("ControllerNetworkMember");
242-
assertValid(validator, data);
243-
});
244-
245-
it("Lists full networks", async () => {
246-
const { data } = await client.GET("/unstable/controller/network");
247-
assert(data);
230+
describe(
231+
"Unstable APIs",
232+
{ skip: semver.lte(ZT_VERSION, "1.12.2") },
233+
async () => {
234+
it("Sets the member name", async () => {
235+
const { data } = await client.POST(
236+
"/controller/network/{network_id}/member/{node_id}",
237+
{
238+
params: { path: { network_id, node_id } },
239+
body: { authorized: true, name: "bob" },
240+
},
241+
);
242+
assert(data);
243+
244+
const validator = createValidator("ControllerNetworkMember");
245+
assertValid(validator, data);
246+
});
248247

249-
const networksValidator = createValidator("ControllerNetworks");
248+
it("Lists full networks", async () => {
249+
const { data } = await client.GET("/unstable/controller/network");
250+
assert(data);
250251

251-
assertValid(networksValidator, data);
252-
});
252+
const networksValidator = createValidator("ControllerNetworks");
253253

254-
it("Lists full network members", async () => {
255-
const { data } = await client.GET(
256-
"/unstable/controller/network/{network_id}/member",
257-
{ params: { path: { network_id } } },
258-
);
259-
assert(data);
254+
assertValid(networksValidator, data);
255+
});
260256

261-
const networksValidator = createValidator(
262-
"ControllerNetworkMemberListFull",
263-
);
257+
it("Lists full network members", async () => {
258+
const { data } = await client.GET(
259+
"/unstable/controller/network/{network_id}/member",
260+
{ params: { path: { network_id } } },
261+
);
262+
assert(data);
264263

265-
assertValid(networksValidator, data);
266-
});
264+
const networksValidator = createValidator(
265+
"ControllerNetworkMemberListFull",
266+
);
267267

268-
it("Gets the member name", async () => {
269-
const { data } = await client.GET(
270-
"/controller/network/{network_id}/member/{node_id}",
271-
{
272-
params: { path: { network_id, node_id } },
273-
},
274-
);
275-
assert(data);
276-
assert.equal("bob", data.name);
268+
assertValid(networksValidator, data);
269+
});
277270

278-
const validator = createValidator("ControllerNetworkMember");
279-
assertValid(validator, data);
280-
});
281-
});
271+
it("Gets the member name", async () => {
272+
const { data } = await client.GET(
273+
"/controller/network/{network_id}/member/{node_id}",
274+
{
275+
params: { path: { network_id, node_id } },
276+
},
277+
);
278+
assert(data);
279+
assert.equal("bob", data.name);
280+
281+
const validator = createValidator("ControllerNetworkMember");
282+
assertValid(validator, data);
283+
});
284+
},
285+
);
282286

283287
it("Deletes the network by ID", async () => {
284-
const { data } = await client.DELETE(
285-
"/controller/network/{network_id}",
286-
{ params: { path: { network_id } } },
287-
);
288+
const { data } = await client.DELETE("/controller/network/{network_id}", {
289+
params: { path: { network_id } },
290+
});
288291
const networkDelValidator = createValidator("ControllerNetwork");
289292
assertValid(networkDelValidator, data);
290293
});

0 commit comments

Comments
 (0)