Skip to content

use suite testing in a good way #2

Description

@marcelloh

This is what you have:

func (suite *facesTestSuite) TestShouldNotReveal() {
	var (
		actual = &user{
			Email:           "foo&bar.com",
			Password:        "123",
			unexportedField: "Foo",
		}
		expected = actual
	)

	Reveal(actual, "private")

	assert.Equal(suite.T(), expected, actual)
}

and this is how it should be done:

func (suite *facesTestSuite) TestShouldNotReveal() {
	var (
		actual = &user{
			Email:           "foo&bar.com",
			Password:        "123",
			unexportedField: "Foo",
		}
		expected = actual
	)

	Reveal(actual, "private")

	suite.assert.Equal(expected, actual)
}

and... why fill the vars like that (with the var() around them?)
you have:

	var (
		actual = &user{
			Email:           "foo&bar.com",
			Password:        "123",
			unexportedField: "Foo",
		}
		expected = actual
	)

but you can do:

	actual := &user{
		Email:           "foo&bar.com",
		Password:        "123",
		unexportedField: "Foo",
	}
	expected := actual

Less lines and less indentations, which makes it easier to read

Just my 2 cents....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions