2019-12-23 12:12:58 +00:00
|
|
|
import { transformRestAction } from "transformers/RestActionTransformer";
|
|
|
|
|
import { RestAction } from "api/ActionAPI";
|
|
|
|
|
|
|
|
|
|
const input: RestAction = {
|
2020-04-23 14:57:37 +00:00
|
|
|
pageId: "",
|
|
|
|
|
pluginId: "",
|
2019-12-23 12:12:58 +00:00
|
|
|
id: "testId",
|
|
|
|
|
datasource: {
|
|
|
|
|
id: "testDataSource",
|
|
|
|
|
},
|
|
|
|
|
name: "testName",
|
|
|
|
|
pluginType: "API",
|
|
|
|
|
actionConfiguration: {
|
|
|
|
|
path: "users?page=1",
|
|
|
|
|
queryParameters: [
|
|
|
|
|
{
|
|
|
|
|
key: "page",
|
|
|
|
|
value: "1",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
jsonPathKeys: [],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const output = {
|
2020-04-23 14:57:37 +00:00
|
|
|
pageId: "",
|
|
|
|
|
pluginId: "",
|
2019-12-23 12:12:58 +00:00
|
|
|
id: "testId",
|
|
|
|
|
datasource: {
|
|
|
|
|
id: "testDataSource",
|
|
|
|
|
},
|
|
|
|
|
name: "testName",
|
|
|
|
|
pluginType: "API",
|
|
|
|
|
actionConfiguration: {
|
|
|
|
|
path: "users",
|
|
|
|
|
queryParameters: [
|
|
|
|
|
{
|
|
|
|
|
key: "page",
|
|
|
|
|
value: "1",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
jsonPathKeys: [],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
it("Transform the input", () => {
|
|
|
|
|
const result = transformRestAction(input);
|
|
|
|
|
expect(result).toEqual(output);
|
|
|
|
|
});
|