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.
 
 
 
 
 
 

34 lines
1.1 KiB

import { getMemoryTemplateApi } from "./specHelpers"
import { diffHierarchy } from "../src/templateApi/diffHierarchy"
import { getFlattenedHierarchy } from "../src/templateApi/hierarchy"
describe("diffHierarchy", () => {
it("should not show any changes, when hierarchy is unchanged", async () => {
const oldHierarchy = (await setup()).root;
const newHierarchy = (await setup()).root;
const diff = diffHierarchy(oldHierarchy, newHierarchy)
expect(diff).toEqual([])
})
it("should detect record created", async () => {
})
})
const setup = async () => {
const { templateApi } = await getMemoryTemplateApi()
const root = templateApi.getNewRootLevel()
const contact = templateApi.getNewRecordTemplate(root, "contact", true)
const lead = templateApi.getNewRecordTemplate(root, "lead", true)
const deal = templateApi.getNewRecordTemplate(contact, "deal", true)
getFlattenedHierarchy(root)
return {
root, contact, lead, deal,
all_contacts: root.indexes[0],
all_leads: root.indexes[1],
deals_for_contacts: contact.indexes[0]
}
}