1- import { describe , it , expect , beforeEach } from "vitest"
2- import { Collection } from "./Collection.js"
1+ /* eslint-disable vitest/no-conditional-tests, vitest/no-conditional-in-test */
32import { cleanup , render } from "@testing-library/react"
4- import { useState , useEffect } from "react"
3+ import { useEffect , useState } from "react"
4+ import { beforeEach , describe , expect , it } from "vitest"
5+ import { Collection } from "./Collection.js"
56
67class Page extends Collection {
78 wrapper = this . byTestId ( "wrapper" )
@@ -10,7 +11,7 @@ class Page extends Collection {
1011
1112const page = new Page ( )
1213
13- describe ( "Collection " , ( ) => {
14+ describe ( "collection " , ( ) => {
1415 beforeEach ( ( ) => cleanup ( ) )
1516
1617 it ( "should support dynamic methods" , ( ) => {
@@ -24,6 +25,17 @@ describe("Collection", () => {
2425 expect ( page . name ( ) ) . toHaveValue ( "foo" )
2526 } )
2627
28+ it ( "should support get as an alias for calling directly" , ( ) => {
29+ render (
30+ < div data-testid = "wrapper" >
31+ < input aria-label = "Name" value = "foo" onChange = { ( ) => { } } />
32+ </ div > ,
33+ )
34+
35+ expect ( page . wrapper . get ( ) ) . toBeInTheDocument ( )
36+ expect ( page . name . get ( ) ) . toHaveValue ( "foo" )
37+ } )
38+
2739 it ( "should support query" , ( ) => {
2840 render ( < div data-testid = "wrapper" > </ div > )
2941
@@ -51,7 +63,7 @@ describe("Collection", () => {
5163 render ( < Component /> )
5264 expect ( page . wrapper ( ) ) . toBeInTheDocument ( )
5365 expect ( page . name . query ( ) ) . not . toBeInTheDocument ( )
54- expect ( await page . name . find ( ) ) . toBeInTheDocument ( )
66+ await expect ( page . name . find ( ) ) . resolves . toBeInTheDocument ( )
5567 } )
5668
5769 it ( "should support all" , async ( ) => {
@@ -82,7 +94,7 @@ describe("Collection", () => {
8294 expect ( page . wrapper . all ( ) ) . toHaveLength ( 2 )
8395 expect ( page . wrapper . query . all ( ) ) . toHaveLength ( 2 )
8496 expect ( page . name . query . all ( ) ) . toHaveLength ( 0 )
85- expect ( await page . name . find . all ( ) ) . toHaveLength ( 3 )
97+ await expect ( page . name . find . all ( ) ) . resolves . toHaveLength ( 3 )
8698 } )
8799
88100 it ( "should support dynamic methods" , ( ) => {
0 commit comments