<commit_before>package cmd

import (
	"io/ioutil"
	"os/exec"
	"path/filepath"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

// #3952 is not special, it's just a place to dump discussions as mr #1 filled up, long term should update the tests clean up what they create
const mrCommentSlashDiscussionDumpsterID = "3952"

func Test_mrCreateNote(t *testing.T) {
	tests := []struct {
		Name         string
		Args         []string
		ExpectedBody string
	}{
		{
			Name:         "Normal text",
			Args:         []string{"lab-testing", mrCommentSlashDiscussionDumpsterID, "-m", "note text"},
			ExpectedBody: "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + "#note_",
		},
		{
			// Escaped sequence text direct in the argument list as the
			// following one was already a problem:
			// https://github.com/zaquestion/lab/issues/376
			Name:         "Escape char",
			Args:         []string{"lab-testing", mrCommentSlashDiscussionDumpsterID, "-m", "{\"key\": \"value\"}"},
			ExpectedBody: "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + "#note_",
		},
	}
	noteCmd := []string{"mr", "note"}
	repo := copyTestRepo(t)

	for _, test := range tests {
		t.Run(test.Name, func(t *testing.T) {
			cmd := exec.Command(labBinaryPath, append(noteCmd, test.Args...)...)
			cmd.Dir = repo

			b, err := cmd.CombinedOutput()<commit_msg>mr_note_test: change MR ID used for testing discussion<commit_after>package cmd

import (
	"io/ioutil"
	"os/exec"
	"path/filepath"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

// #3952 is not special, it's just a place to dump discussions as mr #1 filled up, long term should update the tests clean up what they create
const mrCommentSlashDiscussionDumpsterID = "3953"

func Test_mrCreateNote(t *testing.T) {
	tests := []struct {
		Name         string
		Args         []string
		ExpectedBody string
	}{
		{
			Name:         "Normal text",
			Args:         []string{"lab-testing", mrCommentSlashDiscussionDumpsterID, "-m", "note text"},
			ExpectedBody: "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + "#note_",
		},
		{
			// Escaped sequence text direct in the argument list as the
			// following one was already a problem:
			// https://github.com/zaquestion/lab/issues/376
			Name:         "Escape char",
			Args:         []string{"lab-testing", mrCommentSlashDiscussionDumpsterID, "-m", "{\"key\": \"value\"}"},
			ExpectedBody: "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + "#note_",
		},
	}
	noteCmd := []string{"mr", "note"}
	repo := copyTestRepo(t)

	for _, test := range tests {
		t.Run(test.Name, func(t *testing.T) {
			cmd := exec.Command(labBinaryPath, append(noteCmd, test.Args...)...)
			cmd.Dir = repo

			b, err := cmd.CombinedOutput()
{'fraction_non_alphanumeric': 0.14681066486668917, 'fraction_numerical': 0.00809989875126561, 'mean_word_length': 3.4909090909090907, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, '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': '3055320', 'n_tokens_mistral': 1081, 'n_tokens_neox': 994, 'n_words': 236}