33
44// Test that the Slint event loop processes libuv's events.
55
6- import test from "ava " ;
6+ import { test , expect } from "vitest " ;
77import * as http from "node:http" ;
88
99import { runEventLoop , quitEventLoop , private_api } from "../dist/index.js" ;
1010
11- test . serial ( "merged event loops with timer" , async ( t ) => {
11+ test . sequential ( "merged event loops with timer" , async ( ) => {
1212 let invoked = false ;
1313
1414 await runEventLoop ( ( ) => {
@@ -17,10 +17,10 @@ test.serial("merged event loops with timer", async (t) => {
1717 quitEventLoop ( ) ;
1818 } , 2 ) ;
1919 } ) ;
20- t . true ( invoked ) ;
20+ expect ( invoked ) . toBe ( true ) ;
2121} ) ;
2222
23- test . serial ( "merged event loops with networking" , async ( t ) => {
23+ test . sequential ( "merged event loops with networking" , async ( ) => {
2424 const listener = ( request , result ) => {
2525 result . writeHead ( 200 ) ;
2626 result . end ( "Hello World" ) ;
@@ -48,32 +48,29 @@ test.serial("merged event loops with networking", async (t) => {
4848 } ) ;
4949 } ) ;
5050
51- t . is ( received_response , "Hello World" ) ;
51+ expect ( received_response ) . toBe ( "Hello World" ) ;
5252} ) ;
5353
54- test . serial (
55- "quit event loop on last window closed with callback" ,
56- async ( t ) => {
57- const compiler = new private_api . ComponentCompiler ( ) ;
58- const definition = compiler . buildFromSource (
59- `
54+ test . sequential ( "quit event loop on last window closed with callback" , async ( ) => {
55+ const compiler = new private_api . ComponentCompiler ( ) ;
56+ const definition = compiler . buildFromSource (
57+ `
6058
6159 export component App inherits Window {
6260 width: 300px;
6361 height: 300px;
6462 }` ,
65- "" ,
66- ) ;
67- t . not ( definition . App , null ) ;
63+ "" ,
64+ ) ;
65+ expect ( definition . App ) . not . toBeNull ( ) ;
6866
69- const instance = definition . App ! . create ( ) as any ;
70- t . not ( instance , null ) ;
67+ const instance = definition . App ! . create ( ) as any ;
68+ expect ( instance ) . not . toBeNull ( ) ;
7169
72- instance . window ( ) . show ( ) ;
73- await runEventLoop ( ( ) => {
74- setTimeout ( ( ) => {
75- instance . window ( ) . hide ( ) ;
76- } , 2 ) ;
77- } ) ;
78- } ,
79- ) ;
70+ instance . window ( ) . show ( ) ;
71+ await runEventLoop ( ( ) => {
72+ setTimeout ( ( ) => {
73+ instance . window ( ) . hide ( ) ;
74+ } , 2 ) ;
75+ } ) ;
76+ } ) ;
0 commit comments