summaryrefslogtreecommitdiff
path: root/tests/napi/uv_test.js
blob: 6d8ee267137beecfb1d5479dbc568735a25d7b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { assertEquals, loadTestLibrary } from "./common.js";

const uv = loadTestLibrary();

Deno.test("napi uv async", async () => {
  let called = false;
  await new Promise((resolve) => {
    uv.test_uv_async((value) => {
      called = true;
      if (value === 5) {
        resolve();
      }
    });
  });
  assertEquals(called, true);
});