Make an assertion that actual and expected are equal, deeply. If not deeply equal, then throw.
actual
expected
Type parameter can be specified to ensure values under comparison have the same type.
Note: When comparing Blob objects, you should first convert them to Uint8Array using the Blob.bytes() method and then compare their contents.
Blob
Uint8Array
Blob.bytes()
The type of the values to compare. This is usually inferred.
The actual value to compare.
The expected value to compare.
Optional
The optional message to display if the assertion fails.
import { assertEquals } from "@std/assert";assertEquals("world", "world"); // Doesn't throwassertEquals("hello", "world"); // Throws Copy
import { assertEquals } from "@std/assert";assertEquals("world", "world"); // Doesn't throwassertEquals("hello", "world"); // Throws
import { assertEquals } from "@std/assert";const bytes1 = await new Blob(["foo"]).bytes();const bytes2 = await new Blob(["foo"]).bytes();assertEquals(bytes1, bytes2); Copy
import { assertEquals } from "@std/assert";const bytes1 = await new Blob(["foo"]).bytes();const bytes2 = await new Blob(["foo"]).bytes();assertEquals(bytes1, bytes2);
Make an assertion that
actualandexpectedare equal, deeply. If not deeply equal, then throw.Type parameter can be specified to ensure values under comparison have the same type.
Note: When comparing
Blobobjects, you should first convert them toUint8Arrayusing theBlob.bytes()method and then compare their contents.