Skip to content

Commit d0cc003

Browse files
committed
fix broken test
1 parent 5b8c9a5 commit d0cc003

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎_tests/content.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A series of tests checking the integrity of the _content data
1414
| Drive Links are Unique | {% assign ac = site.content | where_exp: "c", "c.drive_links" %}{% assign seen = "" | split: "" %}{% assign dupes = "" | split: "" %}{% for c in ac %}{% for d in c.drive_links %}{% if seen contains d %}{% unless dupes contains d %}{% assign dupes = dupes | push: d %}{% endunless %}{% else %}{% assign seen = seen | push: d %}{% endif %}{% endfor %}{% endfor %}{% if dupes.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | {% if dupes.size > 0 %}Found these duplicate links: `{{ dupes | join: " " }}`{% else %}No duplicate links found.{% endif %}
1515
| Course in tags | {% assign failures = site.content | where_exp: "c", "c.tags contains c.course" %}{% if failures.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | There are {{ failures.size }} pieces with the course in the tags{% if failures.size > 0 %}: {{ failures | map: "slug" | array_to_sentence_string }}{% endif %}.
1616
| Sane file_links | {% assign valid_buckets = "exclusive_01,patanjali-yoga-sutra,function-data" | split: "," %}{% assign hostedcontent = site.content | where_exp: "c", "c.file_links.size > 0" %}{% assign fs = '' | split: '' %}{% for c in hostedcontent %}{% for l in c.file_links %}{% assign s = l | split: "/" %}{% if valid_buckets contains s[0] %}{% if s contains "blob" %}{% assign fs = fs | push: c %}{% endif %}{% else %}{% assign fs = fs | push: c %}{% endif %}{% endfor %}{% endfor %}{% if fs.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | {% assign count = hostedcontent.size | minus: fs.size %}{% if count > 0 %}There are {{ count }} sane links{% endif %}{% if fs.size > 0 %}The {{ fs.size }} pieces with bad buckets are: {% for c in fs %}[{{ c.title | split: ":" | first }}]({{ c.url }}) {% endfor %}{% endif %}
17-
| file_links match formats | {% assign fs = '' | split: '' %}{% for c in hostedcontent %}{% for l in c.file_links %}{% assign ee = l | split: "." | last %}{% unless ee == c.formats[forloop.index0] or c.formats[forloop.index0] == 'mp3s' %}{% assign fs = fs | push: c %}{% endunless %}{% endfor %}{% endfor %}{% if fs.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | {% assign count = hostedcontent.size | minus: fs.size %}{% if count > 0 %}There are {{ count }} sane formats.{% endif %}{% if fs.size > 0 %} The {{ fs.size }} pieces with bad formats are: {% for c in fs %}[{{ c.title | split: ":" | first }}]({{ c.url }}) {% endfor %}{% endif %}
17+
| file_links match formats | {% assign fs = '' | split: '' %}{% for c in hostedcontent %}{% for l in c.file_links %}{% assign ee = l | split: "." | last | downcase %}{% unless ee == c.formats[forloop.index0] or c.formats[forloop.index0] == 'mp3s' %}{% assign fs = fs | push: c %}{% endunless %}{% endfor %}{% endfor %}{% if fs.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | {% assign count = hostedcontent.size | minus: fs.size %}{% if count > 0 %}There are {{ count }} sane formats.{% endif %}{% if fs.size > 0 %} The {{ fs.size }} pieces with bad formats are: {% for c in fs %}[{{ c.title | split: ":" | first }}]({{ c.url }}) {% endfor %}{% endif %}
1818
| Negative Pages | {% assign fails = '' | split: '' %}{% for cont in site.content %}{% unless cont.pages %}{% continue %}{% endunless %}{% if cont.pages contains "--" %}{% assign ps = cont.pages | split: "--" %}{% assign ps = 1 | plus: ps[1] | minus: ps[0] %}{% if ps < 1 or ps != cont.page_count %}{% assign fails = fails | push: cont %}{% endif %}{% else %}{% if cont.pages < 1 %}{% assign fails = fails | push: cont %}{% endif %}{% endif %}{% endfor %}{% if fails.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | Found {{ fails.size }} with negative pages{% if fails.size > 0 %}: {{ fails | map: "path" | array_to_sentence_string }}{% endif %}
1919
| Missing Author Pages | {% assign expect = '' | split: '' %}{% for cont in site.content %}{% for auth in cont.authors %}{% unless auth contains " " %}{% unless expect contains auth %}{% assign expect = expect | push: auth %}{% endunless %}{% endunless %}{% endfor %}{% endfor %}{% assign grouped = expect | group_by_exp: "auth", "site.authors | where: 'slug', auth | size" %}{% for group in grouped %}{% if group.name == 0 %}{% assign failed = group.items %}{% else %}{% assign found = group.items %}{% endif %}{% endfor %}{% if expect.size == found.size %}Pass ✅{% else %}FAIL ❌{% endif %} | Of the {{ expect.size }} authors cited, {{ found.size }} of them are in the database. {% if failed.size > 0 %}Failed to find author pages for: {{ failed | array_to_sentence_string }}{% endif %}
2020
| Content Missing an Author | {% assign fails = '' | split: '' %}{% for cont in site.content %}{% unless cont.slug contains "_" %}{% continue %}{% endunless %}{% unless cont.authors.size >= 1 or cont.translator or cont.editor or cont.reader or cont.journal == "tricycle" %}{% assign fails = fails | push: cont %}{% endunless %}{% endfor %}{% if fails.size == 0 %}Pass ✅{% else %}FAIL ❌{% endif %} | Found {{ fails.size }} works without authors{% if fails.size > 0 %}: {{ fails | map: "url" | array_to_sentence_string }}{% endif %}

0 commit comments

Comments
 (0)