[MM-16751] golint model (#17896)
Этот коммит содержится в:
коммит произвёл
Claudio Costa
родитель
953eebdef4
Коммит
97ccf0bdf6
@@ -68,7 +68,7 @@ func TestUpdateAssetsSubpath(t *testing.T) {
|
||||
defer os.RemoveAll(tempDir)
|
||||
os.Chdir(tempDir)
|
||||
|
||||
err = os.Mkdir(model.CLIENT_DIR, 0700)
|
||||
err = os.Mkdir(model.ClientDir, 0700)
|
||||
require.NoError(t, err)
|
||||
|
||||
testCases := []struct {
|
||||
@@ -163,9 +163,9 @@ func TestUpdateAssetsSubpath(t *testing.T) {
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
ioutil.WriteFile(filepath.Join(tempDir, model.CLIENT_DIR, "root.html"), []byte(testCase.RootHTML), 0700)
|
||||
ioutil.WriteFile(filepath.Join(tempDir, model.CLIENT_DIR, "main.css"), []byte(testCase.MainCSS), 0700)
|
||||
ioutil.WriteFile(filepath.Join(tempDir, model.CLIENT_DIR, "manifest.json"), []byte(testCase.ManifestJSON), 0700)
|
||||
ioutil.WriteFile(filepath.Join(tempDir, model.ClientDir, "root.html"), []byte(testCase.RootHTML), 0700)
|
||||
ioutil.WriteFile(filepath.Join(tempDir, model.ClientDir, "main.css"), []byte(testCase.MainCSS), 0700)
|
||||
ioutil.WriteFile(filepath.Join(tempDir, model.ClientDir, "manifest.json"), []byte(testCase.ManifestJSON), 0700)
|
||||
err := utils.UpdateAssetsSubpath(testCase.Subpath)
|
||||
if testCase.ExpectedError != nil {
|
||||
require.Equal(t, testCase.ExpectedError, err)
|
||||
@@ -173,7 +173,7 @@ func TestUpdateAssetsSubpath(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadFile(filepath.Join(tempDir, model.CLIENT_DIR, "root.html"))
|
||||
contents, err := ioutil.ReadFile(filepath.Join(tempDir, model.ClientDir, "root.html"))
|
||||
require.NoError(t, err)
|
||||
|
||||
// Rewrite the expected and contents for simpler diffs when failed.
|
||||
@@ -181,11 +181,11 @@ func TestUpdateAssetsSubpath(t *testing.T) {
|
||||
contentsStr := strings.Replace(string(contents), ">", ">\n", -1)
|
||||
require.Equal(t, expectedRootHTML, contentsStr)
|
||||
|
||||
contents, err = ioutil.ReadFile(filepath.Join(tempDir, model.CLIENT_DIR, "main.css"))
|
||||
contents, err = ioutil.ReadFile(filepath.Join(tempDir, model.ClientDir, "main.css"))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, testCase.ExpectedMainCSS, string(contents))
|
||||
|
||||
contents, err = ioutil.ReadFile(filepath.Join(tempDir, model.CLIENT_DIR, "manifest.json"))
|
||||
contents, err = ioutil.ReadFile(filepath.Join(tempDir, model.ClientDir, "manifest.json"))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, testCase.ExpectedManifestJSON, string(contents))
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user