nodesjs_test.go 637 B

123456789101112131415161718192021222324
  1. package nodejs
  2. import "testing"
  3. func TestNodejs(t *testing.T) {
  4. // Create a new NodeJS stack instance
  5. nodejsStack := &NodeJS{}
  6. // Test the Name method
  7. expectedName := "Node.js"
  8. if nodejsStack.Name() != expectedName {
  9. t.Errorf("Expected name %s, got %s", expectedName, nodejsStack.Name())
  10. }
  11. // Test the Analyze method with a sample codebase path
  12. codebasePath := "/path/to/nodejs/project"
  13. stackName, err := nodejsStack.Analyze(codebasePath)
  14. if err != nil {
  15. t.Errorf("Unexpected error during analysis: %v", err)
  16. }
  17. if stackName != expectedName {
  18. t.Errorf("Expected stack name %s, got %s", expectedName, stackName)
  19. }
  20. }