(t *testing.T)
| 172 | } |
| 173 | |
| 174 | func TestMigrateToV4(t *testing.T) { |
| 175 | // set up |
| 176 | ctx := setupEnv(t, "../tmp") |
| 177 | defer teardownEnv(t, ctx) |
| 178 | defer os.Setenv("EDITOR", "") |
| 179 | |
| 180 | testutils.CopyFixture(t, ctx, "./fixtures/legacy-4-pre-dnoterc.yaml", "dnoterc") |
| 181 | |
| 182 | // execute |
| 183 | os.Setenv("EDITOR", "vim") |
| 184 | if err := migrateToV4(ctx); err != nil { |
| 185 | t.Fatal(errors.Wrap(err, "Failed to migrate").Error()) |
| 186 | } |
| 187 | |
| 188 | // test |
| 189 | b := testutils.ReadFile(ctx, "dnoterc") |
| 190 | var config migrateToV4PostConfig |
| 191 | if err := yaml.Unmarshal(b, &config); err != nil { |
| 192 | t.Fatal(errors.Wrap(err, "Failed to unmarshal the result into Dnote").Error()) |
| 193 | } |
| 194 | |
| 195 | assert.Equal(t, config.APIKey, "Oev6e1082ORasdf9rjkfjkasdfjhgei", "api key mismatch") |
| 196 | assert.Equal(t, config.Editor, "vim", "editor mismatch") |
| 197 | } |
| 198 | |
| 199 | func TestMigrateToV5(t *testing.T) { |
| 200 | // set up |
nothing calls this directly
no test coverage detected