Skip to content

Commit 14a0b38

Browse files
authored
Refactored cucumber setup to allow for multiple step definition files (#601)
no refs Miscellaneous refactorings to allow us to move to using multiple step definition files instead of one large file: - Introduced `support` directory to organize support files - Moved generic helper functions out of `stepdefs.js` and into their respective support files - Removed nearly all global state from `stepdefs.js` - Support files keep track of there global state (i.e `db.js` keeping track of database client instance) - Added `block_steps.js` to organize block related step definitions - Moved global static constants to environment variables I opted to just use the built in `World` rather than a custom one - We could maybe move to this at a later point and use it to keep track of global state etc
1 parent d454801 commit 14a0b38

File tree

11 files changed

+788
-791
lines changed

11 files changed

+788
-791
lines changed

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ services:
174174
- GCP_BUCKET_NAME=activitypub
175175
- GCP_STORAGE_EMULATOR_HOST=http://fake-gcs:4443
176176
- TAGS
177+
- URL_GHOST_ACTIVITY_PUB=http://fake-ghost-activitypub.test
178+
- URL_EXTERNAL_ACTIVITY_PUB=http://fake-external-activitypub.test
177179
command: /opt/activitypub/node_modules/.bin/cucumber-js
178180
depends_on:
179181
fake-ghost-activitypub:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { When } from '@cucumber/cucumber';
2+
3+
import { fetchActivityPub } from '../support/request.js';
4+
5+
When('we block {string}', async function (actorName) {
6+
const actor = this.actors[actorName];
7+
8+
this.response = await fetchActivityPub(
9+
`${process.env.URL_GHOST_ACTIVITY_PUB}/.ghost/activitypub/actions/block/${encodeURIComponent(actor.id)}`,
10+
{
11+
method: 'POST',
12+
},
13+
);
14+
});

0 commit comments

Comments
 (0)