typefinity
    Preparing search index...

    Class NotAssertions<T>

    Negated assertions (i.e. assert that something is not true)

    Type Parameters

    • T
    Index

    Constructors

    Methods

    • Assert that the actual and (un)expected values are not identical (i.e. not the same instance). They might still be equal.

      Parameters

      • unexpected: T

        The unexpected value

      Returns void

      If the actual and unexpected values are identical

    • Assert that the actual value is not an instance of of the specified class

      Type Parameters

      • U

      Parameters

      • unexpected: new (...args: any[]) => T extends U ? U : T

        The class which the current value should not be an instance of

      Returns void

      If the actual value is an instance of the unexpected class

    • Assert that the actual value is not of the specified type. This is a compile-time check:

      expect(1 as number | string).not.toBeOfType<number>() // ok
      expect(1 as number | string).not.toBeOfType<number|string>() // does not compile

      Type Parameters

      • U

      Parameters

      • ...params: <V>() => V extends T ? 1 : 2 extends <V>() => V extends U ? 1 : 2
            ? ["ERROR: The types are the same"]
            : []

        Accepts no parameters when both types are different

      Returns void

    • Assert that the actual and unexpected values are not equal (i.e. don't have the same content)

      Parameters

      • unexpected: Exclude<T, Function | Promise<unknown>>

        The unexpected value

      Returns void

      If the actual and expected values are equal (have the same content)

    • Assert that the actual string does not match the given regular expression

      Parameters

      • unexpected: RegExp

        The regular expression that should not match

      Returns void

      If the actual value matches the regular expression or if the actual value is not a string

    • Assert that the function completes without throwing an error

      Returns void

      If the function throws an error