(t *testing.T)
| 162 | } |
| 163 | |
| 164 | func TestGeneratePluginDocs(t *testing.T) { |
| 165 | g := NewGenerator("test", testTables) |
| 166 | cup := cupaloy.New(cupaloy.SnapshotSubdirectory("testdata")) |
| 167 | |
| 168 | t.Run("Markdown", func(t *testing.T) { |
| 169 | tmpdir := t.TempDir() |
| 170 | |
| 171 | err := g.Generate(tmpdir, FormatMarkdown) |
| 172 | if err != nil { |
| 173 | t.Fatalf("unexpected error calling GeneratePluginDocs: %v", err) |
| 174 | } |
| 175 | |
| 176 | expectFiles := []string{"test_table.md", "relation_table.md", "relation_relation_table_a.md", "relation_relation_table_b.md", "incremental_table.md", "paid_table.md", "README.md", "test_table_with_primary_key_component.md"} |
| 177 | for _, exp := range expectFiles { |
| 178 | t.Run(exp, func(t *testing.T) { |
| 179 | output := path.Join(tmpdir, exp) |
| 180 | got, err := os.ReadFile(output) |
| 181 | require.NoError(t, err) |
| 182 | cup.SnapshotT(t, got) |
| 183 | }) |
| 184 | } |
| 185 | }) |
| 186 | |
| 187 | t.Run("JSON", func(t *testing.T) { |
| 188 | tmpdir := t.TempDir() |
| 189 | |
| 190 | err := g.Generate(tmpdir, FormatJSON) |
| 191 | if err != nil { |
| 192 | t.Fatalf("unexpected error calling GeneratePluginDocs: %v", err) |
| 193 | } |
| 194 | |
| 195 | expectFiles := []string{"__tables.json"} |
| 196 | for _, exp := range expectFiles { |
| 197 | t.Run(exp, func(t *testing.T) { |
| 198 | output := path.Join(tmpdir, exp) |
| 199 | got, err := os.ReadFile(output) |
| 200 | require.NoError(t, err) |
| 201 | cup.SnapshotT(t, got) |
| 202 | }) |
| 203 | } |
| 204 | }) |
| 205 | } |
nothing calls this directly
no test coverage detected