Skip to content

Commit

Permalink
feat: add deftest type definitions (#81)
Browse files Browse the repository at this point in the history
Types for deftest by @daysgobye

---------

Co-authored-by: Cole Smith <[email protected]>
  • Loading branch information
thinknathan and daysgobye authored Aug 17, 2024
1 parent f7ef5fb commit cfe4755
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/deftest/deftest-2.8.0.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <library version="2.8.0" src="https://github.com/britzl/deftest/archive/refs/tags/2.8.0.zip" />
/// <reference path="./deftest.deftest.d.ts" />
47 changes: 47 additions & 0 deletions packages/deftest/deftest.deftest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/** @noSelfInFile **/

/**
* Unit testing in Defold
* @see {@link https://github.com/britzl/deftest|Github Source}
* @noResolution
*/
declare module 'deftest.deftest' {
export function add(...args: ((...args: any[]) => unknown)[]): void;
export function run(options?: {
coverage?: {
enabled?: boolean,
}
pattern?: string,
}): void;
}

declare function describe(title: string, tests: () => void): void
declare function before(before: () => void): void
declare function after(after: () => void): void
declare function test(title: string, test: () => void): void
declare function assert_equal<T>(a: T, b: T): void
declare function assert_blank(value: any): void
declare function assert_empty(obj: Record<any, any>): void
declare function assert_error(func: any): void
declare function assert_not_error(func: any): void
declare function assert_false(value: boolean): void
declare function assert_not_false(value: boolean): void
declare function assert_not_true(value: boolean): void
declare function assert_true(value: boolean): void
declare function assert_greater_than(a: number, b: number): void
declare function assert_gte(a: number, b: number): void
declare function assert_less_than(a: number, b: number): void
declare function assert_lte(a: number, b: number): void
declare function assert_match(a: number, b: number): void
declare function assert_nil(value: any): void
declare function assert_type<T>(a: T, b: T): void
declare function assert_not_blank(value: any): void
declare function assert_not_empty(value: any): void
declare function assert_not_equal<T>(a: T, b: T): void
declare function assert_not_greater_than(a: number, b: number): void
declare function assert_not_gte(a: number, b: number): void
declare function assert_not_less_than(a: number, b: number): void
declare function assert_not_lte(a: number, b: number): void
declare function assert_not_match(a: number, b: number): void
declare function assert_not_nil(value: any): void
declare function assert_not_type<T>(a: T, b: T): void
4 changes: 4 additions & 0 deletions packages/deftest/library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "deftest",
"url": "https://github.com/britzl/deftest"
}

0 comments on commit cfe4755

Please sign in to comment.