Expected `any(grepl("quadratic", names(params)))` to be TRUE.
Differences:
`actual`:   FALSE
`expected`: TRUE

# Tests for different growth model specifications
# Part of Week 2 testing expansion (ACTION-PLAN-PHASE1.md)
test_that("linear growth model works correctly", {
expect_true(fit@fit_indices$entropy >= 0 && fit@fit_indices$entropy <= 1)
test_that("quadratic growth model works correctly", {
list(intercept = 5, slope = 1.0, quadratic = -0.1),
list(intercept = 3, slope = 0.2, quadratic = 0.05)
# Parameters should include quadratic terms
test_that("free basis growth model works correctly", {
test_that("nonlinear growth model works correctly", {
skip("nonlinear growth model not yet implemented")
test_that("growth models with covariates work", {
# Note: Covariates not currently included in parameters
test_that("model comparison across growth types works", {

"quadratic growth model works correctly"
"free basis growth model works correctly"
"nonlinear growth model works correctly"
"nonlinear growth model not yet implemented"
"model comparison across growth types works"

`gmm_select(...)` threw an error with unexpected message.
Expected match: "classes must be in ascending order"
Actual message: "undefined columns selected"

test_that("gmm_select basic functionality with minimal models", {
# Lightweight test: compare just 1-2 classes
criteria = c("BIC", "entropy"),  # No BLRT
test_that("Information criteria are calculated for fitted models", {
# Test that AIC, BIC are computed correctly
# Check fit indices exist and are finite
# BIC should be larger than AIC (stronger penalty)
test_that("Entropy is in valid range [0, 1]", {
test_that("Single class model fits correctly", {
# Entropy should be 1 or NA for single class (no uncertainty)
expect_true(is.na(fit@fit_indices$entropy) || fit@fit_indices$entropy == 1)
test_that("plot_model_selection works without error", {
expect_error(plot_model_selection(result, criterion = "bic"), NA)
test_that("SurveyMixrSelect class has proper structure", {
# Comprehensive tests (skip on CRAN for speed)
test_that("gmm_select compares models across different class numbers", {
# Run model selection (no BLRT for speed)
criteria = c("BIC", "entropy"),  # Skip BLRT for speed
expect_equal(nrow(result@comparison_table), 4)  # 1, 2, 3, 4 class models
# BIC should decrease then increase (or plateau) as classes increase
test_that("gmm_select handles minimum 2 classes", {
expect_equal(nrow(result@comparison_table), 2)  # 2 and 3 class models
skip("BLRT is computationally intensive - run manually when needed")
blrt_samples = 100,  # Reduced for testing
test_that("Information criteria are calculated correctly", {
test_that("Entropy is bounded between 0 and 1", {
test_that("Model selection with survey design works", {
for (i in 1:length(result@fitted_models)) {
test_that("gmm_select error handling for invalid classes parameter", {
# Should error on invalid classes specification
test_that("gmm_select handles single class model correctly", {
classes = 1:2,  # Compare 1 vs 2 classes
# 1-class model should be in fitted models
test_that("gmm_select with quadratic growth models compares correctly", {
test_that("Model selection can be plotted", {
test_that("Single class model serves as baseline", {
# Entropy should be NA or 1 for single class
expect_true(is.na(fit_1class@fit_indices$entropy) || fit_1class@fit_indices$entropy == 1)
test_that("Model selection recommendations are sensible", {
# BIC should favor 3-class model (or close to it)
# Should be within 1 class of true model
test_that("Parallel processing works in model selection", {
skip_if(parallel::detectCores() < 2, "Need multiple cores for parallel testing")