зеркало из https://github.com/github/explore.git
Enforce the maximum of 40 items in a collection.
We're only display 40 now (was 20) so enforce this to avoid confusion.
This commit is contained in:
Родитель
0ec643afc1
Коммит
8f2c2cc854
|
@ -40,7 +40,6 @@ items:
|
|||
- purescript/purescript
|
||||
- PowerShell/PowerShell
|
||||
- rakudo/rakudo
|
||||
- SWI-Prolog/swipl-devel
|
||||
display_name: Programming languages
|
||||
created_by: leereilly
|
||||
---
|
||||
|
|
|
@ -32,6 +32,13 @@ describe "collections" do
|
|||
assert_empty invalid_slugs, "Invalid item slugs #{invalid_slugs}"
|
||||
end
|
||||
|
||||
it "has valid number of items" do
|
||||
items = items_for_collection(collection)
|
||||
assert (1...MAX_COLLECTION_ITEMS_LENGTH + 1).cover?(items.length),
|
||||
"must have no more than #{MAX_COLLECTION_ITEMS_LENGTH} items " \
|
||||
"(currently #{items.length})"
|
||||
end
|
||||
|
||||
it "fails if a repository does not exist or is private" do
|
||||
errors = []
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ require_relative "./test_helper"
|
|||
VALID_COLLECTION_METADATA_KEYS = %w[collection created_by display_name image items].freeze
|
||||
REQUIRED_COLLECTION_METADATA_KEYS = %w[items display_name].freeze
|
||||
|
||||
MAX_COLLECTION_ITEMS_LENGTH = 40
|
||||
MAX_COLLECTION_SLUG_LENGTH = 40
|
||||
MAX_COLLECTION_DISPLAY_NAME_LENGTH = 100
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче