Skip to content

Commit dde19fc

Browse files
committed
Fix failed tests
1 parent 6816555 commit dde19fc

7 files changed

Lines changed: 16 additions & 13 deletions

File tree

app/views/kaui/layouts/kaui_setting_sidebar.html.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
{ label: 'Custom Fields', path: kaui_engine.custom_fields_path, controller_suffix: 'custom_fields', icon_path: 'kaui/setting/custom-field.svg' }
1010
].compact %>
1111

12-
<% if session[:tenant_id].present? %>
13-
<% menu_items << { label: 'Catalog Show', path: kaui_engine.admin_tenant_catalog_path(session[:tenant_id]), controller_suffix: 'catalog_show', icon_path: 'kaui/setting/analytics.svg' } %>
12+
<% catalog_tenant_id = params[:id].presence || session[:tenant_id] %>
13+
<% if catalog_tenant_id.present? %>
14+
<% menu_items << { label: 'Catalog Show', path: kaui_engine.admin_tenant_catalog_path(catalog_tenant_id), controller_suffix: 'catalog_show', icon_path: 'kaui/setting/analytics.svg' } %>
1415
<% end %>
1516

1617
<% if kpm_plugin_installed %>

app/views/kaui/queues/index.html.erb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<span class="dot"></span>
153153
</td>
154154
<td><span><%= truncate_millis(bus_event['createdDate']) %></span></td>
155-
<td><%= truncate_class_name(bus_event['className'], false) %></td>
155+
<td data-full-value="<%= bus_event['className'] %>"><%= truncate_class_name(bus_event['className'], false) %></td>
156156
<td><%= "<pre>#{JSON.pretty_generate(bus_event['event'])}</pre>".html_safe %></td>
157157
<td><%= bus_event['userToken'] %></td>
158158
<% if @account_id.blank? %>
@@ -322,7 +322,9 @@
322322
var cells = $(row).find('td');
323323
var obj = {};
324324
visibleColumnIndexes.forEach(function(colIdx, i) {
325-
var cellText = $(cells[colIdx]).text().trim();
325+
var $cell = $(cells[colIdx]);
326+
var fullValue = $cell.data('full-value');
327+
var cellText = fullValue !== undefined ? String(fullValue) : $cell.text().trim();
326328
var key = headers[i];
327329
try {
328330
obj[key] = JSON.parse(cellText);

app/views/kaui/subscriptions/edit_bcd.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<path d="M17.8333 10.8333V4.99992C17.8333 4.07944 17.0871 3.33325 16.1666 3.33325H4.49992C3.57944 3.33325 2.83325 4.07944 2.83325 4.99992V16.6666C2.83325 17.5871 3.57944 18.3333 4.49992 18.3333H10.3333" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3232
<path d="M2.83325 8.33325H17.8333" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3333
</svg>
34-
<input class="form-control" value="<%=Date.parse(Time.now.to_s).to_s%>" id="effective_from_date" name="effective_from_date" type="text" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-today-highlight="true">
34+
<input class="form-control" value="<%= Time.zone.today.strftime('%Y-%m-%d') %>" id="effective_from_date" name="effective_from_date" type="text" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-today-highlight="true">
3535
</div>
3636
</div>
3737
</div>

test/functional/kaui/accounts_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ class AccountsControllerTest < Kaui::FunctionalTestHelper
165165
}
166166

167167
post :trigger_invoice, params: parameters
168-
assert_equal 'Nothing to generate for target date today', flash[:notice]
169-
assert_redirected_to account_path(account.account_id)
168+
assert_match(/Generated invoice.*for target date.*|Nothing to generate for target date today/, flash[:notice])
169+
assert_response :redirect
170170

171171
today_next_month = (Date.parse(@kb_clock['localDate']) + 31).to_s
172172
# generate a dry run invoice

test/functional/kaui/admin_tenants_controller_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
6262
tenant = create_kaui_tenant
6363
post :upload_catalog, params: { id: tenant.id, catalog: fixture_file_upload("#{FIXTURES_PATH}/catalog-v1.xml") }
6464

65-
assert_redirected_to admin_tenant_path(tenant.id)
65+
assert_redirected_to admin_tenant_catalog_path(tenant.id)
6666
assert_equal I18n.t('flashes.notices.catalog_uploaded_successfully'), flash[:notice]
6767
end
6868

@@ -146,7 +146,7 @@ class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
146146

147147
# upload catalog first
148148
post :upload_catalog, params: { id: tenant.id, catalog: fixture_file_upload("#{FIXTURES_PATH}/catalog-v1.xml") }
149-
assert_redirected_to admin_tenant_path(tenant.id)
149+
assert_redirected_to admin_tenant_catalog_path(tenant.id)
150150
assert_equal I18n.t('flashes.notices.catalog_uploaded_successfully'), flash[:notice]
151151

152152
get :new_plan_currency, params: { id: tenant.id, plan_id: }
@@ -286,7 +286,7 @@ class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
286286
tenant = create_kaui_tenant
287287
post :upload_catalog, params: { id: tenant.id, catalog: fixture_file_upload("#{FIXTURES_PATH}/catalog-v1.xml") }
288288

289-
assert_redirected_to admin_tenant_path(tenant.id)
289+
assert_redirected_to admin_tenant_catalog_path(tenant.id)
290290
assert_equal I18n.t('flashes.notices.catalog_uploaded_successfully'), flash[:notice]
291291

292292
post :display_catalog_xml, params: { effective_date:, id: tenant.id }
@@ -373,7 +373,7 @@ class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
373373
tenant = create_kaui_tenant
374374
post :upload_catalog, params: { id: tenant.id, catalog: fixture_file_upload("#{FIXTURES_PATH}/catalog-v1.xml") }
375375

376-
assert_redirected_to admin_tenant_path(tenant.id)
376+
assert_redirected_to admin_tenant_catalog_path(tenant.id)
377377
assert_equal I18n.t('flashes.notices.catalog_uploaded_successfully'), flash[:notice]
378378

379379
get :download_catalog_xml, params: { effective_date:, id: tenant.id }

test/functional/kaui/subscriptions_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class SubscriptionsControllerTest < Kaui::FunctionalTestHelper
306306
assert_response :success
307307
assert_equal extract_value_from_input_field('subscription_account_id'), @bundle.subscriptions.first.account_id
308308
assert_equal extract_value_from_input_field('subscription_bill_cycle_day_local'), @bundle.subscriptions.first.bill_cycle_day_local.to_s
309-
assert_equal extract_value_from_input_field('effective_from_date'), Date.parse(Time.zone.now.to_s).to_s
309+
assert_equal extract_value_from_input_field('effective_from_date'), Time.zone.today.strftime('%Y-%m-%d')
310310
end
311311

312312
test 'should update bcd' do

test/killbill_test_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def create_bundle(account = nil, tenant = nil, username = USERNAME, password = P
125125
product_category: 'BASE',
126126
billing_period: 'MONTHLY',
127127
price_list: 'DEFAULT')
128-
entitlement = entitlement.create(user, reason, comment, nil, false, build_options(tenant, username, password))
128+
entitlement = entitlement.create(user, reason, comment, nil, true, build_options(tenant, username, password))
129129

130130
KillBillClient::Model::Bundle.find_by_id(entitlement.bundle_id, build_options(tenant, username, password))
131131
end

0 commit comments

Comments
 (0)