<commit_before>package models

import (
	"encoding/json"
	"testing"

	"gopkg.in/yaml.v2"

	"github.com/bitrise-io/go-utils/pointers"
	"github.com/stretchr/testify/require"
)

func Test_serialize_StepModel(t *testing.T) {
	step := StepModel{
		Title: pointers.NewStringPtr("Test Step"),
		Toolkit: &StepToolkitModel{
			Go: &GoStepToolkitModel{
				PackageName: "go/package",
			},
			Bash: &BashStepToolkitModel{
				EntryFile: "step.sh",
			},
		},
	}

	// JSON
	{
		bytes, err := json.Marshal(step)
		require.NoError(t, err)
		require.Equal(t, `{"title":"Test Step","source":{},"toolkit":{"bash":{"entry_file":"step.sh"},"go":{"package_name":"go/package"}},"deps":{}}`, string(bytes))
	}

	// YAML
	{
		bytes, err := yaml.Marshal(step)
		require.NoError(t, err)
		t.Log("t: ", string(bytes))
		require.Equal(t, `title: Test Step
toolkit:
  bash:
    entry_file: step.sh
  go:
    package_name: go/package
`,
			string(bytes))
	}
}
<commit_msg>empty serialize example/test<commit_after>package models

import (
	"encoding/json"
	"testing"

	"gopkg.in/yaml.v2"

	"github.com/bitrise-io/go-utils/pointers"
	"github.com/stretchr/testify/require"
)

func Test_serialize_StepModel(t *testing.T) {
	t.Log("Empty")
	{
		step := StepModel{}

		// JSON
		{
			bytes, err := json.Marshal(step)
			require.NoError(t, err)
			require.Equal(t, `{"source":{},"deps":{}}`, string(bytes))
		}

		// YAML
		{
			bytes, err := yaml.Marshal(step)
			require.NoError(t, err)
			require.Equal(t, `{}
`,
				string(bytes))
		}
	}

	t.Log("Toolkit")
	{
		step := StepModel{
			Title: pointers.NewStringPtr("Test Step"),
			Toolkit: &StepToolkitModel{
				Go: &GoStepToolkitModel{
					PackageName: "go/package",
				},
				Bash: &BashStepToolkitModel{
					EntryFile: "step.sh",
				},
			},
		}

		// JSON
		{
			bytes, err := json.Marshal(step)
			require.NoError(t, err)
			require.Equal(t, `{"title":"Test Step","source":{},"toolkit":{"bash":{"entry_file":"step.sh"},"go":{"package_name":"go/package"}},"deps":{}}`, string(bytes))
		}

		// YAML
		{
			bytes, err := yaml.Marshal(step)
			require.NoError(t, err)
			require.Equal(t, `title: Test Step
toolkit:
  bash:
    entry_file: step.sh
  go:
    package_name: go/package
`,
				string(bytes))
		}
	}
}

{'fraction_non_alphanumeric': 0.19419642857142858, 'fraction_numerical': 0.0008928571428571428, 'mean_word_length': 3.6784968684759916, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7422194', 'n_tokens_mistral': 1002, 'n_tokens_neox': 874, 'n_words': 133}