MCPcopy
hub / github.com/dnote/dnote / TestMigrateToV6

Function TestMigrateToV6

pkg/cli/migrate/legacy_test.go:296–322  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

294}
295
296func TestMigrateToV6(t *testing.T) {
297 // set up
298 ctx := setupEnv(t, "../tmp")
299 defer teardownEnv(t, ctx)
300
301 testutils.CopyFixture(t, ctx, "./fixtures/legacy-6-pre-dnote.json", "dnote")
302
303 // execute
304 if err := migrateToV6(ctx); err != nil {
305 t.Fatal(errors.Wrap(err, "Failed to migrate").Error())
306 }
307
308 // test
309 b := testutils.ReadFile(ctx, "dnote")
310 var got migrateToV6PostDnote
311 if err := json.Unmarshal(b, &got); err != nil {
312 t.Fatal(errors.Wrap(err, "Failed to unmarshal the result into Dnote").Error())
313 }
314
315 b = utils.ReadFileAbs("./fixtures/legacy-6-post-dnote.json")
316 var expected migrateToV6PostDnote
317 if err := json.Unmarshal(b, &expected); err != nil {
318 t.Fatal(errors.Wrap(err, "Failed to unmarshal the result into Dnote").Error())
319 }
320
321 assert.DeepEqual(t, expected, got, "payload mismatch")
322}
323
324func TestMigrateToV7(t *testing.T) {
325 // set up

Callers

nothing calls this directly

Calls 8

CopyFixtureFunction · 0.92
ReadFileFunction · 0.92
ReadFileAbsFunction · 0.92
DeepEqualFunction · 0.92
setupEnvFunction · 0.85
teardownEnvFunction · 0.85
migrateToV6Function · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected