Skip to content

Commit

Permalink
Add test of recent file with invalid JSON data
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewJohn committed Jun 7, 2024
1 parent c9c8272 commit 91ec8c6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/recent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ func Test_unmarshalRecentFileData_conversion(t *testing.T) {
performUnmarshalRecentFileDataTest(t, "1.3.2\n1.2.3\n", &expectedRecentFileData)
}

// Test_unmarshalRecentFileData_invalid_data : Test unmarshalRecentFileData with invalid data in recentfile
func Test_unmarshalRecentFileData_invalid_data(t *testing.T) {
expectedRecentFileData := RecentFile{}
performUnmarshalRecentFileDataTest(t, "{This Is not valid JSON}", &expectedRecentFileData)

performUnmarshalRecentFileDataTest(t, `{"valid": ["json", "but", "will"], "not": {"unmarshall": ["to", "RecentFile"]}}`, &expectedRecentFileData)
}

// Test_unmarshalRecentFileData : Test unmarshalRecentFileData
func Test_unmarshalRecentFileData(t *testing.T) {
var expectedRecentFileData RecentFile
Expand Down

0 comments on commit 91ec8c6

Please sign in to comment.