โšก
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

toContain

Check if something is contained in something

This comparison is used to determine if an Array contains a value.

All the values returned by T[index] will be compared using the == operator, so overloading the class @operator("==") can be used in conjunction with this comparison. The index must be a number value, and there must be a length property that matches the index type. All values from 0 to length - 1 will be checked.

const data = new Uint8Array(100);
data[5] = 255;

expect(data).toContain(255);

This method is portable with jest using the toContain() method.

PrevioustoHaveLengthNexttoContainEqual

Last updated 5 years ago

Was this helpful?

๐Ÿ—๏ธ
๐ŸŽ