Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
986 B

import {
searchAllComponents,
getExactComponent,
getAncestorProps,
} from "../src/components/userInterface/pagesParsing/searchComponents"
import { componentsAndScreens } from "./testData"
describe("getExactComponent", () => {
it("should get component by name", () => {
const { components } = componentsAndScreens()
const result = getExactComponent(
components,
"TextBox"
)
expect(result).toBeDefined()
expect(result._instanceName).toBe("TextBox")
})
test("Should not find as isScreen is not specified", () => {
const { screens } = componentsAndScreens()
const result = getExactComponent(screens, "SmallTextbox")
expect(result).not.toBeDefined()
})
test("Should find as isScreen is specified", () => {
const { screens } = componentsAndScreens()
const result = getExactComponent(screens, "SmallTextbox", true)
expect(result).toBeDefined()
expect(result.props._instanceName).toBe("SmallTextbox")
})
})