Skip to content

Commit e5dd1d1

Browse files
committed
oxlint
1 parent 87837d5 commit e5dd1d1

25 files changed

Lines changed: 276 additions & 259 deletions

.oxlintrc.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,23 @@
2525
"eslint/id-length": [
2626
"error",
2727
{
28-
"exceptions": ["x", "y", "z", "i", "j", "k", "id", "ID", "fs", "os", "_"],
28+
"exceptions": [
29+
"x",
30+
"y",
31+
"z",
32+
"i",
33+
"j",
34+
"k",
35+
"r",
36+
"g",
37+
"b",
38+
"a",
39+
"id",
40+
"ID",
41+
"fs",
42+
"os",
43+
"_"
44+
],
2945
"min": 3
3046
}
3147
],
@@ -124,7 +140,8 @@
124140
"vitest/prefer-to-be-falsy": "off",
125141
"vitest/require-test-timeout": "warn",
126142
"vitest/prefer-importing-vitest-globals": "off",
127-
"jest/consistent-test-it": ["error", { "fn": "test", "withinDescribe": "test" }]
143+
"jest/consistent-test-it": ["error", { "fn": "test", "withinDescribe": "test" }],
144+
"vitest/prefer-spy-on": "off"
128145
}
129146
},
130147
{

tests/integration/stores/viewer.nuxt.test.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ const CONNECT_TIMEOUT = 25_000;
1515

1616
let projectFolderPath = "";
1717

18-
beforeAll(async () => {
19-
setupActivePinia();
20-
({ projectFolderPath } = await runMicroservices());
21-
});
18+
describe("viewer Store", () => {
19+
beforeAll(async () => {
20+
setupActivePinia();
21+
({ projectFolderPath } = await runMicroservices());
22+
});
2223

23-
afterAll(async () => {
24-
await cleanupBackend(projectFolderPath);
25-
});
24+
afterAll(async () => {
25+
await cleanupBackend(projectFolderPath);
26+
});
2627

27-
describe("Viewer Store", () => {
2828
describe("actions", () => {
2929
describe("ws_connect", () => {
3030
test(
@@ -52,15 +52,13 @@ describe("Viewer Store", () => {
5252
describe("request", () => {
5353
test(
5454
"request",
55-
() => {
55+
async () => {
5656
const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.viewer.render;
5757
const viewerStore = useViewerStore();
5858
const timeout = 1;
5959
const params = {};
60-
expect(() =>
61-
viewerStore
62-
.request(schema, params, {}, timeout)
63-
.rejects.toThrow(`${schema.$id}: Timed out after ${timeout}ms, ${schema} ${params}`),
60+
await expect(viewerStore.request(schema, params, {}, timeout)).rejects.toThrow(
61+
`${schema.$id}: Timed out after ${timeout}ms, ${schema} ${params}`,
6462
);
6563
},
6664
CONNECT_TIMEOUT,

tests/unit/components/CrsSelector.nuxt.test.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ const FIRST_INDEX = 0;
1313
let pinia = undefined;
1414
let geodeStore = undefined;
1515

16-
beforeEach(() => {
17-
pinia = setupActivePinia();
18-
geodeStore = useGeodeStore();
19-
geodeStore.base_url = "";
20-
});
16+
describe("crs selector", () => {
17+
beforeEach(() => {
18+
pinia = setupActivePinia();
19+
geodeStore = useGeodeStore();
20+
geodeStore.base_url = "";
21+
});
2122

22-
describe(CrsSelector, () => {
23-
test(`Default behavior`, async () => {
23+
test("default behavior", async () => {
2424
const crs_list = [
2525
{
2626
authority: "EPSG",
@@ -31,9 +31,7 @@ describe(CrsSelector, () => {
3131

3232
// Mock geodeStore.request instead of registerEndpoint
3333
geodeStore.request = vi.fn((schema, params, callbacks) => {
34-
if (callbacks?.response_function) {
35-
callbacks.response_function({ crs_list });
36-
}
34+
callbacks.response_function({ crs_list });
3735
return Promise.resolve({ crs_list });
3836
});
3937

@@ -50,7 +48,7 @@ describe(CrsSelector, () => {
5048
await input.trigger("click");
5149
expect(wrapper.emitted()).toHaveProperty("update_values");
5250
expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH);
53-
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
51+
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toStrictEqual({
5452
[key_to_update]: crs_list[FIRST_INDEX],
5553
});
5654
});

tests/unit/components/ExtensionSelector.nuxt.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ const schema = schemas.opengeodeweb_back.geode_objects_and_output_extensions;
1919
const pinia = setupActivePinia();
2020
const geodeStore = useGeodeStore();
2121

22-
beforeEach(() => {
23-
geodeStore.base_url = "";
22+
describe("extension selector", () => {
23+
beforeEach(() => {
24+
geodeStore.base_url = "";
2425

25-
geodeStore.request = vi.fn(() => {
26-
const response = {
27-
geode_objects_and_output_extensions: {
28-
BRep: { msh: { is_saveable: true } },
29-
},
30-
};
31-
return Promise.resolve(response);
26+
geodeStore.request = vi.fn(() => {
27+
const response = {
28+
geode_objects_and_output_extensions: {
29+
BRep: { msh: { is_saveable: true } },
30+
},
31+
};
32+
return Promise.resolve(response);
33+
});
3234
});
33-
});
3435

35-
describe(ExtensionSelector, () => {
36-
test(`Select geode_object & extension`, async () => {
36+
test("select geode_object & extension", async () => {
3737
const output_geode_object = "BRep";
3838
const output_extension = "msh";
3939

tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import { useFeedbackStore } from "@ogw_front/stores/feedback";
99

1010
const CALLED_TIMES = 1;
1111

12-
describe(FeedBackErrorBanner, () => {
12+
describe("feedback error banner", () => {
1313
const pinia = setupActivePinia();
14-
test(`Test reload`, async () => {
14+
15+
test("reload", async () => {
1516
const wrapper = mount(FeedBackErrorBanner, {
1617
global: {
1718
plugins: [vuetify, pinia],
@@ -26,7 +27,7 @@ describe(FeedBackErrorBanner, () => {
2627
expect(reload_spy).toHaveBeenCalledTimes(CALLED_TIMES);
2728
});
2829

29-
test(`Test delete error`, async () => {
30+
test("delete error", async () => {
3031
const wrapper = mount(FeedBackErrorBanner, {
3132
global: {
3233
plugins: [vuetify, pinia],

tests/unit/components/FeedBack/Snackers.nuxt.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { useFeedbackStore } from "@ogw_front/stores/feedback";
1010

1111
vi.stubGlobal("visualViewport", new EventTarget());
1212

13-
describe(FeedBackSnackers, () => {
14-
test(`Test delete error`, async () => {
13+
describe("feedback snackers", () => {
14+
test("delete feedback", async () => {
1515
const pinia = setupActivePinia();
1616
const feedbackStore = useFeedbackStore();
1717
feedbackStore.$patch({
@@ -41,9 +41,9 @@ describe(FeedBackSnackers, () => {
4141
},
4242
);
4343

44-
expect(feedbackStore.feedbacks.length).toBe(1);
44+
expect(feedbackStore.feedbacks).toHaveLength(1);
4545
const v_btn = await wrapper.findComponent(components.VBtn);
4646
await v_btn.trigger("click");
47-
expect(feedbackStore.feedbacks.length).toBe(0);
47+
expect(feedbackStore.feedbacks).toHaveLength(0);
4848
});
4949
});

tests/unit/components/FileSelector.nuxt.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const SECOND_INDEX = 1;
1818
const allowed_files_schema = schemas.opengeodeweb_back.allowed_files;
1919
const upload_file_schema = schemas.opengeodeweb_back.upload_file;
2020

21-
describe(FileSelector, () => {
21+
describe("file selector", () => {
2222
const pinia = setupActivePinia();
2323
const geodeStore = useGeodeStore();
2424
geodeStore.base_url = "";
2525

26-
test(`Select file`, async () => {
26+
test("select file", async () => {
2727
registerEndpoint(allowed_files_schema.$id, {
2828
method: allowed_files_schema.methods[FIRST_INDEX],
2929
handler: () => ({
@@ -58,13 +58,13 @@ describe(FileSelector, () => {
5858
await flushPromises();
5959
expect(wrapper.emitted()).toHaveProperty("update_values");
6060
expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH);
61-
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
61+
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toStrictEqual({
6262
files,
6363
auto_upload,
6464
});
6565
});
6666

67-
describe(FileSelector, () => {
67+
describe("file selector", () => {
6868
registerEndpoint(allowed_files_schema.$id, {
6969
method: allowed_files_schema.methods[FIRST_INDEX],
7070
handler: () => ({
@@ -76,8 +76,8 @@ describe(FileSelector, () => {
7676
method: upload_file_schema.methods[SECOND_INDEX],
7777
handler: () => ({}),
7878
});
79-
8079
const files = [new File(["fake_file"], "fake_file.txt")];
80+
8181
test("auto_upload true", async () => {
8282
const wrapper = await mountSuspended(FileSelector, {
8383
global: {
@@ -91,10 +91,10 @@ describe(FileSelector, () => {
9191
});
9292

9393
await flushPromises();
94-
expect(wrapper.componentVM.files).toEqual(files);
94+
expect(wrapper.componentVM.files).toStrictEqual(files);
9595
expect(wrapper.emitted()).toHaveProperty("update_values");
9696
expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH);
97-
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
97+
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toStrictEqual({
9898
files,
9999
auto_upload: false,
100100
});
@@ -115,7 +115,7 @@ describe(FileSelector, () => {
115115
await flushPromises();
116116

117117
const file_uploader = wrapper.findComponent(FileUploader);
118-
expect(wrapper.vm.files).toEqual(files);
118+
expect(wrapper.vm.files).toStrictEqual(files);
119119
const upload_files = vi.spyOn(file_uploader.vm, "upload_files");
120120
expect(upload_files).not.toHaveBeenCalled();
121121
});

tests/unit/components/FileUploader.nuxt.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const SECOND_INDEX = 1;
1515

1616
const upload_file_schema = schemas.opengeodeweb_back.upload_file;
1717

18-
describe(FileUploader, () => {
18+
describe("file uploader", () => {
1919
const pinia = setupActivePinia();
2020
const geodeStore = useGeodeStore();
2121
geodeStore.base_url = "";
@@ -31,8 +31,8 @@ describe(FileUploader, () => {
3131

3232
const files = [new File(["fake_file"], "fake_file.txt")];
3333

34-
describe(`Upload file`, () => {
35-
test(`prop auto_upload false`, async () => {
34+
describe("upload file", () => {
35+
test("prop auto_upload false", async () => {
3636
const wrapper = await mountSuspended(FileUploader, {
3737
global: {
3838
plugins: [vuetify, pinia],
@@ -51,7 +51,7 @@ describe(FileUploader, () => {
5151
await v_btn.trigger("click");
5252
await flushPromises();
5353
await flushPromises();
54-
expect(wrapper.emitted().files_uploaded[FIRST_INDEX][FIRST_INDEX]).toEqual(files);
54+
expect(wrapper.emitted().files_uploaded[FIRST_INDEX][FIRST_INDEX]).toStrictEqual(files);
5555
});
5656

5757
test(`prop auto_upload true`, async () => {
@@ -62,7 +62,7 @@ describe(FileUploader, () => {
6262
props: { multiple: false, accept: "*.txt", files, auto_upload: true },
6363
});
6464
await flushPromises();
65-
expect(wrapper.emitted().files_uploaded[FIRST_INDEX][FIRST_INDEX]).toEqual(files);
65+
expect(wrapper.emitted().files_uploaded[FIRST_INDEX][FIRST_INDEX]).toStrictEqual(files);
6666
});
6767
});
6868
});

tests/unit/components/Inspector/InspectionButton.nuxt.test.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import { setupActivePinia, vuetify } from "@ogw_tests/utils";
99
import InspectorInspectionButton from "@ogw_front/components/Inspector/InspectionButton";
1010
import { useGeodeStore } from "@ogw_front/stores/geode";
1111

12-
describe("Inspector/InspectionButton", () => {
12+
describe("inspector inspection button", () => {
1313
const pinia = setupActivePinia();
1414
const geodeStore = useGeodeStore();
1515
geodeStore.base_url = "";
1616

17-
test(`Test with issues`, async () => {
17+
test("with issues", async () => {
1818
const inspection_result = {
1919
title: "Brep inspection",
2020
nb_issues: 3,
@@ -31,28 +31,18 @@ describe("Inspector/InspectionButton", () => {
3131
},
3232
],
3333
};
34-
35-
geodeStore.request = vi.fn((_schema, params, callbacks) => {
36-
if (callbacks?.response_function) {
37-
callbacks.response_function({
38-
inspection_result,
39-
});
40-
}
41-
return Promise.resolve({
42-
inspection_result,
43-
});
34+
geodeStore.request = vi.fn((_schema, _params, callbacks) => {
35+
callbacks?.response_function?.({ inspection_result });
36+
return Promise.resolve({ inspection_result });
4437
});
45-
4638
const geode_object_type = "BRep";
4739
const filename = "test.txt";
48-
4940
const wrapper = await mountSuspended(InspectorInspectionButton, {
5041
global: {
5142
plugins: [vuetify, pinia],
5243
},
5344
props: { geode_object_type, filename },
5445
});
55-
5646
expect(wrapper.exists()).toBe(true);
5747
const v_btn = await wrapper.findComponent(components.VBtn);
5848
await v_btn.trigger("click");

tests/unit/components/Inspector/ResultPanel.nuxt.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { mountSuspended } from "@nuxt/test-utils/runtime";
66
import InspectorResultPanel from "@ogw_front/components/Inspector/ResultPanel";
77
import { vuetify } from "@ogw_tests/utils";
88

9-
describe("Inspector/ResultPanel", () => {
10-
test(`Test with issues`, async () => {
9+
describe("inspector result panel", () => {
10+
test("with issues", async () => {
1111
const inspection_result = [
1212
{
1313
title: "Brep inspection",
@@ -33,7 +33,7 @@ describe("Inspector/ResultPanel", () => {
3333
);
3434
});
3535

36-
test(`Test without issues`, async () => {
36+
test("without issues", async () => {
3737
const inspection_result = [
3838
{
3939
title: "Brep inspection",

0 commit comments

Comments
 (0)