@echovisionlab/geul-event 0.1.1 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@echovisionlab/geul-event",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,46 @@
1
+ import { create, fromBinary, toBinary } from "@bufbuild/protobuf";
2
+ import { describe, expect, it } from "vitest";
3
+ import { ListFormSubmissionsRequestSchema } from "@echovisionlab/geul-proto/secure/form_pb.ts";
4
+ import { ArtistWorkSchema } from "@echovisionlab/geul-proto/public/artist_pb.ts";
5
+ import { WorkType } from "@echovisionlab/geul-proto/public/work_pb.ts";
6
+ import { TimestampSchema } from "@bufbuild/protobuf/wkt";
7
+
8
+ describe("artist and form query contracts", () => {
9
+ it("round-trips every artist work type", () => {
10
+ const types = [
11
+ WorkType.MUSIC_PROJECT,
12
+ WorkType.PORTFOLIO,
13
+ WorkType.ARTICLE,
14
+ WorkType.CONTRIBUTION,
15
+ ];
16
+
17
+ for (const type of types) {
18
+ const work = create(ArtistWorkSchema, { id: "work-1", type });
19
+ const roundTripped = fromBinary(
20
+ ArtistWorkSchema,
21
+ toBinary(ArtistWorkSchema, work),
22
+ );
23
+
24
+ expect(roundTripped.type).toBe(type);
25
+ }
26
+ });
27
+
28
+ it("round-trips all form submission filters with timestamp presence", () => {
29
+ const request = create(ListFormSubmissionsRequestSchema, {
30
+ formId: "form-1",
31
+ search: "a%_\\b",
32
+ countryCode: "US",
33
+ createdAtFrom: create(TimestampSchema, { seconds: 1_800_000_000n }),
34
+ createdAtBefore: create(TimestampSchema, { seconds: 1_800_003_600n }),
35
+ });
36
+ const roundTripped = fromBinary(
37
+ ListFormSubmissionsRequestSchema,
38
+ toBinary(ListFormSubmissionsRequestSchema, request),
39
+ );
40
+
41
+ expect(roundTripped.search).toBe("a%_\\b");
42
+ expect(roundTripped.countryCode).toBe("US");
43
+ expect(roundTripped.createdAtFrom?.seconds).toBe(1_800_000_000n);
44
+ expect(roundTripped.createdAtBefore?.seconds).toBe(1_800_003_600n);
45
+ });
46
+ });
@@ -15,7 +15,6 @@ const spec = parse(
15
15
  readFileSync(resolve(process.cwd(), "asyncapi/asyncapi.yaml"), "utf8"),
16
16
  ) as {
17
17
  channels: Record<string, AsyncAPIChannel>;
18
- components: { messages: Record<string, unknown> };
19
18
  };
20
19
 
21
20
  describe("durable asynchronous event model", () => {
@@ -92,34 +91,4 @@ describe("durable asynchronous event model", () => {
92
91
  ],
93
92
  });
94
93
  });
95
-
96
- it("keeps the retired generic render queues and messages absent", () => {
97
- for (const queue of [
98
- "post.render",
99
- "work.render",
100
- "program_event.render",
101
- "privacy.render",
102
- "terms.render",
103
- ]) {
104
- expect(Object.values(Queues)).not.toContain(queue);
105
- }
106
- for (const channel of [
107
- "postRender",
108
- "workRender",
109
- "programEventRender",
110
- "privacyRender",
111
- "termsRender",
112
- ]) {
113
- expect(Object.keys(spec.channels)).not.toContain(channel);
114
- }
115
- for (const message of [
116
- "PostRenderRequest",
117
- "WorkRenderRequest",
118
- "ProgramEventRenderRequest",
119
- "PrivacyRenderRequest",
120
- "TermsRenderRequest",
121
- ]) {
122
- expect(Object.keys(spec.components.messages)).not.toContain(message);
123
- }
124
- });
125
94
  });