| 14 | ) |
| 15 | |
| 16 | func TestTemplate(t *testing.T) { |
| 17 | t.Parallel() |
| 18 | list, err := examples.List() |
| 19 | require.NoError(t, err, "error listing examples, run \"make gen\" to ensure examples are up to date") |
| 20 | require.NotEmpty(t, list) |
| 21 | for _, eg := range list { |
| 22 | t.Run(eg.ID, func(t *testing.T) { |
| 23 | t.Parallel() |
| 24 | assert.NotEmpty(t, eg.ID, "example ID should not be empty") |
| 25 | assert.NotEmpty(t, eg.URL, "example URL should not be empty") |
| 26 | assert.NotEmpty(t, eg.Name, "example name should not be empty") |
| 27 | assert.NotEmpty(t, eg.Description, "example description should not be empty") |
| 28 | assert.NotEmpty(t, eg.Markdown, "example markdown should not be empty") |
| 29 | assert.NotNil(t, eg.Tags, "example tags should not be nil, should be empty array if no tags") |
| 30 | _, err := examples.Archive(eg.ID) |
| 31 | assert.NoError(t, err, "error archiving example") |
| 32 | }) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func TestSubdirs(t *testing.T) { |
| 37 | t.Parallel() |