Skip to content
Snippets Groups Projects
Commit 107244cf authored by Sameer Al-Sakran's avatar Sameer Al-Sakran
Browse files

this should fix the created_at special type error

parent 07ac9305
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,9 @@ import SelectButton from "metabase/components/SelectButton"; ...@@ -45,6 +45,9 @@ import SelectButton from "metabase/components/SelectButton";
import ButtonWithStatus from "metabase/components/ButtonWithStatus"; import ButtonWithStatus from "metabase/components/ButtonWithStatus";
import { getMetadata } from "metabase/selectors/metadata"; import { getMetadata } from "metabase/selectors/metadata";
// To undo changes
import { MetabaseApi } from "metabase/services";
const getRawFieldWithId = (store, fieldId) => const getRawFieldWithId = (store, fieldId) =>
store.getState().metadata.fields[fieldId]; store.getState().metadata.fields[fieldId];
...@@ -189,6 +192,9 @@ describe("FieldApp", () => { ...@@ -189,6 +192,9 @@ describe("FieldApp", () => {
const { store, fieldApp } = await initFieldApp({ const { store, fieldApp } = await initFieldApp({
fieldId: CREATED_AT_ID, fieldId: CREATED_AT_ID,
}); });
const originalSpecialType = getRawFieldWithId(store, CREATED_AT_ID)
.special_type;
const picker = fieldApp.find(SpecialTypeAndTargetPicker); const picker = fieldApp.find(SpecialTypeAndTargetPicker);
const typeSelect = picker.find(Select).at(0); const typeSelect = picker.find(Select).at(0);
click(typeSelect); click(typeSelect);
...@@ -203,6 +209,14 @@ describe("FieldApp", () => { ...@@ -203,6 +209,14 @@ describe("FieldApp", () => {
await store.waitForActions([UPDATE_FIELD]); await store.waitForActions([UPDATE_FIELD]);
expect(picker.text()).toMatch(/Select a special type/); expect(picker.text()).toMatch(/Select a special type/);
// clean up after ourselves
const newSpecialType = getRawFieldWithId(store, CREATED_AT_ID)
.special_type;
MetabaseApi.field_update({
id: CREATED_AT_ID,
special_type: originalSpecialType,
});
}); });
it("lets you change the type to 'Number'", async () => { it("lets you change the type to 'Number'", async () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment