(t *testing.T)
| 1020 | } |
| 1021 | |
| 1022 | func TestLocalMigration12(t *testing.T) { |
| 1023 | // set up |
| 1024 | db := database.InitTestMemoryDBRaw(t, "./fixtures/local-12-pre-schema.sql") |
| 1025 | ctx := context.InitTestCtxWithDB(t, db) |
| 1026 | |
| 1027 | data := []byte("editor: vim") |
| 1028 | path := fmt.Sprintf("%s/%s/dnoterc", ctx.Paths.Config, consts.DnoteDirName) |
| 1029 | if err := os.WriteFile(path, data, 0644); err != nil { |
| 1030 | t.Fatal(errors.Wrap(err, "Failed to write schema file")) |
| 1031 | } |
| 1032 | |
| 1033 | // execute |
| 1034 | err := lm12.run(ctx, nil) |
| 1035 | if err != nil { |
| 1036 | t.Fatal(errors.Wrap(err, "failed to run")) |
| 1037 | } |
| 1038 | |
| 1039 | // test |
| 1040 | b, err := os.ReadFile(path) |
| 1041 | if err != nil { |
| 1042 | t.Fatal(errors.Wrap(err, "reading config")) |
| 1043 | } |
| 1044 | |
| 1045 | type config struct { |
| 1046 | APIEndpoint string `yaml:"apiEndpoint"` |
| 1047 | } |
| 1048 | |
| 1049 | var cf config |
| 1050 | err = yaml.Unmarshal(b, &cf) |
| 1051 | if err != nil { |
| 1052 | t.Fatal(errors.Wrap(err, "unmarshalling config")) |
| 1053 | } |
| 1054 | |
| 1055 | assert.NotEqual(t, cf.APIEndpoint, "", "apiEndpoint was not populated") |
| 1056 | } |
| 1057 | |
| 1058 | func TestLocalMigration13(t *testing.T) { |
| 1059 | // set up |
nothing calls this directly
no test coverage detected