npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@socialweb.coop/activitypub-testing

v0.7.0

Published

tools for testing implementations of [ActivityPub][ActivityPub], a decentralized social networking protocol.

Downloads

22

Readme

@socialweb.coop/activitypub-testing

tools for testing implementations of [ActivityPub][ActivityPub], a decentralized social networking protocol.

How to use the activitypub-testing CLI

If you have npm installed, You may be able to use the activitypub-testing cli without downloading this source code.

ad-hoc usage using npx

For ad-hoc usage, try:

⚡  npx @socialweb.coop/activitypub-testing help

activitypub-testing

What?
  activitypub-testing is a cli for testing implementations of ActivityPub[0]

Usage:
  # browse all the tests
  activitypub-testing get tests [--output=<mediaType>]
  # inspect a single test
  activitypub-testing get test --uuid=<uuid> [--output=<mediaType>]
  # run a test
  activitypub-testing run test (--uuid=<uuid> | --slug=<slug>) --inputs.anyInputName=<inputs.anyInputName>
  activitypub-testing [--help] [-h] [help]

Options:
  -h --help        Show this help text.
  -o --output      Choose output media type (default `text`, also allows `json`, `yaml`)

Examples:
  # runs test inbox-must-be-an-orderedcollection[1] against a valid actor fetched via https
  activitypub-testing \
    test \
    --uuid '5e94d155-ed4a-4d71-b797-d7c387736ecf' \
    --inputs.object="$(curl -s 'https://socialweb.coop/activitypub/actors/with-empty-inbox.json')"

[0]: https://en.wikipedia.org/wiki/ActivityPub
[1]: https://socialweb.coop/activitypub/test-cases/inbox-must-be-an-orderedcollection/

run test by slug

⚡  npx @socialweb.coop/activitypub-testing run test --slug actor-must-serve-as2-object-to-get --inputs.time="T1M" --inputs.id="https://bengo.is/actor.json"
{
  "type": "Assertion",
  "test": {
    "id": "urn:uuid:e7ee491d-88d7-4e67-80c8-f74781bb247c",
    "uuid": "e7ee491d-88d7-4e67-80c8-f74781bb247c",
    "url": "https://socialweb.coop/activitypub/test-cases/actor-must-serve-as2-object-to-get/",
    "slug": "actor-must-serve-as2-object-to-get"
  },
  "result": {
    "outcome": "passed"
  },
  "@context": [
    "https://socialweb.coop/ns/testing/context.json"
  ]
}

or

run test by uuid

⚡ npx @socialweb.coop/activitypub-testing run test --uuid 'e7ee491d-88d7-4e67-80c8-f74781bb247c' --inputs.time="T1M" --inputs.id="https://bengo.is/404"       
{
  "type": "Assertion",
  "test": {
    "id": "urn:uuid:e7ee491d-88d7-4e67-80c8-f74781bb247c",
    "uuid": "e7ee491d-88d7-4e67-80c8-f74781bb247c",
    "url": "https://socialweb.coop/activitypub/test-cases/actor-must-serve-as2-object-to-get/",
    "slug": "actor-must-serve-as2-object-to-get"
  },
  "result": {
    "outcome": "failed",
    "info": "unable to parse response body as JSON",
    "pointer": {
      "response": {
        "body": "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx/1.25.2</center>\r\n</body>\r\n</html>\r\n",
        "statusCodeValue": "404",
        "headers": []
      }
    }
  },
  "@context": [
    "https://socialweb.coop/ns/testing/context.json"
  ]
}

install globally using npm

Or to install an activitypub-testing command globally for repeat usage, run:

npm install -g @socialweb.coop/activitypub-testing

npm install -g should have installed activitypub-testing to your shell PATH. The following should work in your command prompt

activitypub-testing --help

Developing this Repository

Developing tests

See ./src/tests/ for the source code.

Each ActivityPub test case should be in a folder in that directory named after the test slug, e.g. ./tests/actor-must-serve-as2-object-to-get

Developing the activitypub-testing CLI

See ./src/cli.js for the source code.

You should be able to run the cli.js script like

⚡  ./src/cli.js --uuid=test-uuid
no test found with uuid of test-uuid

npm scripts

These are in ./package.json and each has a name. Run like pnpm run <name>

  • build - build the source code into ./dist
  • lint - check source code against lint rules
  • activitypub-testing - run the activitypub-testing CLI