@wolfstar/http-framework-test-utils 3.0.6 → 3.0.8

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/README.md CHANGED
@@ -1,4 +1,19 @@
1
- # `@wolfstar/http-framework-test-utils`
1
+ <div align="center">
2
+ <picture>
3
+ <img src="https://cdn.wolfstar.rocks/assets/stars-components/wordmark.webp" alt="Stars Components" width="440" />
4
+ </picture>
5
+
6
+ # @wolfstar/http-framework-test-utils
7
+
8
+ **Test utilities and fixtures for <a href="https://github.com/wolfstar-project/stars-components/tree/main/packages/http-framework">@wolfstar/http-framework</a>.**
9
+
10
+ [![version](https://npmx.dev/api/registry/badge/version/@wolfstar/http-framework-test-utils)](https://npmx.dev/package/@wolfstar/http-framework-test-utils)
11
+ [![downloads](https://npmx.dev/api/registry/badge/downloads/@wolfstar/http-framework-test-utils)](https://npmx.dev/package/@wolfstar/http-framework-test-utils)
12
+ [![license](https://img.shields.io/github/license/wolfstar-project/stars-components?style=flat-square&color=informational)](https://github.com/wolfstar-project/stars-components/blob/main/LICENSE)
13
+
14
+ </div>
15
+
16
+ ## Description
2
17
 
3
18
  Test utilities and fixtures for [`@wolfstar/http-framework`](https://github.com/wolfstar-project/stars-components/tree/main/packages/http-framework) — designed to work with [Vitest](https://vitest.dev/).
4
19
 
@@ -6,17 +6,17 @@ import { Writable } from "node:stream";
6
6
  import { Constructor } from "@sapphire/utilities";
7
7
  import { ServerResponse } from "node:http";
8
8
  //#region src/commands.d.ts
9
- declare function buildSubcommand(name: string, description: string): SlashCommandSubcommandBuilder;
10
- declare function getAndDelete<Options extends Command.Options>(command: typeof Command<Options>): import("@wolfstar/http-framework").ApplicationCommandRegistryEntry;
11
- declare function makeCommand<Options extends Command.Options>(CommandClass: Constructor<Command<Options>>): Command<Options>;
9
+ export declare function buildSubcommand(name: string, description: string): SlashCommandSubcommandBuilder;
10
+ export declare function getAndDelete<Options extends Command.Options>(command: typeof Command<Options>): import("@wolfstar/http-framework").ApplicationCommandRegistryEntry;
11
+ export declare function makeCommand<Options extends Command.Options>(CommandClass: Constructor<Command<Options>>): Command<Options>;
12
12
  //#endregion
13
13
  //#region src/fixtures.d.ts
14
- declare const UserData: Readonly<APIUser>;
15
- declare const InteractionGuildMemberData: Readonly<APIInteractionGuildMember>;
16
- declare const MessageData: Readonly<APIMessage>;
17
- declare const PermissionsData: Permissions;
18
- declare const LocaleData: Locale;
19
- declare const BaseInteractionData: {
14
+ export declare const UserData: Readonly<APIUser>;
15
+ export declare const InteractionGuildMemberData: Readonly<APIInteractionGuildMember>;
16
+ export declare const MessageData: Readonly<APIMessage>;
17
+ export declare const PermissionsData: Permissions;
18
+ export declare const LocaleData: Locale;
19
+ export declare const BaseInteractionData: {
20
20
  readonly id: '254360814063058944';
21
21
  readonly application_id: '737141877803057244';
22
22
  readonly member: Readonly<APIInteractionGuildMember>;
@@ -30,33 +30,33 @@ declare const BaseInteractionData: {
30
30
  readonly authorizing_integration_owners: APIAuthorizingIntegrationOwnersMap;
31
31
  readonly attachment_size_limit: number;
32
32
  };
33
- declare const ApplicationCommandAutocompleteInteractionData: APIApplicationCommandAutocompleteInteraction;
34
- declare const ChatInputApplicationCommandInteractionData: APIChatInputApplicationCommandInteraction;
35
- declare const MessageApplicationCommandInteractionData: APIMessageApplicationCommandInteraction;
36
- declare const UserApplicationCommandInteractionData: APIUserApplicationCommandInteraction;
37
- declare const MessageComponentButtonInteractionData: APIMessageComponentButtonInteraction;
38
- declare const MessageComponentChannelSelectInteractionData: MessageComponentChannelSelectInteraction.Type;
39
- declare const MessageComponentMentionableSelectInteractionData: MessageComponentMentionableSelectInteraction.Type;
40
- declare const MessageComponentRoleSelectInteractionData: MessageComponentRoleSelectInteraction.Type;
41
- declare const MessageComponentStringSelectInteractionData: MessageComponentStringSelectInteraction.Type;
42
- declare const MessageComponentUserSelectInteractionData: MessageComponentUserSelectInteraction.Type;
43
- declare const ModalSubmitInteractionData: APIModalSubmitInteraction;
33
+ export declare const ApplicationCommandAutocompleteInteractionData: APIApplicationCommandAutocompleteInteraction;
34
+ export declare const ChatInputApplicationCommandInteractionData: APIChatInputApplicationCommandInteraction;
35
+ export declare const MessageApplicationCommandInteractionData: APIMessageApplicationCommandInteraction;
36
+ export declare const UserApplicationCommandInteractionData: APIUserApplicationCommandInteraction;
37
+ export declare const MessageComponentButtonInteractionData: APIMessageComponentButtonInteraction;
38
+ export declare const MessageComponentChannelSelectInteractionData: MessageComponentChannelSelectInteraction.Type;
39
+ export declare const MessageComponentMentionableSelectInteractionData: MessageComponentMentionableSelectInteraction.Type;
40
+ export declare const MessageComponentRoleSelectInteractionData: MessageComponentRoleSelectInteraction.Type;
41
+ export declare const MessageComponentStringSelectInteractionData: MessageComponentStringSelectInteraction.Type;
42
+ export declare const MessageComponentUserSelectInteractionData: MessageComponentUserSelectInteraction.Type;
43
+ export declare const ModalSubmitInteractionData: APIModalSubmitInteraction;
44
44
  //#endregion
45
45
  //#region src/TestableClient.d.ts
46
- declare class TestableClient extends Client {
46
+ export declare class TestableClient extends Client {
47
47
  constructor(options?: Partial<ClientOptions>);
48
48
  handleHttpMessage(interaction: Exclude<APIInteraction, APIPrimaryEntryPointCommandInteraction>, response: ServerResponse): Promise<ServerResponse>;
49
49
  }
50
50
  //#endregion
51
51
  //#region src/InteractionTestRunner.d.ts
52
- declare class InteractionTestRunner {
52
+ export declare class InteractionTestRunner {
53
53
  #private;
54
54
  constructor(client: TestableClient);
55
55
  run(interaction: Exclude<APIInteraction, APIPrimaryEntryPointCommandInteraction>): Promise<InteractionResult>;
56
56
  }
57
57
  //#endregion
58
58
  //#region src/MockServerResponse.d.ts
59
- declare class MockServerResponse extends Writable {
59
+ export declare class MockServerResponse extends Writable {
60
60
  #private;
61
61
  statusCode: number;
62
62
  readonly headers: Record<string, string>;
@@ -66,10 +66,10 @@ declare class MockServerResponse extends Writable {
66
66
  getBodyAsJson<T = unknown>(): T;
67
67
  reset(): void;
68
68
  }
69
- declare function makeResponse(): ServerResponse;
69
+ export declare function makeResponse(): ServerResponse;
70
70
  //#endregion
71
71
  //#region src/snowflake.d.ts
72
- interface SnowflakeGeneratorOptions {
72
+ export interface SnowflakeGeneratorOptions {
73
73
  /** Millisecond timestamp to encode. Defaults to a stable 2024 timestamp so tests are deterministic. */
74
74
  timestamp?: number | Date;
75
75
  /** Discord internal worker id bits. Must fit in 5 bits. */
@@ -79,15 +79,15 @@ interface SnowflakeGeneratorOptions {
79
79
  /** Starting increment. Must fit in 12 bits. */
80
80
  increment?: number;
81
81
  }
82
- declare function generateSnowflake(options?: SnowflakeGeneratorOptions): string;
83
- declare function createSnowflakeGenerator(options?: Omit<SnowflakeGeneratorOptions, 'increment'>): () => string;
82
+ export declare function generateSnowflake(options?: SnowflakeGeneratorOptions): string;
83
+ export declare function createSnowflakeGenerator(options?: Omit<SnowflakeGeneratorOptions, 'increment'>): () => string;
84
84
  //#endregion
85
85
  //#region src/testHarness.d.ts
86
- declare function createTestHarness(options?: Partial<ClientOptions>): {
86
+ export declare function createTestHarness(options?: Partial<ClientOptions>): {
87
87
  client: TestableClient;
88
88
  runner: InteractionTestRunner;
89
89
  };
90
- type TestHarness = ReturnType<typeof createTestHarness>;
90
+ export type TestHarness = ReturnType<typeof createTestHarness>;
91
91
  //#endregion
92
- export { ApplicationCommandAutocompleteInteractionData, BaseInteractionData, ChatInputApplicationCommandInteractionData, InteractionGuildMemberData, type InteractionResult, InteractionTestRunner, LocaleData, MessageApplicationCommandInteractionData, MessageComponentButtonInteractionData, MessageComponentChannelSelectInteractionData, MessageComponentMentionableSelectInteractionData, MessageComponentRoleSelectInteractionData, MessageComponentStringSelectInteractionData, MessageComponentUserSelectInteractionData, MessageData, MockServerResponse, ModalSubmitInteractionData, PermissionsData, SnowflakeGeneratorOptions, TestHarness, TestableClient, UserApplicationCommandInteractionData, UserData, buildSubcommand, createSnowflakeGenerator, createTestHarness, generateSnowflake, getAndDelete, makeCommand, makeResponse };
92
+ export type { InteractionResult };
93
93
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/commands.ts","../../src/fixtures.ts","../../src/TestableClient.ts","../../src/InteractionTestRunner.ts","../../src/MockServerResponse.ts","../../src/snowflake.ts","../../src/testHarness.ts"],"mappings":";;;;;;;;iBAKgB,gBAAgB,cAAc,sBAAsB;iBAIpD,aAAa,gBAAgB,QAAQ,SAAS,gBAAgB,QAAQ,8CAAQ;iBAQ9E,YAAY,gBAAgB,QAAQ,SAAS,cAAc,YAAY,QAAQ,YAAY,QAAQ;;;cCWtG,UAAU,SAAS;cAWnB,4BAA4B,SAAS;cAUrC,aAAa,SAAS;cAiBtB,iBAAiB;cACjB,YAAY;cAEZ;WACZ;WACA;WACA,QAAM,SAAA;WACN;WACA;WACA;WACA,QAAM,OAAA;WACN,cAAY,OAAA;WACZ;WACA,cAAoB;WACpB,gCAAsC;WACtC;;cAGY,+CAA+C;cAM/C,4CAA4C;cAQ5C,0CAA0C;cAc1C,uCAAuC;cASvC,uCAAuC;cASvC,8CAA8C,yCAAyC;cASvF,kDAAkD,6CAA6C;cAc/F,2CAA2C,sCAAsC;cASjF,6CAA6C,wCAAwC;cASrF,2CAA2C,sCAAsC;cASjF,4BAA4B;;;cC3K5B,uBAAuB;EACnC,YAAmB,UAAS,QAAQ;EAId,kBACrB,aAAa,QAAQ,gBAAgB,yCACrC,UAAU,iBACR,QAAQ;;;;cCZC;;EAGZ,YAAmB,QAAQ;EAId,IAAI,aAAa,QAAQ,gBAAgB,0CAA0C,QAAQ;;;;cCT5F,2BAA2B;;EAChC;WACS,SAAS;EAGlB,UAAU,cAAc;EAIf,OAAO,gBAAgB,WAAW,gBAAgB,WAAW,QAAQ;EAK9E;EAIA,cAAc,gBAAgB;EAI9B;;iBAOQ,gBAAgB;;;UC9Bf;;EAEhB,qBAAqB;;EAErB;;EAEA;;EAEA;;iBAWe,kBAAkB,UAAS;iBAkB3B,yBAAyB,UAAS,KAAK;;;iBCnCvC,kBAAkB,UAAS,QAAQ;;;;KAMvC,cAAc,kBAAkB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/commands.ts","../../src/fixtures.ts","../../src/TestableClient.ts","../../src/InteractionTestRunner.ts","../../src/MockServerResponse.ts","../../src/snowflake.ts","../../src/testHarness.ts"],"mappings":";;;;;;;;wBAKgB,gBAAgB,cAAc,sBAAsB;wBAIpD,aAAa,gBAAgB,QAAQ,SAAS,gBAAgB,QAAQ,8CAAQ;wBAQ9E,YAAY,gBAAgB,QAAQ,SAAS,cAAc,YAAY,QAAQ,YAAY,QAAQ;;;qBCWtG,UAAU,SAAS;qBAWnB,4BAA4B,SAAS;qBAUrC,aAAa,SAAS;qBAiBtB,iBAAiB;qBACjB,YAAY;qBAEZ;WACZ;WACA;WACA,QAAM,SAAA;WACN;WACA;WACA;WACA,QAAM,OAAA;WACN,cAAY,OAAA;WACZ;WACA,cAAoB;WACpB,gCAAsC;WACtC;;qBAGY,+CAA+C;qBAM/C,4CAA4C;qBAQ5C,0CAA0C;qBAc1C,uCAAuC;qBASvC,uCAAuC;qBASvC,8CAA8C,yCAAyC;qBASvF,kDAAkD,6CAA6C;qBAc/F,2CAA2C,sCAAsC;qBASjF,6CAA6C,wCAAwC;qBASrF,2CAA2C,sCAAsC;qBASjF,4BAA4B;;;qBC3K5B,uBAAuB;EACnC,YAAmB,UAAS,QAAQ;EAId,kBACrB,aAAa,QAAQ,gBAAgB,yCACrC,UAAU,iBACR,QAAQ;;;;qBCZC;;EAGZ,YAAmB,QAAQ;EAId,IAAI,aAAa,QAAQ,gBAAgB,0CAA0C,QAAQ;;;;qBCT5F,2BAA2B;;EAChC;WACS,SAAS;EAGlB,UAAU,cAAc;EAIf,OAAO,gBAAgB,WAAW,gBAAgB,WAAW,QAAQ;EAK9E;EAIA,cAAc,gBAAgB;EAI9B;;wBAOQ,gBAAgB;;;iBC9Bf;;EAEhB,qBAAqB;;EAErB;;EAEA;;EAEA;;wBAWe,kBAAkB,UAAS;wBAkB3B,yBAAyB,UAAS,KAAK;;;wBCnCvC,kBAAkB,UAAS,QAAQ;;;;YAMvC,cAAc,kBAAkB"}
package/dist/esm/index.js CHANGED
@@ -270,7 +270,7 @@ const ModalSubmitInteractionData = {
270
270
  };
271
271
 
272
272
  //#endregion
273
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/typeof.js
273
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
274
274
  function _typeof(o) {
275
275
  "@babel/helpers - typeof";
276
276
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -281,7 +281,7 @@ function _typeof(o) {
281
281
  }
282
282
 
283
283
  //#endregion
284
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPrimitive.js
284
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
285
285
  function toPrimitive(t, r) {
286
286
  if ("object" != _typeof(t) || !t) return t;
287
287
  var e = t[Symbol.toPrimitive];
@@ -294,14 +294,14 @@ function toPrimitive(t, r) {
294
294
  }
295
295
 
296
296
  //#endregion
297
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPropertyKey.js
297
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
298
298
  function toPropertyKey(t) {
299
299
  var i = toPrimitive(t, "string");
300
300
  return "symbol" == _typeof(i) ? i : i + "";
301
301
  }
302
302
 
303
303
  //#endregion
304
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/defineProperty.js
304
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
305
305
  function _defineProperty(e, r, t) {
306
306
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
307
307
  value: t,
@@ -312,26 +312,26 @@ function _defineProperty(e, r, t) {
312
312
  }
313
313
 
314
314
  //#endregion
315
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/checkPrivateRedeclaration.js
315
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/checkPrivateRedeclaration.js
316
316
  function _checkPrivateRedeclaration(e, t) {
317
317
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
318
318
  }
319
319
 
320
320
  //#endregion
321
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/classPrivateFieldInitSpec.js
321
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateFieldInitSpec.js
322
322
  function _classPrivateFieldInitSpec(e, t, a) {
323
323
  _checkPrivateRedeclaration(e, t), t.set(e, a);
324
324
  }
325
325
 
326
326
  //#endregion
327
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/assertClassBrand.js
327
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/assertClassBrand.js
328
328
  function _assertClassBrand(e, t, n) {
329
329
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
330
330
  throw new TypeError("Private element is not present on this object");
331
331
  }
332
332
 
333
333
  //#endregion
334
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/classPrivateFieldGet2.js
334
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateFieldGet2.js
335
335
  function _classPrivateFieldGet2(s, a) {
336
336
  return s.get(_assertClassBrand(s, a));
337
337
  }
@@ -370,7 +370,7 @@ function makeResponse() {
370
370
  }
371
371
 
372
372
  //#endregion
373
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/classPrivateFieldSet2.js
373
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateFieldSet2.js
374
374
  function _classPrivateFieldSet2(s, a, r) {
375
375
  return s.set(_assertClassBrand(s, a), r), r;
376
376
  }
@@ -1,6 +1,6 @@
1
1
  import { t as InteractionResult } from "./types-EeGiyIko.js";
2
2
  //#region src/vitest.d.ts
3
- interface HttpFrameworkMatchers<R = unknown> {
3
+ export interface HttpFrameworkMatchers<R = unknown> {
4
4
  toHaveStatus(expected: number): R;
5
5
  toHaveBody(expected: string): R;
6
6
  toHaveJsonBody(expected: unknown): R;
@@ -9,7 +9,7 @@ declare module 'vitest' {
9
9
  interface Assertion<T = any> extends HttpFrameworkMatchers<T> {}
10
10
  interface AsymmetricMatchersContaining extends HttpFrameworkMatchers {}
11
11
  }
12
- declare const httpFrameworkMatchers: {
12
+ export declare const httpFrameworkMatchers: {
13
13
  toHaveStatus(received: InteractionResult, expected: number): {
14
14
  pass: boolean;
15
15
  message: () => string;
@@ -24,5 +24,4 @@ declare const httpFrameworkMatchers: {
24
24
  };
25
25
  };
26
26
  //#endregion
27
- export { HttpFrameworkMatchers, httpFrameworkMatchers };
28
27
  //# sourceMappingURL=vitest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.d.ts","names":[],"sources":["../../src/vitest.ts"],"mappings":";;UAGiB,sBAAsB;EACtC,aAAa,mBAAmB;EAChC,WAAW,mBAAmB;EAC9B,eAAe,oBAAoB;;;YAKzB,UAAU,iBAAiB,sBAAsB;YACjD,qCAAqC;;cA2BnC;EACW,aAAA,UAAA,mBAAiB;;;;EAOnB,WAAA,UAAA,mBAAiB;;;;EAOb,eAAA,UAAA,mBAAiB"}
1
+ {"version":3,"file":"vitest.d.ts","names":[],"sources":["../../src/vitest.ts"],"mappings":";;iBAGiB,sBAAsB;EACtC,aAAa,mBAAmB;EAChC,WAAW,mBAAmB;EAC9B,eAAe,oBAAoB;;;YAKzB,UAAU,iBAAiB,sBAAsB;YACjD,qCAAqC;;qBA2BnC;EACW,aAAA,UAAA,mBAAiB;;;;EAOnB,WAAA,UAAA,mBAAiB;;;;EAOb,eAAA,UAAA,mBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfstar/http-framework-test-utils",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
4
4
  "description": "Test utilities for @wolfstar/http-framework",
5
5
  "keywords": [
6
6
  "discord",
@@ -51,16 +51,16 @@
51
51
  "@discordjs/builders": "^1.14.1",
52
52
  "@sapphire/pieces": "^4.4.1",
53
53
  "@sapphire/utilities": "^3.18.2",
54
+ "@wolfstar/http-framework": "4.0.1",
54
55
  "discord-api-types": "^0.38.8",
55
56
  "golar": "^0.1.10",
56
- "tsdown": "^0.22.14",
57
+ "tsdown": "^0.23.0",
57
58
  "typescript": "~7.0.2",
58
- "vitest": "^4.1.11",
59
- "@wolfstar/http-framework": "3.2.1"
59
+ "vitest": "^4.1.11"
60
60
  },
61
61
  "peerDependencies": {
62
- "vitest": ">=4.1.10",
63
- "@wolfstar/http-framework": "^3.2.1"
62
+ "@wolfstar/http-framework": "^4.0.1",
63
+ "vitest": ">=4.1.10"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
66
  "vitest": {