File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { test , expect } from '@playwright/test'
2- import { launch } from '../common/index.test'
2+ import { tests } from '../common/index.test'
33
4- launch ( { expect, test } )
4+ for ( const { name, prepare, expected } of tests ) {
5+ test ( name , async ( ) => {
6+ const result = await prepare ( )
7+ expect ( result ) . toBe ( expected )
8+ } )
9+ }
Original file line number Diff line number Diff line change 1- import { test as pTest , expect as pExpect } from '@playwright/test'
2- import { expect as vExpect } from 'vitest'
3-
41import { parse } from '../../src'
52
6- export function launch ( { expect, test } : {
7- expect : typeof pExpect
8- test : typeof pTest
9- } | {
10- expect : typeof vExpect
11- // eslint-disable-next-line @typescript-eslint/no-explicit-any
12- test : any
13- } ) : void {
14- test ( 'parse' , async ( ) => {
15- const text = 'hello, csvremote!!!'
16- let result = ''
17- for await ( const chunk of parse ( text , { chunkSize : 5 , isUrl : false } ) ) {
18- result += chunk
19- }
20- expect ( result ) . toBe ( text )
21- } )
22- }
3+ export const tests = [
4+ {
5+ name : 'parse' ,
6+ prepare : async ( ) => {
7+ const text = 'hello, csvremote!!!'
8+ let result = ''
9+ for await ( const chunk of parse ( text , { chunkSize : 5 , isUrl : false } ) ) {
10+ result += chunk
11+ }
12+ return result
13+ } ,
14+ expected : 'hello, csvremote!!!' ,
15+ } ,
16+ ]
Original file line number Diff line number Diff line change 11import { expect , test } from 'vitest'
2- import { launch } from '../common/index.test'
2+ import { tests } from '../common/index.test'
33
4- launch ( { expect, test } )
4+ for ( const { name, prepare, expected } of tests ) {
5+ test ( name , async ( ) => {
6+ const result = await prepare ( )
7+ expect ( result ) . toBe ( expected )
8+ } )
9+ }
You can’t perform that action at this time.
0 commit comments