@fedify/testing 2.0.0-dev.379 → 2.0.0-dev.380
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mod.cjs +10 -35
- package/dist/mod.js +10 -35
- package/package.json +2 -2
package/dist/mod.cjs
CHANGED
|
@@ -159,7 +159,7 @@ const noopTracerProvider = { getTracer: () => ({
|
|
|
159
159
|
}) };
|
|
160
160
|
/**
|
|
161
161
|
* Helper function to expand URI templates with values.
|
|
162
|
-
* Supports simple placeholders like {identifier},
|
|
162
|
+
* Supports simple placeholders like {identifier}, etc.
|
|
163
163
|
* @param template The URI template pattern
|
|
164
164
|
* @param values The values to substitute
|
|
165
165
|
* @returns The expanded URI path
|
|
@@ -580,10 +580,7 @@ var MockContext = class MockContext {
|
|
|
580
580
|
}
|
|
581
581
|
getActorUri(identifier) {
|
|
582
582
|
if (this.federation instanceof MockFederation && this.federation.actorPath) {
|
|
583
|
-
const path = expandUriTemplate(this.federation.actorPath, {
|
|
584
|
-
identifier,
|
|
585
|
-
handle: identifier
|
|
586
|
-
});
|
|
583
|
+
const path = expandUriTemplate(this.federation.actorPath, { identifier });
|
|
587
584
|
return new URL(path, this.origin);
|
|
588
585
|
}
|
|
589
586
|
return new URL(`/users/${identifier}`, this.origin);
|
|
@@ -601,10 +598,7 @@ var MockContext = class MockContext {
|
|
|
601
598
|
}
|
|
602
599
|
getOutboxUri(identifier) {
|
|
603
600
|
if (this.federation instanceof MockFederation && this.federation.outboxPath) {
|
|
604
|
-
const path = expandUriTemplate(this.federation.outboxPath, {
|
|
605
|
-
identifier,
|
|
606
|
-
handle: identifier
|
|
607
|
-
});
|
|
601
|
+
const path = expandUriTemplate(this.federation.outboxPath, { identifier });
|
|
608
602
|
return new URL(path, this.origin);
|
|
609
603
|
}
|
|
610
604
|
return new URL(`/users/${identifier}/outbox`, this.origin);
|
|
@@ -612,10 +606,7 @@ var MockContext = class MockContext {
|
|
|
612
606
|
getInboxUri(identifier) {
|
|
613
607
|
if (identifier) {
|
|
614
608
|
if (this.federation instanceof MockFederation && this.federation.inboxPath) {
|
|
615
|
-
const path = expandUriTemplate(this.federation.inboxPath, {
|
|
616
|
-
identifier,
|
|
617
|
-
handle: identifier
|
|
618
|
-
});
|
|
609
|
+
const path = expandUriTemplate(this.federation.inboxPath, { identifier });
|
|
619
610
|
return new URL(path, this.origin);
|
|
620
611
|
}
|
|
621
612
|
return new URL(`/users/${identifier}/inbox`, this.origin);
|
|
@@ -625,50 +616,35 @@ var MockContext = class MockContext {
|
|
|
625
616
|
}
|
|
626
617
|
getFollowingUri(identifier) {
|
|
627
618
|
if (this.federation instanceof MockFederation && this.federation.followingPath) {
|
|
628
|
-
const path = expandUriTemplate(this.federation.followingPath, {
|
|
629
|
-
identifier,
|
|
630
|
-
handle: identifier
|
|
631
|
-
});
|
|
619
|
+
const path = expandUriTemplate(this.federation.followingPath, { identifier });
|
|
632
620
|
return new URL(path, this.origin);
|
|
633
621
|
}
|
|
634
622
|
return new URL(`/users/${identifier}/following`, this.origin);
|
|
635
623
|
}
|
|
636
624
|
getFollowersUri(identifier) {
|
|
637
625
|
if (this.federation instanceof MockFederation && this.federation.followersPath) {
|
|
638
|
-
const path = expandUriTemplate(this.federation.followersPath, {
|
|
639
|
-
identifier,
|
|
640
|
-
handle: identifier
|
|
641
|
-
});
|
|
626
|
+
const path = expandUriTemplate(this.federation.followersPath, { identifier });
|
|
642
627
|
return new URL(path, this.origin);
|
|
643
628
|
}
|
|
644
629
|
return new URL(`/users/${identifier}/followers`, this.origin);
|
|
645
630
|
}
|
|
646
631
|
getLikedUri(identifier) {
|
|
647
632
|
if (this.federation instanceof MockFederation && this.federation.likedPath) {
|
|
648
|
-
const path = expandUriTemplate(this.federation.likedPath, {
|
|
649
|
-
identifier,
|
|
650
|
-
handle: identifier
|
|
651
|
-
});
|
|
633
|
+
const path = expandUriTemplate(this.federation.likedPath, { identifier });
|
|
652
634
|
return new URL(path, this.origin);
|
|
653
635
|
}
|
|
654
636
|
return new URL(`/users/${identifier}/liked`, this.origin);
|
|
655
637
|
}
|
|
656
638
|
getFeaturedUri(identifier) {
|
|
657
639
|
if (this.federation instanceof MockFederation && this.federation.featuredPath) {
|
|
658
|
-
const path = expandUriTemplate(this.federation.featuredPath, {
|
|
659
|
-
identifier,
|
|
660
|
-
handle: identifier
|
|
661
|
-
});
|
|
640
|
+
const path = expandUriTemplate(this.federation.featuredPath, { identifier });
|
|
662
641
|
return new URL(path, this.origin);
|
|
663
642
|
}
|
|
664
643
|
return new URL(`/users/${identifier}/featured`, this.origin);
|
|
665
644
|
}
|
|
666
645
|
getFeaturedTagsUri(identifier) {
|
|
667
646
|
if (this.federation instanceof MockFederation && this.federation.featuredTagsPath) {
|
|
668
|
-
const path = expandUriTemplate(this.federation.featuredTagsPath, {
|
|
669
|
-
identifier,
|
|
670
|
-
handle: identifier
|
|
671
|
-
});
|
|
647
|
+
const path = expandUriTemplate(this.federation.featuredTagsPath, { identifier });
|
|
672
648
|
return new URL(path, this.origin);
|
|
673
649
|
}
|
|
674
650
|
return new URL(`/users/${identifier}/tags`, this.origin);
|
|
@@ -682,8 +658,7 @@ var MockContext = class MockContext {
|
|
|
682
658
|
const parts = uri.pathname.split("/");
|
|
683
659
|
if (parts.length >= 3) return {
|
|
684
660
|
type: "actor",
|
|
685
|
-
identifier: parts[2]
|
|
686
|
-
handle: parts[2]
|
|
661
|
+
identifier: parts[2]
|
|
687
662
|
};
|
|
688
663
|
}
|
|
689
664
|
return null;
|
package/dist/mod.js
CHANGED
|
@@ -136,7 +136,7 @@ const noopTracerProvider = { getTracer: () => ({
|
|
|
136
136
|
}) };
|
|
137
137
|
/**
|
|
138
138
|
* Helper function to expand URI templates with values.
|
|
139
|
-
* Supports simple placeholders like {identifier},
|
|
139
|
+
* Supports simple placeholders like {identifier}, etc.
|
|
140
140
|
* @param template The URI template pattern
|
|
141
141
|
* @param values The values to substitute
|
|
142
142
|
* @returns The expanded URI path
|
|
@@ -557,10 +557,7 @@ var MockContext = class MockContext {
|
|
|
557
557
|
}
|
|
558
558
|
getActorUri(identifier) {
|
|
559
559
|
if (this.federation instanceof MockFederation && this.federation.actorPath) {
|
|
560
|
-
const path = expandUriTemplate(this.federation.actorPath, {
|
|
561
|
-
identifier,
|
|
562
|
-
handle: identifier
|
|
563
|
-
});
|
|
560
|
+
const path = expandUriTemplate(this.federation.actorPath, { identifier });
|
|
564
561
|
return new URL(path, this.origin);
|
|
565
562
|
}
|
|
566
563
|
return new URL(`/users/${identifier}`, this.origin);
|
|
@@ -578,10 +575,7 @@ var MockContext = class MockContext {
|
|
|
578
575
|
}
|
|
579
576
|
getOutboxUri(identifier) {
|
|
580
577
|
if (this.federation instanceof MockFederation && this.federation.outboxPath) {
|
|
581
|
-
const path = expandUriTemplate(this.federation.outboxPath, {
|
|
582
|
-
identifier,
|
|
583
|
-
handle: identifier
|
|
584
|
-
});
|
|
578
|
+
const path = expandUriTemplate(this.federation.outboxPath, { identifier });
|
|
585
579
|
return new URL(path, this.origin);
|
|
586
580
|
}
|
|
587
581
|
return new URL(`/users/${identifier}/outbox`, this.origin);
|
|
@@ -589,10 +583,7 @@ var MockContext = class MockContext {
|
|
|
589
583
|
getInboxUri(identifier) {
|
|
590
584
|
if (identifier) {
|
|
591
585
|
if (this.federation instanceof MockFederation && this.federation.inboxPath) {
|
|
592
|
-
const path = expandUriTemplate(this.federation.inboxPath, {
|
|
593
|
-
identifier,
|
|
594
|
-
handle: identifier
|
|
595
|
-
});
|
|
586
|
+
const path = expandUriTemplate(this.federation.inboxPath, { identifier });
|
|
596
587
|
return new URL(path, this.origin);
|
|
597
588
|
}
|
|
598
589
|
return new URL(`/users/${identifier}/inbox`, this.origin);
|
|
@@ -602,50 +593,35 @@ var MockContext = class MockContext {
|
|
|
602
593
|
}
|
|
603
594
|
getFollowingUri(identifier) {
|
|
604
595
|
if (this.federation instanceof MockFederation && this.federation.followingPath) {
|
|
605
|
-
const path = expandUriTemplate(this.federation.followingPath, {
|
|
606
|
-
identifier,
|
|
607
|
-
handle: identifier
|
|
608
|
-
});
|
|
596
|
+
const path = expandUriTemplate(this.federation.followingPath, { identifier });
|
|
609
597
|
return new URL(path, this.origin);
|
|
610
598
|
}
|
|
611
599
|
return new URL(`/users/${identifier}/following`, this.origin);
|
|
612
600
|
}
|
|
613
601
|
getFollowersUri(identifier) {
|
|
614
602
|
if (this.federation instanceof MockFederation && this.federation.followersPath) {
|
|
615
|
-
const path = expandUriTemplate(this.federation.followersPath, {
|
|
616
|
-
identifier,
|
|
617
|
-
handle: identifier
|
|
618
|
-
});
|
|
603
|
+
const path = expandUriTemplate(this.federation.followersPath, { identifier });
|
|
619
604
|
return new URL(path, this.origin);
|
|
620
605
|
}
|
|
621
606
|
return new URL(`/users/${identifier}/followers`, this.origin);
|
|
622
607
|
}
|
|
623
608
|
getLikedUri(identifier) {
|
|
624
609
|
if (this.federation instanceof MockFederation && this.federation.likedPath) {
|
|
625
|
-
const path = expandUriTemplate(this.federation.likedPath, {
|
|
626
|
-
identifier,
|
|
627
|
-
handle: identifier
|
|
628
|
-
});
|
|
610
|
+
const path = expandUriTemplate(this.federation.likedPath, { identifier });
|
|
629
611
|
return new URL(path, this.origin);
|
|
630
612
|
}
|
|
631
613
|
return new URL(`/users/${identifier}/liked`, this.origin);
|
|
632
614
|
}
|
|
633
615
|
getFeaturedUri(identifier) {
|
|
634
616
|
if (this.federation instanceof MockFederation && this.federation.featuredPath) {
|
|
635
|
-
const path = expandUriTemplate(this.federation.featuredPath, {
|
|
636
|
-
identifier,
|
|
637
|
-
handle: identifier
|
|
638
|
-
});
|
|
617
|
+
const path = expandUriTemplate(this.federation.featuredPath, { identifier });
|
|
639
618
|
return new URL(path, this.origin);
|
|
640
619
|
}
|
|
641
620
|
return new URL(`/users/${identifier}/featured`, this.origin);
|
|
642
621
|
}
|
|
643
622
|
getFeaturedTagsUri(identifier) {
|
|
644
623
|
if (this.federation instanceof MockFederation && this.federation.featuredTagsPath) {
|
|
645
|
-
const path = expandUriTemplate(this.federation.featuredTagsPath, {
|
|
646
|
-
identifier,
|
|
647
|
-
handle: identifier
|
|
648
|
-
});
|
|
624
|
+
const path = expandUriTemplate(this.federation.featuredTagsPath, { identifier });
|
|
649
625
|
return new URL(path, this.origin);
|
|
650
626
|
}
|
|
651
627
|
return new URL(`/users/${identifier}/tags`, this.origin);
|
|
@@ -659,8 +635,7 @@ var MockContext = class MockContext {
|
|
|
659
635
|
const parts = uri.pathname.split("/");
|
|
660
636
|
if (parts.length >= 3) return {
|
|
661
637
|
type: "actor",
|
|
662
|
-
identifier: parts[2]
|
|
663
|
-
handle: parts[2]
|
|
638
|
+
identifier: parts[2]
|
|
664
639
|
};
|
|
665
640
|
}
|
|
666
641
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/testing",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.380+cb8f5a53",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"package.json"
|
|
51
51
|
],
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@fedify/fedify": "^2.0.0-dev.
|
|
53
|
+
"@fedify/fedify": "^2.0.0-dev.380+cb8f5a53"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"es-toolkit": "1.43.0"
|