Skip to content

Commit

Permalink
test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yukulele committed Oct 26, 2022
1 parent 35797a6 commit e4f0565
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deps.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"
export { assertEquals, assertThrows } from "https://deno.land/[email protected]/testing/asserts.ts"
10 changes: 5 additions & 5 deletions test/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "../deps.ts"
import { assertEquals, assertThrows } from "../deps.ts"
import { TypedCustomEvent, TypedEventTarget } from "../mod.ts"

type Events = {
Expand All @@ -13,15 +13,15 @@ const e = new TypedEventTarget<Events>()
*/
// Incorrect Syntax
// @ts-expect-error reason: test
e.dispatchEvent(new TypedCustomEvent("Hi", "Hello"))
assertThrows(() =>e .dispatchEvent(new TypedCustomEvent("Hi", "Hello")))
// @ts-expect-error reason: test
e.dispatchEvent(new TypedCustomEvent("Hello", true))
assertThrows(() => e.dispatchEvent(new TypedCustomEvent("Hello", true)))

// Invalid Types
// @ts-expect-error reason: test
e.dispatchEvent(new TypedCustomEvent("Hi", 1))
e.dispatchEvent(new TypedCustomEvent("Hi", {detail: 1}))
// @ts-expect-error reason: test
e.dispatchEvent(new TypedCustomEvent("Hello", "Hi"))
e.dispatchEvent(new TypedCustomEvent("Hello", {detail: "Hi"}))
// @ts-expect-error reason: test
e.addEventListener("Hi", (value: string) => value)

Expand Down

0 comments on commit e4f0565

Please sign in to comment.