DEV: Update linting config and run gjs-codemod (#376)

This commit is contained in:
Jarek Radosz
2025-06-05 11:36:14 +01:00
committed by GitHub
parent 5a2bfcebff
commit 85b485e1bf
65 changed files with 1593 additions and 1342 deletions
@@ -1,7 +1,7 @@
import { fillIn, render } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import ExplorerSchema from "discourse/plugins/discourse-data-explorer/discourse/components/explorer-schema";
const schema = {
posts: [
@@ -40,18 +40,23 @@ module("Data Explorer Plugin | Component | explorer-schema", function (hooks) {
setupRenderingTest(hooks);
test("will automatically convert to lowercase", async function (assert) {
const self = this;
this.setProperties({
schema,
hideSchema: false,
updateHideSchema: () => {},
});
await render(hbs`
<ExplorerSchema
@schema={{this.schema}}
@hideSchema={{this.hideSchema}}
@updateHideSchema={{this.updateHideSchema}}
/>`);
await render(
<template>
<ExplorerSchema
@schema={{self.schema}}
@hideSchema={{self.hideSchema}}
@updateHideSchema={{self.updateHideSchema}}
/>
</template>
);
await fillIn(`.schema-search input`, "Cat");
@@ -1,10 +1,11 @@
import { fillIn, render } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import formKit from "discourse/tests/helpers/form-kit-helper";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { ERRORS } from "discourse/plugins/discourse-data-explorer/discourse/components/param-input-form";
import ParamInputForm, {
ERRORS,
} from "discourse/plugins/discourse-data-explorer/discourse/components/param-input-form";
const InputTestCases = [
{
@@ -170,6 +171,8 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
}
test(testName.join(" "), async function (assert) {
const self = this;
this.setProperties({
param_info: [
{
@@ -188,13 +191,16 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
},
});
await render(hbs`
<ParamInputForm
@hasParams=true
@initialValues={{this.initialValues}}
@paramInfo={{this.param_info}}
@onRegisterApi={{this.onRegisterApi}}
/>`);
await render(
<template>
<ParamInputForm
@hasParams="true"
@initialValues={{self.initialValues}}
@paramInfo={{self.param_info}}
@onRegisterApi={{self.onRegisterApi}}
/>
</template>
);
await this.allNormalized;
@@ -245,6 +251,8 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
}
test("empty form will reject submit", async function (assert) {
const self = this;
this.setProperties({
param_info: [
{
@@ -260,12 +268,15 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
},
});
await render(hbs`
<ParamInputForm
@initialValues={{this.initialValues}}
@paramInfo={{this.param_info}}
@onRegisterApi={{this.onRegisterApi}}
/>`);
await render(
<template>
<ParamInputForm
@initialValues={{self.initialValues}}
@paramInfo={{self.param_info}}
@onRegisterApi={{self.onRegisterApi}}
/>
</template>
);
assert.rejects(this.submit());
@@ -277,6 +288,8 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
});
test("async normalization", async function (assert) {
const self = this;
this.setProperties({
param_info: [
{
@@ -292,12 +305,15 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
},
});
await render(hbs`
<ParamInputForm
@initialValues={{this.initialValues}}
@paramInfo={{this.param_info}}
@onRegisterApi={{this.onRegisterApi}}
/>`);
await render(
<template>
<ParamInputForm
@initialValues={{self.initialValues}}
@paramInfo={{self.param_info}}
@onRegisterApi={{self.onRegisterApi}}
/>
</template>
);
await this.paramInputApi.allNormalized;
@@ -307,6 +323,8 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
});
test("show error message when default value is invalid", async function (assert) {
const self = this;
this.setProperties({
param_info: [
{
@@ -320,12 +338,15 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
onRegisterApi: () => {},
});
await render(hbs`
<ParamInputForm
@initialValues={{this.initialValues}}
@paramInfo={{this.param_info}}
@onRegisterApi={{this.onRegisterApi}}
/>`);
await render(
<template>
<ParamInputForm
@initialValues={{self.initialValues}}
@paramInfo={{self.param_info}}
@onRegisterApi={{self.onRegisterApi}}
/>
</template>
);
assert
.form()
@@ -334,6 +355,8 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
});
test("date, time, datetime with initial value in other formats", async function (assert) {
const self = this;
this.setProperties({
param_info: [
{
@@ -365,12 +388,15 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
},
});
await render(hbs`
<ParamInputForm
@initialValues={{this.initialValues}}
@paramInfo={{this.param_info}}
@onRegisterApi={{this.onRegisterApi}}
/>`);
await render(
<template>
<ParamInputForm
@initialValues={{self.initialValues}}
@paramInfo={{self.param_info}}
@onRegisterApi={{self.onRegisterApi}}
/>
</template>
);
this.submit().then((res) => {
assert.deepEqual(res, {