tests whether an ActivityPub Object has a liked collection with an appropriate Collection type
Use these identifiers to refer to this Test.
urn:uuid:018c3df2-d6d8-7f62-805b-b71a96cc6170
This slug is memorable, but it is not guaranteed to be globally unique like a URI.
liked-collection-must-be-a-collection
This describes the input that each test run will use to select test targets.
object with a liked property
{ "help": "object with a liked property", "required": true, "rangeIncludes": [ "https://www.w3.org/ns/activitystreams#Actor" ] }
{ "object": { "help": "object with a liked property", "required": true, "rangeIncludes": [ "https://www.w3.org/ns/activitystreams#Actor" ] } }
This Test has been derived from these specified requirements.
{ "source": "https://www.w3.org/TR/activitypub/", "section": { "id": "https://www.w3.org/TR/activitypub/#liked", "branch": [ 5, 5 ] }, "selector": { "type": "TextQuoteSelector", "prefix": "Every actor MAY have a liked collection. This is a list of every object from all of the actor's Like activities, added as a side effect.\n", "exact": "The liked collection MUST be either an OrderedCollection or a Collection\n", "suffix": "and MAY be filtered on privileges of an authenticated user or as appropriate when no authentication is given.\n" } }
{ "id": "urn:uuid:d2db8da3-25d4-4dd9-9c9c-b2793fd899cf", "type": "Behavior", "uuid": "d2db8da3-25d4-4dd9-9c9c-b2793fd899cf", "content": "The liked collection MUST be either an OrderedCollection or a Collection\n", "tag": [ { "name": "ActivityPubServer", "id": "https://socialweb.coop/tag/ActivityPubServer" } ], "origin": { "source": "https://www.w3.org/TR/activitypub/", "section": { "id": "https://www.w3.org/TR/activitypub/#liked", "branch": [ 5, 5 ] }, "selector": { "type": "TextQuoteSelector", "prefix": "Every actor MAY have a liked collection. This is a list of every object from all of the actor's Like activities, added as a side effect.\n", "exact": "The liked collection MUST be either an OrderedCollection or a Collection\n", "suffix": "and MAY be filtered on privileges of an authenticated user or as appropriate when no authentication is given.\n" } }, "@context": [ "https://www.w3.org/ns/activitystreams", "https://socialweb.coop/ns/testing/context.json" ] }
This test is part of the following Test Suites:
{ "input": { "object": { "help": "object with a liked property", "required": true, "rangeIncludes": [ "https://www.w3.org/ns/activitystreams#Actor" ] } }, "markdown": "---\n\ntype:\n- TestCase\ntags:\n- tests-activitypub-actor\nuuid:\n- 018c3df2-d6d8-7f62-805b-b71a96cc6170\n\nrespec:\n config:\n editors:\n - name: bengo\n url: \"https://bengo.is\"\n w3cid: 49026\n---\n\n# An ActivityPub Object `liked` Collection Must be a Collection\n\n## Background [<sup>?</sup>][test-background]\n\n[ActivityPub][activitypub] [ยง 5.5 Liked Collection](https://www.w3.org/TR/activitypub/#liked):\n> Every object MAY have a liked collection.\n> …\n> The liked collection MUST be either an OrderedCollection or a Collection\n\n## About This Test\n\nThis is a Test Case describing a rule to determine whether an ActivityPub Object is in partial conformance with the following behaviors required by [ActivityPub][activitypub].\n\n* [requirement d2db8da3-25d4-4dd9-9c9c-b2793fd899cf](https://socialweb.coop/activitypub/behaviors/d2db8da3-25d4-4dd9-9c9c-b2793fd899cf/) - The liked collection MUST be either an OrderedCollection or a Collection\n\n### Identifier\n\nThe identifier of this test is `urn:uuid:018c3df2-d6d8-7f62-805b-b71a96cc6170`.\n\n## Test Subject\n\nThe subject of this test is an ActivityPub Object.\n\n## Input [<sup>?</sup>][test-input]\n\nThis test requires the following [inputs](act-rules-input) indicating parts of the test subject:\n\n1. `object` - the object whose `liked` property will be tested\n * type: binary\n * constraints\n * should be JSON\n\n## Applicability [<sup>?</sup>][test-applicability]\n\nThis test applies to each of the liked collections derived from the values of the property on `object` named `liked`.\n\n### Prerequisites\n\n* `object` is a JSON object\n* `object` JSON object has a property named `liked`\n\n### How to Derive Test Targets from Input\n\n* let `targets` be a set\n* let `likedValues` be the result of\n * if `object.liked` is an Array, return it\n * else return an Array whose only item is the value of `object.liked`\n* for each item in `likedValues`\n * if item is a string\n * let itemFetched be the result of interpreting the string as an ActivityPub Object Identifier and fetching the corresponding ActivityPub Object.\n * add itemFetched to `targets`\n * else add item to `targets`\n* return `targets`\n\n## Expectations [<sup>?</sup>][test-expectations]\n\nFor every target `target`\n\n* `target` is a JSON object\n* `target` has a property named `type`\n* the values of the `target`'s `type` property must be one of\n * an array containing the string \"Collection\"\n * an array containing the string \"OrderedCollection\"\n * the string \"Collection\"\n * the string \"OrderedCollection\"\n\n## Assumptions [<sup>?</sup>][test-assumptions]\n\n## Test Cases [<sup>?</sup>][test-test-cases]\n\nWhat follows are some specific cases of applything this test.\n\n### Passed Example 1\n\ninputs\n\n* `object`:\n\n ```json\n {\n \"liked\": {\n \"type\": \"Collection\"\n }\n }\n ```\n\ntest targets\n\n* ```json\n {\n \"type\": \"Collection\"\n }\n ```\n\n * outcome: `passed`\n\n### Passed Example 2\n\ninputs\n\n* `object`:\n\n ```json\n {\n \"liked\": {\n \"type\": \"OrderedCollection\"\n }\n }\n ```\n\ntest targets\n\n* ```json\n {\n \"type\": \"OrderedCollection\"\n }\n ```\n\n * outcome: `passed`\n\n### Passed Example 3\n\ninputs\n\n* `object`:\n\n ```json\n {\n \"liked\": {\n \"type\": [\"FancyCollection\", \"OrderedCollection\"]\n }\n }\n ```\n\ntest targets\n\n* ```json\n {\n \"type\": [\"FancyCollection\", \"OrderedCollection\"]\n }\n ```\n\n * outcome: `passed`\n * rationale: `\"FancyCollection\"` is not well-defined here, but this object still passes the test because at least one of the `type` property values is `OrderedCollection` and thus satisfies the requirement as interpreted.\n\n### Failed Example 1 - Likes is a number\n\ninputs\n\n* `object`:\n\n ```json\n {\n \"liked\": 1\n }\n ```\n\ntest targets\n\n* ```json\n 1\n ```\n\n * outcome: `failed`\n\n### Failed Example 2 - Likes is an empty object\n\ninputs\n\n* `object`:\n\n ```json\n {\n \"liked\": {}\n }\n ```\n\ntest targets\n\n* ```json\n {}\n ```\n\n * outcome: `failed`\n\n### Failed Example 3 - Likes object type is array including only `\"Link\"`\n\ninputs\n\n* `object`:\n\n ```json\n {\n \"liked\": {\n \"type\": [\"Link\"]\n }\n }\n ```\n\ntest targets\n\n* ```json\n {\n \"type\": [\"Link\"]\n }\n ```\n\n * outcome: `failed`\n\n### Inapplicable Example 1\n\ninputs\n\n* `object`:\n\n ```json\n 1\n ```\n\nresult\n\n* outcome: `inapplicable`\n\n### Inapplicable Example 2 - object has no likes property\n\ninputs\n\n* `object`:\n\n ```json\n { \"foo\": \"bar\" }\n ```\n\nresult\n\n* outcome: `inapplicable`\n\n## Glossary [<sup>?</sup>](https://www.w3.org/TR/act-rules-format/#glossary)\n\n### `outcome`\n\nAn outcome is a conclusion that comes from evaluating a test on a test subject. An outcome can be one of the three following types:\n\n* `inapplicable`: No part of the test subject matches the applicability\n* `passed`: A test target meets all expectations\n* `failed`: A test target does not meet all expectations\n\n## Requirements Mapping [<sup>?</sup>][act-rules-requirements-mapping]\n\n* [ActivityPub requirement d2db8da3-25d4-4dd9-9c9c-b2793fd899cf](https://socialweb.coop/activitypub/behaviors/d2db8da3-25d4-4dd9-9c9c-b2793fd899cf/) - The liked collection MUST be either an OrderedCollection or a Collection\n * Required for Conformance to [ActivityPub][activitypub]\n * Outcome Mapping\n * when every test target has outcome `passed`, the requirement is satisfied by the test subject\n * when any test target has outcome `failed`, the requirement is not satisfied by the test subject\n * when any test target has outcome `inapplicable`, further testing is needed to determine requirement satisfaction\n\n## Issues [<sup>?</sup>][test-issues-list]\n\n## Change Log\n\n* 2023-12-06T07:07:25.913Z - init\n* 2023-12-18T04:43:02.981Z - add test cases based on automating this test\n\n[act-rules-requirements-mapping]: https://www.w3.org/TR/act-rules-format/#accessibility-requirements-mapping\n[activitypub]: https://www.w3.org/TR/activitypub/\n[test-applicability]: https://www.w3.org/TR/act-rules-format/#applicability\n[test-assumptions]: https://www.w3.org/TR/act-rules-format/#assumptions\n[test-background]: https://www.w3.org/TR/act-rules-format/#background\n[test-expectations]: https://www.w3.org/TR/act-rules-format/#expectations\n[test-input]: https://www.w3.org/TR/act-rules-format/#input\n[test-issues-list]: https://www.w3.org/TR/act-rules-format/#issues-list\n[test-test-cases]: https://www.w3.org/TR/act-rules-format/#test-cases\n", "name": "An ActivityPub Object `liked` Collection Must be a Collection", "description": "tests whether an ActivityPub Object has a liked collection with an appropriate Collection type", "slug": "liked-collection-must-be-a-collection", "inapplicableCases": [ { "name": "inapplicable example 1", "input": { "object": "1" }, "result": { "outcome": "inapplicable" } }, { "name": "inapplicble example 2 - object has no liked property", "input": { "object": "\n { \"foo\": \"bar\" }\n " }, "result": { "outcome": "inapplicable" } } ], "passedCases": [ { "name": "passed example 1", "input": { "object": "\n {\n \"liked\": {\n \"type\": \"Collection\"\n }\n }\n " }, "result": { "outcome": "passed" } }, { "name": "passed example 2", "input": { "object": "\n {\n \"liked\": {\n \"type\": [\"FancyCollection\", \"OrderedCollection\"]\n }\n }\n " }, "result": { "outcome": "passed" } } ], "failedCases": [ { "name": "failed example 1", "input": { "object": "\n {\n \"liked\": 1\n }\n " }, "result": { "outcome": "failed" } }, { "name": "failed example 2", "input": { "object": "\n {\n \"liked\": {}\n }\n " }, "result": { "outcome": "failed" } }, { "name": "failed example 3", "input": { "object": "\n {\n \"liked\": {\n \"type\": [\"Link\"]\n }\n }\n " }, "result": { "outcome": "failed" } } ], "uuid": "018c3df2-d6d8-7f62-805b-b71a96cc6170", "isPartOf": [ "https://socialweb.coop/activitypub/test-cases/" ], "requirementReference": [ { "id": "urn:uuid:d2db8da3-25d4-4dd9-9c9c-b2793fd899cf", "url": "https://socialweb.coop/activitypub/behaviors/d2db8da3-25d4-4dd9-9c9c-b2793fd899cf/" } ] }