From 243847c943c9692ba3ce5d2b8c6bc389dde1a144 Mon Sep 17 00:00:00 2001 From: Bruno Leonardo Michels Date: Tue, 3 Nov 2015 19:37:33 -0200 Subject: [PATCH 1/3] Add assertsharp npm package definition --- assertsharp/assertsharp-tests.ts | 16 ++++++++++++++++ assertsharp/assertsharp.d.ts | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 assertsharp/assertsharp-tests.ts create mode 100644 assertsharp/assertsharp.d.ts diff --git a/assertsharp/assertsharp-tests.ts b/assertsharp/assertsharp-tests.ts new file mode 100644 index 000000000..484e3ac77 --- /dev/null +++ b/assertsharp/assertsharp-tests.ts @@ -0,0 +1,16 @@ +/// + +import Assert from "assertsharp"; + +Assert.AreEqual(0, 0, "Pass"); +Assert.AreNotEqual(0, 1, "Pass"); +Assert.AreNotSame(new Date(), new Date(), "Pass"); +Assert.AreSequenceEqual([0], [0], (x, y) => x === y, "Pass"); +Assert.Fail("Should fail"); +Assert.IsFalse(false, "Pass"); +Assert.IsInstanceOfType(new Date(), Date, "Pass"); +Assert.IsNotInstanceOfType(true, Date, "Pass"); +Assert.IsNotNull(new Date(), "Pass"); +Assert.IsNull(null, "Pass"); +Assert.IsTrue(true, "Pass"); +Assert.Throws(() => { throw ""; }, "Pass"); diff --git a/assertsharp/assertsharp.d.ts b/assertsharp/assertsharp.d.ts new file mode 100644 index 000000000..c57e10077 --- /dev/null +++ b/assertsharp/assertsharp.d.ts @@ -0,0 +1,16 @@ +declare module "assertsharp" { + export default class Assert { + static AreEqual(expected: T, actual: T, message?: string): void; + static AreNotEqual(notExpected: T, actual: T, message?: string): void; + static AreNotSame(notExpected: T, actual: T, message?: string): void; + static AreSequenceEqual(expected: T[], actual: T[], equals?: (x, y) => boolean, message?: string): void; + static Fail(message?: string): void; + static IsFalse(actual: boolean, message?: string): void; + static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void; + static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void; + static IsNotNull(actual: any, message?: string): void; + static IsNull(actual: any, message?: string): void; + static IsTrue(actual: boolean, message?: string): void; + static Throws(fn: () => void, message?: string): void; + } +} From 63953292ac962b1e4678ce7acc9daa8220c31401 Mon Sep 17 00:00:00 2001 From: Bruno Leonardo Michels Date: Tue, 3 Nov 2015 20:08:56 -0200 Subject: [PATCH 2/3] Add header to assertsharp definition --- assertsharp/assertsharp.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assertsharp/assertsharp.d.ts b/assertsharp/assertsharp.d.ts index c57e10077..c47652a35 100644 --- a/assertsharp/assertsharp.d.ts +++ b/assertsharp/assertsharp.d.ts @@ -1,3 +1,8 @@ +// Type definitions for assertsharp +// Project: https://www.npmjs.com/package/assertsharp +// Definitions by: Bruno Leonardo Michels +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module "assertsharp" { export default class Assert { static AreEqual(expected: T, actual: T, message?: string): void; From 64eccdfcb734df89956a8b3db75d9aa0c185f88f Mon Sep 17 00:00:00 2001 From: Bruno Leonardo Michels Date: Tue, 3 Nov 2015 20:12:48 -0200 Subject: [PATCH 3/3] Fix implicit types on assertsharp --- assertsharp/assertsharp.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assertsharp/assertsharp.d.ts b/assertsharp/assertsharp.d.ts index c47652a35..e66442cf7 100644 --- a/assertsharp/assertsharp.d.ts +++ b/assertsharp/assertsharp.d.ts @@ -8,7 +8,7 @@ declare module "assertsharp" { static AreEqual(expected: T, actual: T, message?: string): void; static AreNotEqual(notExpected: T, actual: T, message?: string): void; static AreNotSame(notExpected: T, actual: T, message?: string): void; - static AreSequenceEqual(expected: T[], actual: T[], equals?: (x, y) => boolean, message?: string): void; + static AreSequenceEqual(expected: T[], actual: T[], equals?: (x: any, y: any) => boolean, message?: string): void; static Fail(message?: string): void; static IsFalse(actual: boolean, message?: string): void; static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void;