MCPcopy
hub / github.com/dnote/dnote / TestMigrateToV7

Function TestMigrateToV7

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

Source from the content-addressed store, hash-verified

322}
323
324func TestMigrateToV7(t *testing.T) {
325 // set up
326 ctx := setupEnv(t, "../tmp")
327 defer teardownEnv(t, ctx)
328
329 testutils.CopyFixture(t, ctx, "./fixtures/legacy-7-pre-actions.json", "actions")
330
331 // execute
332 if err := migrateToV7(ctx); err != nil {
333 t.Fatal(errors.Wrap(err, "migrating").Error())
334 }
335
336 // test
337 b := testutils.ReadFile(ctx, "actions")
338 var got []migrateToV7Action
339 if err := json.Unmarshal(b, &got); err != nil {
340 t.Fatal(errors.Wrap(err, "unmarshalling the result").Error())
341 }
342
343 b2 := utils.ReadFileAbs("./fixtures/legacy-7-post-actions.json")
344 var expected []migrateToV7Action
345 if err := json.Unmarshal(b, &expected); err != nil {
346 t.Fatal(errors.Wrap(err, "unmarshalling the result into Dnote").Error())
347 }
348
349 assert.EqualJSON(t, string(b), string(b2), "Result does not match")
350}
351
352func TestMigrateToV8(t *testing.T) {
353 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 8

CopyFixtureFunction · 0.92
ReadFileFunction · 0.92
ReadFileAbsFunction · 0.92
EqualJSONFunction · 0.92
setupEnvFunction · 0.85
teardownEnvFunction · 0.85
migrateToV7Function · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected