Skip to content

Commit

Permalink
optimize unit test for router (#9329)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw authored Aug 28, 2022
1 parent 6ce364a commit 2967eb5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spec/01-unit/08-router_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ local function reload_router(flavor)
end

local function new_router(cases)
-- add fields expression/priority
for _, v in ipairs(cases) do
local r = v.route
-- add fields expression/priority only for flavor expressions
if kong.configuration.router_flavor == "expressions" then
for _, v in ipairs(cases) do
local r = v.route

r.expression = r.expression or atc_compat._get_atc(r)
r.priority = r.priority or atc_compat._route_priority(r)
r.expression = r.expression or atc_compat._get_atc(r)
r.priority = r.priority or atc_compat._route_priority(r)
end
end

return Router.new(cases)
Expand Down

0 comments on commit 2967eb5

Please sign in to comment.