Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIP-52 fix integration tests #3652

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions kbase-extension/static/kbase/custom/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ define([
NarrativeRuntime,
html
) => {
'use strict';

// Handlebars global configuration. Since these changes affect all usage of handlebars
// in this app, they should be performed just once.
Handlebars.registerHelper('numeral', (value, format, defaultValue, options) => {
Expand All @@ -145,19 +143,8 @@ define([
options = defaultValue;
defaultValue = undefined;
}
let missing = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hunk of code here tests if the string passed in for processing is a number in various ways. We're using the numeral package here, so just let it tell us. Also, the real bug was using isNaN on the numeralValue object, which was erroring. Not sure why this took so long to fail / be found.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure it's the only unfound bug in the codebase!

if (typeof value === 'string') {
if (value.trim().length === 0) {
missing = true;
}
} else if (typeof value !== 'number') {
missing = true;
}
const numeralValue = numeral(value);
if (isNaN(numeralValue)) {
missing = true;
}
if (missing) {
if (numeralValue.value() === null) {
return defaultValue || 'n/a';
}
try {
Expand Down
Loading
Loading