Skip to content
Open
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
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def internal_server_error(error):
"""Render a friendly 500 page for unexpected server errors."""
return render_template("500.html"), 500


@app.route('/health')
def health_check():
return {'status': 'ok'}, 200


if __name__ == "__main__":
# debug=True is only for local development.
Expand Down
Binary file added main_test.py
Binary file not shown.
18 changes: 14 additions & 4 deletions static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,32 @@ if (isIndexPage) {
}
});

function addSkill(rawSkill) {
//add a skill to the list if it's not empty or a duplicate
function addSkill(rawSkill) {
// Clean up any extra spaces and match to canonical skill name
var skill = getCanonicalSkill(rawSkill);
// Nothing to add if string is empty after trimming
if (!skill) return;

// Block duplicate entries (case-insensitive)
// Validate against available skills list
var isValid = availableSkills.some(function(s) {
return s.toLowerCase() === skill.toLowerCase();
});

if (!isValid) {
showFieldError("skills-error",
'"' + skill + '" is not a recognized skill. Please select from the available list.');
return;
}

if (isSkillSelected(skill)) return;

selectedSkills.push(skill);
renderSelectedChips();
syncSkillsHiddenInput();
updateQuickPickState();
// Once a skill is added, remove the "please add a skill" error if it was showing
clearFieldError("skills-error");
}
}

// remove a skill from the list and update the UI accordingly
function removeSkill(skill) {
Expand Down Expand Up @@ -842,3 +851,4 @@ if (scrollTopBtn) {
window.addEventListener('scroll', handleScroll);
scrollTopBtn.addEventListener('click', scrollToTop);
}
}
13 changes: 12 additions & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import sys
import os

# Allow imports from the project root when running tests directly
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))

Expand Down Expand Up @@ -296,7 +295,19 @@ def test_scoring_weights_has_all_keys():
expected_keys = {"skill", "level", "interest", "time"}
assert set(SCORING_WEIGHTS.keys()) == expected_keys

def client():
app.config["TESTING"] = True
with app.test_client() as client:
yield client

def test_health_check():
client = get_client()
response = client.get("/health")
assert response.status_code == 200
data = response.get_json()
assert "status" in data
assert "version" in data
assert data["status"] == "ok"
# ============================================================
# Run tests directly (no pytest required)
# ============================================================
Expand Down
Loading