core/providers/deno/deno_test.go
core/providers/deno/deno_test.goBrowse 1970 files
344 tokens
1,266 bytes
Token encoding: o200k_base
Snapshot 21a254f
← Back to SKILL.md
1package deno2 3import (4 "testing"5 6 testingUtils "github.com/railwayapp/railpack/core/testing"7 "github.com/stretchr/testify/require"8)9 10func TestDeno(t *testing.T) {11 tests := []struct {12 name string13 path string14 detected bool15 expectedMain string16 }{17 {18 name: "deno project with main.ts",19 path: "../../../examples/deno-2",20 detected: true,21 expectedMain: "main.ts",22 },23 {24 name: "non-deno project",25 path: "../../../examples/node-npm",26 detected: false,27 },28 }29 30 for _, tt := range tests {31 t.Run(tt.name, func(t *testing.T) {32 ctx := testingUtils.CreateGenerateContext(t, tt.path)33 provider := DenoProvider{}34 35 detected, err := provider.Detect(ctx)36 require.NoError(t, err)37 require.Equal(t, tt.detected, detected)38 39 if detected {40 err = provider.Initialize(ctx)41 require.NoError(t, err)42 43 require.Equal(t, tt.expectedMain, provider.mainFile)44 45 err = provider.Plan(ctx)46 require.NoError(t, err)47 48 // Verify start command format49 if provider.mainFile != "" {50 expectedCmd := "deno run --allow-all " + provider.mainFile51 require.Equal(t, expectedCmd, ctx.Deploy.StartCmd)52 } else {53 require.Empty(t, ctx.Deploy.StartCmd)54 }55 }56 })57 }58}59