Skip to content
Snippets Groups Projects
Commit 9851c40f authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix and simplify FieldApp.integ.spec

parent 9f15efaa
Branches
Tags
No related merge requests found
......@@ -46,8 +46,7 @@ import SelectButton from "metabase/components/SelectButton";
import ButtonWithStatus from "metabase/components/ButtonWithStatus";
import { getMetadata } from "metabase/selectors/metadata";
const getRawFieldWithId = (store, fieldId) =>
store.getState().metadata.fields[fieldId];
import { MetabaseApi } from "metabase/services";
// TODO: Should we use the metabase/lib/urls methods for constructing urls also here?
......@@ -118,17 +117,11 @@ describe("FieldApp", () => {
});
afterAll(async () => {
const store = await createTestStore();
await store.dispatch(fetchTableMetadata(1));
const createdAtField = getRawFieldWithId(store, CREATED_AT_ID);
await store.dispatch(
updateField({
...createdAtField,
display_name: staticFixtureMetadata.fields[1].display_name,
description: staticFixtureMetadata.fields[1].description,
}),
);
await MetabaseApi.field_update({
id: CREATED_AT_ID,
display_name: staticFixtureMetadata.fields[1].display_name,
description: staticFixtureMetadata.fields[1].description,
});
});
});
......@@ -166,16 +159,10 @@ describe("FieldApp", () => {
});
afterAll(async () => {
const store = await createTestStore();
await store.dispatch(fetchTableMetadata(1));
const createdAtField = getRawFieldWithId(store, CREATED_AT_ID);
await store.dispatch(
updateField({
...createdAtField,
visibility_type: "normal",
}),
);
await MetabaseApi.field_update({
id: CREATED_AT_ID,
visibility_type: "normal",
})
});
});
......@@ -264,17 +251,11 @@ describe("FieldApp", () => {
});
afterAll(async () => {
const store = await createTestStore();
await store.dispatch(fetchTableMetadata(1));
const createdAtField = getRawFieldWithId(store, CREATED_AT_ID);
await store.dispatch(
updateField({
...createdAtField,
special_type: "type/CreationTimestamp",
fk_target_field_id: null,
}),
);
await MetabaseApi.field_update({
id: CREATED_AT_ID,
special_type: "type/CreationTimestamp",
fk_target_field_id: null,
})
});
});
......@@ -287,7 +268,7 @@ describe("FieldApp", () => {
click(mappingTypePicker);
const pickerOptions = mappingTypePicker.find(Popover).find("li");
expect(pickerOptions.length).toBe(1);
expect(pickerOptions.map(o => o.text())).toEqual(["Use original value"]);
});
it("lets you change to 'Use foreign key' and change the target for field with fk", async () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment