Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
chobits committed Jan 23, 2025
1 parent 8e17d88 commit 59ff903
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions spec/01-unit/19-hybrid/04-validate_deltas_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ describe("[delta validations]",function()
end
end)

it("route has no required field", function()
local bp = setup_bp()

-- add entities
db_insert(bp, "workspaces", { name = "ws-001" })
local service = db_insert(bp, "services", { name = "service-001", })
db_insert(bp, "routes", {
name = "route-001",
paths = { "/mock" },
service = { id = service.id },
})

local deltas = declarative.export_config_sync()

for _, delta in ipairs(deltas) do
if delta.type == "routes" then
delta.entity.protocols = nil
break
end
end

local ok, err = validate_deltas(deltas)
assert.is_true(ok, "validate should not fail: " .. tostring(err))
end)

it("route has unknown field", function()
local bp = setup_bp()

Expand Down

0 comments on commit 59ff903

Please sign in to comment.