applesauce-actions 0.0.0-next-20250716144720 → 0.0.0-next-20250718173521
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { from, Subject } from "rxjs";
|
|
2
|
-
import {
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
3
|
import { subscribeSpyTo } from "@hirez_io/observer-spy";
|
|
4
4
|
import { EventFactory } from "applesauce-factory";
|
|
5
5
|
import { EventStore } from "applesauce-core";
|
|
@@ -7,12 +7,8 @@ import { FakeUser } from "./fake-user.js";
|
|
|
7
7
|
import { ActionHub } from "../action-hub.js";
|
|
8
8
|
import { CreateProfile } from "../actions/profile.js";
|
|
9
9
|
const user = new FakeUser();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
events = new EventStore();
|
|
14
|
-
factory = new EventFactory({ signer: user });
|
|
15
|
-
});
|
|
10
|
+
const events = new EventStore();
|
|
11
|
+
const factory = new EventFactory({ signer: user });
|
|
16
12
|
describe("runAction", () => {
|
|
17
13
|
it("should handle action that return observables", async () => {
|
|
18
14
|
const e = [user.note(), user.profile({ name: "testing" })];
|
|
@@ -44,10 +44,6 @@ describe("exports", () => {
|
|
|
44
44
|
"RemoveRelayFromRelaySet",
|
|
45
45
|
"RemoveSearchRelay",
|
|
46
46
|
"RemoveUserFromFollowSet",
|
|
47
|
-
"ReplyToLegacyMessage",
|
|
48
|
-
"ReplyToWrappedMessage",
|
|
49
|
-
"SendLegacyMessage",
|
|
50
|
-
"SendWrappedMessage",
|
|
51
47
|
"SetDefaultBlossomServer",
|
|
52
48
|
"SetListMetadata",
|
|
53
49
|
"UnbookmarkEvent",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
2
|
import { EventStore } from "applesauce-core";
|
|
3
3
|
import { EventFactory } from "applesauce-factory";
|
|
4
4
|
import { kinds } from "nostr-tools";
|
|
@@ -24,7 +24,6 @@ beforeEach(() => {
|
|
|
24
24
|
created_at: Math.floor(Date.now() / 1000),
|
|
25
25
|
});
|
|
26
26
|
events.add(muteList);
|
|
27
|
-
vi.useFakeTimers();
|
|
28
27
|
});
|
|
29
28
|
describe("MuteThread", () => {
|
|
30
29
|
it("should add an event to public tags in mute list", async () => {
|
|
@@ -44,12 +43,9 @@ describe("MuteThread", () => {
|
|
|
44
43
|
});
|
|
45
44
|
describe("UnmuteThread", () => {
|
|
46
45
|
it("should remove an event from public tags in mute list", async () => {
|
|
47
|
-
vi.setSystemTime(new Date("2025-01-01T00:00:00Z"));
|
|
48
46
|
// First add the thread to mute list
|
|
49
47
|
const addSpy = subscribeSpyTo(hub.exec(MuteThread, testEventId), { expectErrors: false });
|
|
50
48
|
await addSpy.onComplete();
|
|
51
|
-
// Wait a second to ensure events have newer created_at
|
|
52
|
-
await vi.advanceTimersByTime(1000);
|
|
53
49
|
// Then unmute it
|
|
54
50
|
const spy = subscribeSpyTo(hub.exec(UnmuteThread, testEventId), { expectErrors: false });
|
|
55
51
|
await spy.onComplete();
|
|
@@ -58,12 +54,9 @@ describe("UnmuteThread", () => {
|
|
|
58
54
|
expect(mutedThings.threads).not.toContain(testEventId);
|
|
59
55
|
});
|
|
60
56
|
it("should remove an event from hidden tags in mute list", async () => {
|
|
61
|
-
vi.setSystemTime(new Date("2025-01-01T00:00:00Z"));
|
|
62
57
|
// First add the thread to hidden mute list
|
|
63
58
|
const addSpy = subscribeSpyTo(hub.exec(MuteThread, testEventId, true), { expectErrors: false });
|
|
64
59
|
await addSpy.onComplete();
|
|
65
|
-
// Wait a second to ensure events have newer created_at
|
|
66
|
-
await vi.advanceTimersByTime(2000);
|
|
67
60
|
// Then unmute it
|
|
68
61
|
const spy = subscribeSpyTo(hub.exec(UnmuteThread, testEventId, true), { expectErrors: false });
|
|
69
62
|
await spy.onComplete();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-actions",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250718173521",
|
|
4
4
|
"description": "A package for performing common nostr actions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"applesauce-core": "^2.3.0",
|
|
36
|
-
"applesauce-factory": "0.0.0-next-
|
|
36
|
+
"applesauce-factory": "0.0.0-next-20250718173521",
|
|
37
37
|
"nostr-tools": "^2.13",
|
|
38
38
|
"rxjs": "^7.8.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@hirez_io/observer-spy": "^2.2.0",
|
|
42
42
|
"@types/debug": "^4.1.12",
|
|
43
|
-
"applesauce-signers": "
|
|
43
|
+
"applesauce-signers": "0.0.0-next-20250718173521",
|
|
44
44
|
"nanoid": "^5.1.5",
|
|
45
45
|
"typescript": "^5.8.3",
|
|
46
46
|
"vitest": "^3.2.3"
|