mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
feat(federation): Finalize Versia 0.6 port
This commit is contained in:
parent
fca30b4dad
commit
b7e77097ba
20 changed files with 2788 additions and 439 deletions
25
packages/api/routes/versia/v0.6/inbox.test.ts
vendored
25
packages/api/routes/versia/v0.6/inbox.test.ts
vendored
|
|
@ -40,6 +40,17 @@ mock(new URL("/.well-known/versia", instanceUrl).href, {
|
|||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: {
|
||||
versions: ["0.6.0"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
mock(new URL("/.versia/v0.6/instance", instanceUrl).href, {
|
||||
response: {
|
||||
headers: {
|
||||
"Content-Type": "application/vnd.versia+json; charset=utf-8",
|
||||
},
|
||||
data: new VersiaEntities.InstanceMetadata({
|
||||
type: "InstanceMetadata",
|
||||
name: "Versia",
|
||||
|
|
@ -70,7 +81,7 @@ mock(new URL("/.well-known/versia", instanceUrl).href, {
|
|||
mock(new URL(`/.versia/v0.6/entities/User/${userId}`, instanceUrl).href, {
|
||||
response: {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/vnd.versia+json; charset=utf-8",
|
||||
},
|
||||
data: new VersiaEntities.User({
|
||||
id: userId,
|
||||
|
|
@ -132,7 +143,7 @@ describe("Inbox Tests", () => {
|
|||
|
||||
const signedRequest = await sign(
|
||||
instanceKeys.privateKey,
|
||||
new URL(exampleNote.data.author),
|
||||
instanceUrl,
|
||||
new Request(inboxUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -151,6 +162,8 @@ describe("Inbox Tests", () => {
|
|||
body: signedRequest.body,
|
||||
});
|
||||
|
||||
console.log(await response.text());
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
|
||||
await sleep(500);
|
||||
|
|
@ -174,7 +187,7 @@ describe("Inbox Tests", () => {
|
|||
|
||||
const signedRequest = await sign(
|
||||
instanceKeys.privateKey,
|
||||
new URL(exampleRequest.data.author),
|
||||
instanceUrl,
|
||||
new Request(inboxUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -227,7 +240,7 @@ describe("Inbox Tests", () => {
|
|||
|
||||
const signedRequest = await sign(
|
||||
instanceKeys.privateKey,
|
||||
new URL(exampleRequest.data.author),
|
||||
instanceUrl,
|
||||
new Request(inboxUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -322,7 +335,7 @@ describe("Inbox Tests", () => {
|
|||
|
||||
const signedRequest = await sign(
|
||||
instanceKeys.privateKey,
|
||||
new URL(exampleRequest.data.author),
|
||||
instanceUrl,
|
||||
new Request(inboxUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -402,7 +415,7 @@ describe("Inbox Tests", () => {
|
|||
|
||||
const signedRequest = await sign(
|
||||
instanceKeys.privateKey,
|
||||
new URL(exampleRequest.data.author),
|
||||
instanceUrl,
|
||||
new Request(inboxUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue