@hobenakicoffee/libraries 0.0.6 → 0.0.7
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,16 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
SupporterPlatforms,
|
|
4
|
+
PaymentStatuses,
|
|
5
|
+
ServiceTypes,
|
|
6
|
+
PaymentTypes,
|
|
7
|
+
} from "./index";
|
|
8
|
+
import type {
|
|
9
|
+
SupporterPlatform,
|
|
10
|
+
PaymentStatus,
|
|
11
|
+
ServiceType,
|
|
12
|
+
PaymentType,
|
|
13
|
+
} from "./index";
|
|
4
14
|
|
|
5
15
|
describe("SupporterPlatforms", () => {
|
|
6
16
|
test("should contain all expected platform keys", () => {
|
|
@@ -149,3 +159,40 @@ describe("ServiceTypes", () => {
|
|
|
149
159
|
});
|
|
150
160
|
});
|
|
151
161
|
});
|
|
162
|
+
|
|
163
|
+
describe("PaymentTypes", () => {
|
|
164
|
+
test("should contain all expected keys", () => {
|
|
165
|
+
const expectedKeys = ["SUBSCRIPTION", "ONE_TIME"];
|
|
166
|
+
|
|
167
|
+
expect(Object.keys(PaymentTypes)).toEqual(expectedKeys);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test("should have correct values for each type", () => {
|
|
171
|
+
expect(PaymentTypes.SUBSCRIPTION).toBe("subscription");
|
|
172
|
+
expect(PaymentTypes.ONE_TIME).toBe("one-time");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("should be read-only at compile time", () => {
|
|
176
|
+
// TypeScript prevents modification at compile time with 'as const'
|
|
177
|
+
// This test verifies the structure is correct
|
|
178
|
+
expect(Object.isFrozen(PaymentTypes)).toBe(false);
|
|
179
|
+
expect(typeof PaymentTypes).toBe("object");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("PaymentType type should accept valid type values", () => {
|
|
183
|
+
const validType: PaymentType = "subscription";
|
|
184
|
+
expect(validType).toBe("subscription");
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("should have 2 payment types", () => {
|
|
188
|
+
expect(Object.keys(PaymentTypes).length).toBe(2);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
test("all values should be lowercase or kebab-case strings", () => {
|
|
192
|
+
Object.values(PaymentTypes).forEach((type) => {
|
|
193
|
+
expect(typeof type).toBe("string");
|
|
194
|
+
// Check that it contains lowercase letters, hyphens, or underscores
|
|
195
|
+
expect(type).toMatch(/^[a-z_-]+$/);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
package/src/constants/index.ts
CHANGED
|
@@ -29,6 +29,13 @@ export const companyInfo = {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
export const PaymentTypes = {
|
|
33
|
+
SUBSCRIPTION: "subscription",
|
|
34
|
+
ONE_TIME: "one-time",
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export type PaymentType = (typeof PaymentTypes)[keyof typeof PaymentTypes];
|
|
38
|
+
|
|
32
39
|
export const SupporterPlatforms = {
|
|
33
40
|
FACEBOOK: "facebook",
|
|
34
41
|
X: "x",
|