mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
remove e2e relics
This commit is contained in:
parent
3a56878899
commit
5664c0f26d
@ -1,46 +0,0 @@
|
||||
// features/support/steps.js
|
||||
import { Given, When, Then, After, AfterAll } from 'cucumber'
|
||||
import Factory, { cleanDatabase } from '../../backend/src/db/factories'
|
||||
import dotenv from 'dotenv'
|
||||
import expect from 'expect'
|
||||
|
||||
const debug = require('debug')('ea:test:steps')
|
||||
|
||||
After(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
Given('our CLIENT_URI is {string}', function (string) {
|
||||
expect(string).toEqual('http://localhost:3000')
|
||||
// This is just for documentation. When you see URLs in the response of
|
||||
// scenarios you, should be able to tell that it's coming from this
|
||||
// environment variable.
|
||||
});
|
||||
|
||||
Given('we have the following users in our database:', function (dataTable) {
|
||||
return Promise.all(dataTable.hashes().map(({ slug, name }) => {
|
||||
return Factory.build('user', {
|
||||
name,
|
||||
slug,
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
When('I send a GET request to {string}', async function (pathname) {
|
||||
const response = await this.get(pathname)
|
||||
this.lastContentType = response.lastContentType
|
||||
|
||||
this.lastResponses.push(response.lastResponse)
|
||||
this.statusCode = response.statusCode
|
||||
})
|
||||
|
||||
Then('the server responds with a HTTP Status {int} and the following json:', function (statusCode, docString) {
|
||||
expect(this.statusCode).toEqual(statusCode)
|
||||
const [ lastResponse ] = this.lastResponses
|
||||
expect(JSON.parse(lastResponse)).toMatchObject(JSON.parse(docString))
|
||||
})
|
||||
|
||||
Then('the Content-Type is {string}', function (contentType) {
|
||||
expect(this.lastContentType).toEqual(contentType)
|
||||
})
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
Feature: Webfinger discovery
|
||||
From an external server, e.g. Mastodon
|
||||
I want to search for an actor alias
|
||||
In order to follow the actor
|
||||
|
||||
Background:
|
||||
Given our CLIENT_URI is "http://localhost:3000"
|
||||
And we have the following users in our database:
|
||||
| name | slug |
|
||||
| Peter Lustiger | peter-lustiger |
|
||||
|
||||
Scenario: Search a user
|
||||
When I send a GET request to "/.well-known/webfinger?resource=acct:peter-lustiger@localhost"
|
||||
Then the server responds with a HTTP Status 200 and the following json:
|
||||
"""
|
||||
{
|
||||
"subject": "acct:peter-lustiger@localhost:3000",
|
||||
"links": [
|
||||
{
|
||||
"rel": "self",
|
||||
"type": "application/activity+json",
|
||||
"href": "http://localhost:3000/activitypub/users/peter-lustiger"
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
And the Content-Type is "application/jrd+json; charset=utf-8"
|
||||
|
||||
Scenario: Search without result
|
||||
When I send a GET request to "/.well-known/webfinger?resource=acct:nonexisting@localhost"
|
||||
Then the server responds with a HTTP Status 404 and the following json:
|
||||
"""
|
||||
{
|
||||
"error": "No record found for \"nonexisting@localhost\"."
|
||||
}
|
||||
"""
|
||||
@ -1,38 +0,0 @@
|
||||
import { setWorldConstructor } from 'cucumber'
|
||||
import request from 'request'
|
||||
|
||||
class CustomWorld {
|
||||
constructor () {
|
||||
// webFinger.feature
|
||||
this.lastResponses = []
|
||||
this.lastContentType = null
|
||||
this.lastInboxUrl = null
|
||||
this.lastActivity = null
|
||||
// object-article.feature
|
||||
this.statusCode = null
|
||||
}
|
||||
get (pathname) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request(`http://localhost:4000/${this.replaceSlashes(pathname)}`, {
|
||||
headers: {
|
||||
'Accept': 'application/activity+json'
|
||||
}}, (error, response, body) => {
|
||||
if (!error) {
|
||||
resolve({
|
||||
lastResponse: body,
|
||||
lastContentType: response.headers['content-type'],
|
||||
statusCode: response.statusCode
|
||||
})
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
replaceSlashes (pathname) {
|
||||
return pathname.replace(/^\/+/, '')
|
||||
}
|
||||
}
|
||||
|
||||
setWorldConstructor(CustomWorld)
|
||||
Loading…
x
Reference in New Issue
Block a user