discourse/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs
Jarek Radosz 893fcf714b
DEV: Remove plugin names from test titles (#39418)
Those are now automatically included in testem's output.
2026-04-21 19:19:52 +02:00

67 lines
1.6 KiB
Text

import { fillIn, render } from "@ember/test-helpers";
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: [
{
column_name: "id",
data_type: "serial",
primary: true,
notes: "primary key",
havetypeinfo: true,
},
{
column_name: "raw",
data_type: "text",
column_desc: "The raw Markdown that the user entered into the composer.",
havepopup: true,
havetypeinfo: true,
},
],
categories: [
{
column_name: "id",
data_type: "serial",
primary: true,
notes: "primary key",
havetypeinfo: true,
},
{
column_name: "name",
data_type: "varchar(50)",
havetypeinfo: false,
},
],
};
module("Component | explorer-schema", function (hooks) {
setupRenderingTest(hooks);
test("will automatically convert to lowercase", async function (assert) {
this.setProperties({
schema,
hideSchema: false,
updateHideSchema: () => {},
});
await render(
<template>
<ExplorerSchema
@schema={{this.schema}}
@hideSchema={{this.hideSchema}}
@updateHideSchema={{this.updateHideSchema}}
/>
</template>
);
await fillIn(`.schema-search input`, "Cat");
assert.dom(".schema-table").exists();
await fillIn(`.schema-search input`, "NotExist");
assert.dom(".schema-table").doesNotExist();
});
});