MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / TestAutoImportStyleNormalization

Function TestAutoImportStyleNormalization

etscore/options_test.go:487–511  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

485}
486
487func TestAutoImportStyleNormalization(t *testing.T) {
488 opts := &etscore.EffectPluginOptions{
489 NamespaceImportPackages: []string{"Effect", " @Effect/Platform ", ""},
490 BarrelImportPackages: []string{"@Effect/Schema", " EFFECT/SQL "},
491 ImportAliases: map[string]string{
492 "Effect": "E",
493 " @Effect/Platform ": "Platform",
494 "": "Invalid",
495 },
496 TopLevelNamedReexports: etscore.TopLevelNamedReexportsMode("FOLLOW"),
497 }
498
499 if got, want := opts.GetNamespaceImportPackages(), []string{"effect", "@effect/platform"}; !reflect.DeepEqual(got, want) {
500 t.Errorf("GetNamespaceImportPackages() = %v, want %v", got, want)
501 }
502 if got, want := opts.GetBarrelImportPackages(), []string{"@effect/schema", "effect/sql"}; !reflect.DeepEqual(got, want) {
503 t.Errorf("GetBarrelImportPackages() = %v, want %v", got, want)
504 }
505 if got, want := opts.GetImportAliases(), map[string]string{"effect": "E", "@effect/platform": "Platform"}; !reflect.DeepEqual(got, want) {
506 t.Errorf("GetImportAliases() = %v, want %v", got, want)
507 }
508 if got := opts.GetTopLevelNamedReexports(); got != etscore.TopLevelNamedReexportsFollow {
509 t.Errorf("GetTopLevelNamedReexports() = %q, want %q", got, etscore.TopLevelNamedReexportsFollow)
510 }
511}
512
513func TestTopLevelNamedReexportsInvalidFallback(t *testing.T) {
514 opts := &etscore.EffectPluginOptions{TopLevelNamedReexports: etscore.TopLevelNamedReexportsMode("invalid")}

Callers

nothing calls this directly

Calls 5

GetImportAliasesMethod · 0.95

Tested by

no test coverage detected