Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

chore(typos): fix typos #73

Merged
merged 3 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion faker.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func FakeData(a interface{}) error {
return nil
}

// AddProvider extend faker with tag to generate fake data with specified custom algoritm
// AddProvider extend faker with tag to generate fake data with specified custom algorithm
// Example:
// type Gondoruwo struct {
// Name string
Expand Down
23 changes: 11 additions & 12 deletions faker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,11 @@ func TestSkipField(t *testing.T) {
// This test is to ensure that the faker won't fill field with tag skip

a := struct {
ID int
ShouldBeSkipped int `faker:"-"`
ID int
ShouldBeSkipped int `faker:"-"`
ShouldBeSkippedFilled int `faker:"-"`

}{}


a.ShouldBeSkippedFilled = 10

err := FakeData(&a)
Expand All @@ -729,7 +727,7 @@ func TestSkipField(t *testing.T) {
if a.ShouldBeSkipped != 0 {
t.Error("Expected that field will be skipped")
}

if a.ShouldBeSkippedFilled != 10 {
t.Error("Expected that field will be skipped")
}
Expand Down Expand Up @@ -836,30 +834,30 @@ func TestTagWithPointer(t *testing.T) {

//Assert
if sample.FirstName == nil || *sample.FirstName == "" {
t.Error("Expected filled but got emtpy")
t.Error("Expected filled but got empty")
}
if sample.Email == nil || *sample.Email == "" {
t.Error("Expected filled but got emtpy")
t.Error("Expected filled but got empty")
}
if sample.Latitude == nil || *sample.Latitude == 0 {
t.Error("Expected filled but got emtpy")
t.Error("Expected filled but got empty")
}
if sample.Latitude32 == nil || *sample.Latitude32 == 0 {
t.Error("Expected filled but got emtpy")
t.Error("Expected filled but got empty")
}

if sample.UnixTime == nil || *sample.UnixTime == 0 {
t.Error("Expected filled but got emtpy")
t.Error("Expected filled but got empty")
}

if sample.School == nil || sample.School.Location == "" {
t.Error("Expected filled but got emtpy")
t.Error("Expected filled but got empty")
}
}

func TestItOverwritesDefaultValueIfKeepIsSet(t *testing.T) {
type TestStruct struct {
Email string `json:"email,omitempty" faker:"email,keep"`
Email string `json:"email,omitempty" faker:"email,keep"`
}

test := TestStruct{}
Expand Down Expand Up @@ -922,6 +920,7 @@ func TestItThrowsAnErrorWhenKeepIsUsedOnIncomparableType(t *testing.T) {
withSlice := TypeStructWithSlice{}
withArray := TypeStructWithArray{}


for _, item := range []interface{}{withArray, withStruct, withSlice} {
err := FakeData(&item)
if err == nil {
Expand Down
6 changes: 3 additions & 3 deletions person.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (p Person) firstname() string {
return randomElementFromSliceString(firstNames)
}

// FirstName retuns first names
// FirstName returns first names
func (p Person) FirstName(v reflect.Value) (interface{}, error) {
return p.firstname(), nil
}
Expand All @@ -177,7 +177,7 @@ func (p Person) firstnamemale() string {
return randomElementFromSliceString(firstNamesMale)
}

// FirstNameMale retuns first names for males
// FirstNameMale returns first names for males
func (p Person) FirstNameMale(v reflect.Value) (interface{}, error) {
return p.firstnamemale(), nil
}
Expand All @@ -192,7 +192,7 @@ func (p Person) firstnamefemale() string {
return randomElementFromSliceString(firstNamesFemale)
}

// FirstNameFemale retuns first names for females
// FirstNameFemale returns first names for females
func (p Person) FirstNameFemale(v reflect.Value) (interface{}, error) {
return p.firstnamefemale(), nil
}
Expand Down
4 changes: 2 additions & 2 deletions price_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAmountWithCurrency(t *testing.T) {
}

if !strings.Contains(p.(string), " ") {
t.Error("Expected Price currency followed by a space and it's ammount")
t.Error("Expected Price currency followed by a space and it's amount")
}
}

Expand All @@ -44,7 +44,7 @@ func TestFakeAmountWithCurrency(t *testing.T) {
p := AmountWithCurrency()

if !strings.Contains(p, " ") {
t.Error("Expected Price currency followed by a space and it's ammount")
t.Error("Expected Price currency followed by a space and it's amount")
}

arrCurrency := strings.Split(p, " ")
Expand Down