@hobenakicoffee/libraries 0.0.4 → 0.0.5

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,11 +1,16 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "0.0.4",
4
- "main": "dist/index.js",
5
- "module": "dist/index.js",
3
+ "version": "0.0.5",
6
4
  "type": "module",
5
+ "types": "src/index.ts",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./constants": "./src/constants/index.ts"
9
+ },
7
10
  "files": [
8
- "dist"
11
+ "src",
12
+ "README.md",
13
+ "package.json"
9
14
  ],
10
15
  "scripts": {
11
16
  "build": "bun build src/index.ts --outdir dist --target node",
@@ -15,7 +20,7 @@
15
20
  "typecheck": "tsc --noEmit",
16
21
  "lint": "bun run typecheck",
17
22
  "clean": "rm -rf dist",
18
- "prepublishOnly": "bun run test && bun run clean && bun run build"
23
+ "prepublishOnly": "bun run test"
19
24
  },
20
25
  "devDependencies": {
21
26
  "@types/bun": "latest"
@@ -0,0 +1,114 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { SupporterPlatforms, PaymentStatuses } from "./index";
3
+ import type { SupporterPlatform, PaymentStatus } from "./index";
4
+
5
+ describe("SupporterPlatforms", () => {
6
+ test("should contain all expected platform keys", () => {
7
+ const expectedKeys = [
8
+ "FACEBOOK",
9
+ "X",
10
+ "INSTAGRAM",
11
+ "YOUTUBE",
12
+ "GITHUB",
13
+ "LINKEDIN",
14
+ "TWITCH",
15
+ "TIKTOK",
16
+ "THREADS",
17
+ "WHATSAPP",
18
+ "TELEGRAM",
19
+ "DISCORD",
20
+ "REDDIT",
21
+ "PINTEREST",
22
+ "MEDIUM",
23
+ "DEVTO",
24
+ "BEHANCE",
25
+ "DRIBBBLE",
26
+ ];
27
+
28
+ expect(Object.keys(SupporterPlatforms)).toEqual(expectedKeys);
29
+ });
30
+
31
+ test("should have correct values for each platform", () => {
32
+ expect(SupporterPlatforms.FACEBOOK).toBe("facebook");
33
+ expect(SupporterPlatforms.X).toBe("x");
34
+ expect(SupporterPlatforms.INSTAGRAM).toBe("instagram");
35
+ expect(SupporterPlatforms.YOUTUBE).toBe("youtube");
36
+ expect(SupporterPlatforms.GITHUB).toBe("github");
37
+ expect(SupporterPlatforms.LINKEDIN).toBe("linkedin");
38
+ expect(SupporterPlatforms.TWITCH).toBe("twitch");
39
+ expect(SupporterPlatforms.TIKTOK).toBe("tiktok");
40
+ expect(SupporterPlatforms.THREADS).toBe("threads");
41
+ expect(SupporterPlatforms.WHATSAPP).toBe("whatsapp");
42
+ expect(SupporterPlatforms.TELEGRAM).toBe("telegram");
43
+ expect(SupporterPlatforms.DISCORD).toBe("discord");
44
+ expect(SupporterPlatforms.REDDIT).toBe("reddit");
45
+ expect(SupporterPlatforms.PINTEREST).toBe("pinterest");
46
+ expect(SupporterPlatforms.MEDIUM).toBe("medium");
47
+ expect(SupporterPlatforms.DEVTO).toBe("devto");
48
+ expect(SupporterPlatforms.BEHANCE).toBe("behance");
49
+ expect(SupporterPlatforms.DRIBBBLE).toBe("dribbble");
50
+ });
51
+
52
+ test("should be read-only at compile time", () => {
53
+ // TypeScript prevents modification at compile time with 'as const'
54
+ // This test verifies the structure is correct
55
+ expect(Object.isFrozen(SupporterPlatforms)).toBe(false);
56
+ expect(typeof SupporterPlatforms).toBe("object");
57
+ });
58
+
59
+ test("SupporterPlatform type should accept valid platform values", () => {
60
+ const validPlatform: SupporterPlatform = "facebook";
61
+ expect(validPlatform).toBe("facebook");
62
+ });
63
+
64
+ test("should have 18 platforms", () => {
65
+ expect(Object.keys(SupporterPlatforms).length).toBe(18);
66
+ });
67
+ });
68
+
69
+ describe("PaymentStatuses", () => {
70
+ test("should contain all expected status keys", () => {
71
+ const expectedKeys = [
72
+ "PENDING",
73
+ "COMPLETED",
74
+ "FAILED",
75
+ "CANCELLED",
76
+ "REFUNDED",
77
+ "REVIEWING",
78
+ ];
79
+
80
+ expect(Object.keys(PaymentStatuses)).toEqual(expectedKeys);
81
+ });
82
+
83
+ test("should have correct values for each status", () => {
84
+ expect(PaymentStatuses.PENDING).toBe("pending");
85
+ expect(PaymentStatuses.COMPLETED).toBe("completed");
86
+ expect(PaymentStatuses.FAILED).toBe("failed");
87
+ expect(PaymentStatuses.CANCELLED).toBe("cancelled");
88
+ expect(PaymentStatuses.REFUNDED).toBe("refunded");
89
+ expect(PaymentStatuses.REVIEWING).toBe("reviewing");
90
+ });
91
+
92
+ test("should be read-only at compile time", () => {
93
+ // TypeScript prevents modification at compile time with 'as const'
94
+ // This test verifies the structure is correct
95
+ expect(Object.isFrozen(PaymentStatuses)).toBe(false);
96
+ expect(typeof PaymentStatuses).toBe("object");
97
+ });
98
+
99
+ test("PaymentStatus type should accept valid status values", () => {
100
+ const validStatus: PaymentStatus = "completed";
101
+ expect(validStatus).toBe("completed");
102
+ });
103
+
104
+ test("should have 6 payment statuses", () => {
105
+ expect(Object.keys(PaymentStatuses).length).toBe(6);
106
+ });
107
+
108
+ test("all values should be lowercase strings", () => {
109
+ Object.values(PaymentStatuses).forEach((status) => {
110
+ expect(status).toBe(status.toLowerCase() as PaymentStatus);
111
+ expect(typeof status).toBe("string");
112
+ });
113
+ });
114
+ });
@@ -1,5 +1,4 @@
1
- // src/constants/index.ts
2
- var SupporterPlatforms = {
1
+ export const SupporterPlatforms = {
3
2
  FACEBOOK: "facebook",
4
3
  X: "x",
5
4
  INSTAGRAM: "instagram",
@@ -17,17 +16,20 @@ var SupporterPlatforms = {
17
16
  MEDIUM: "medium",
18
17
  DEVTO: "devto",
19
18
  BEHANCE: "behance",
20
- DRIBBBLE: "dribbble"
21
- };
22
- var PaymentStatuses = {
19
+ DRIBBBLE: "dribbble",
20
+ } as const;
21
+
22
+ export type SupporterPlatform =
23
+ (typeof SupporterPlatforms)[keyof typeof SupporterPlatforms];
24
+
25
+ export const PaymentStatuses = {
23
26
  PENDING: "pending",
24
27
  COMPLETED: "completed",
25
28
  FAILED: "failed",
26
29
  CANCELLED: "cancelled",
27
30
  REFUNDED: "refunded",
28
- REVIEWING: "reviewing"
29
- };
30
- export {
31
- SupporterPlatforms,
32
- PaymentStatuses
33
- };
31
+ REVIEWING: "reviewing",
32
+ } as const;
33
+
34
+ export type PaymentStatus =
35
+ (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./constants";