โšก
as-pect
  • โšกas-pect
  • ๐Ÿš€Getting Started
  • ๐Ÿ”งCLI Configuration
  • ๐Ÿ—๏ธAssemblyScript API
    • ๐Ÿ›๏ธTest Structure
    • ๐Ÿคทโ€โ™€๏ธ Expectations
      • ๐ŸŽญtoBe
      • ๐ŸคจtoStrictEqual
      • ๐ŸงฑtoBlockEqual
      • ๐Ÿ‘ฉโ€๐Ÿซ toBeTruthy and toBeFalsy
      • ๐Ÿ”ขtoBeNaN
      • ๐ŸšซtoBeNull
      • ๐ŸŒŒtoBeFinite
      • โšพtoThrow
      • โž•toBe(Greater|Less)Than
      • ๐Ÿ•ต๏ธโ€โ™€๏ธ toBeCloseTo
      • ๐Ÿ“toHaveLength
      • ๐ŸŽtoContain
      • ๐Ÿ“ฆtoContainEqual
      • โœ๏ธCustom Assertions
    • ๐ŸŽŸ๏ธTypes and Tooling
    • ๐Ÿช“Logging
    • ๐Ÿ‘ฉโ€๐Ÿ”ง RTrace and Memory Leaks
    • ๐Ÿ‘‰๐Ÿ‘ˆ Reflection
  • ๐ŸงถCore API
    • ๐ŸงชTestContext
    • ๐Ÿ‘ขBootstrap Tests Manually
    • ๐ŸŽ›๏ธTestGroup
    • โœ”๏ธTestResult
    • โœ๏ธReporters
      • ๐ŸฉณSummaryReporter
      • ๐Ÿ’ฌVerboseReporter
      • ๐ŸฅฝJSONReporter
      • ๐Ÿ—ƒ๏ธCSVReporter
Powered by GitBook
On this page

Was this helpful?

  1. AssemblyScript API
  2. ๐Ÿคทโ€โ™€๏ธ Expectations

toBe

or not.toBe(), that is the question

This comparison is used for comparing data using the == operator. In AssemblyScript this operator is used for comparing strings, numbers, and exact reference equality (or pointer comparison.)

For example, the following statements are valid toBe assertions:

let a = new Vec3(1, 2, 3);

// same reference
expect(a).toBe(a);

// integers are the same
expect(10).toBe(10);

// floats
expect(3.14).toBe(3.14);

// nullable references
expect<Vec3 | null>(null).toBe(null);

This method is safe to use portably with jest.

Previous๐Ÿคทโ€โ™€๏ธ ExpectationsNexttoStrictEqual

Last updated 5 years ago

Was this helpful?

๐Ÿ—๏ธ
๐ŸŽญ