Skip to content

Commit a65a9f3

Browse files
Copilotmnkiefer
andcommitted
Fix test: update TestGetJavaScriptSources to reflect refactored structure
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
1 parent 33f91ee commit a65a9f3

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

‎pkg/workflow/bundler_integration_test.go‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,18 +372,35 @@ func TestGetJavaScriptSources(t *testing.T) {
372372
t.Error("sanitize_content.cjs does not contain sanitizeContent function")
373373
}
374374

375-
// Should contain helper functions
376-
helpers := []string{
375+
// Should contain neutralizeMentions helper (still defined locally)
376+
if !strings.Contains(sanitize, "function neutralizeMentions") {
377+
t.Error("sanitize_content.cjs does not contain function neutralizeMentions")
378+
}
379+
380+
// Should import from sanitize_content_core
381+
if !strings.Contains(sanitize, `require("./sanitize_content_core.cjs")`) {
382+
t.Error("sanitize_content.cjs does not import from sanitize_content_core.cjs")
383+
}
384+
385+
// Check that sanitize_content_core.cjs contains the shared helper functions
386+
core, ok := sources["sanitize_content_core.cjs"]
387+
if !ok {
388+
t.Fatal("GetJavaScriptSources does not contain sanitize_content_core.cjs")
389+
}
390+
391+
// Should contain helper functions in core
392+
coreHelpers := []string{
377393
"function sanitizeUrlDomains",
378394
"function sanitizeUrlProtocols",
379-
"function neutralizeMentions",
380395
"function removeXmlComments",
381396
"function neutralizeBotTriggers",
397+
"function buildAllowedDomains",
398+
"function applyTruncation",
382399
}
383400

384-
for _, helper := range helpers {
385-
if !strings.Contains(sanitize, helper) {
386-
t.Errorf("sanitize_content.cjs does not contain %s", helper)
401+
for _, helper := range coreHelpers {
402+
if !strings.Contains(core, helper) {
403+
t.Errorf("sanitize_content_core.cjs does not contain %s", helper)
387404
}
388405
}
389406
}

0 commit comments

Comments
 (0)