1- import { test , expect , describe , beforeEach , afterEach } from 'vitest'
2- import { setOptions } from '../src/index.js'
1+ import { test , expect , describe , afterEach } from 'vitest'
2+ import { setDefaultOptions , setOptions } from '../src/index.js'
33import { DEFAULT_OPTIONS , DEFAULT_OPTIONS_TO_BE_DISPLAYED } from '../src/constants.js'
44
55describe ( 'setDefaultOptions' , ( ) => {
66 const defaultOptions = { ...DEFAULT_OPTIONS }
7- beforeEach ( ( ) => {
8- // Set global options to custom values before each test
9- setOptions ( { wait : 2000 , interval : 100 } )
10- } )
117 afterEach ( ( ) => {
128 // Reset global options to default values after each test
139 setOptions ( defaultOptions )
1410 } )
1511
16- test ( 'setDefaultOptions should update both DEFAULT_OPTIONS_TO_BE_DISPLAYED and DEFAULT_OPTIONS' , ( ) => {
12+ test ( 'setOptions should update both DEFAULT_OPTIONS_TO_BE_DISPLAYED and DEFAULT_OPTIONS' , ( ) => {
1713 expect ( DEFAULT_OPTIONS_TO_BE_DISPLAYED . wait ) . not . toBe ( 1234 )
1814 expect ( DEFAULT_OPTIONS . wait ) . not . toBe ( 1234 )
1915
@@ -22,5 +18,15 @@ describe('setDefaultOptions', () => {
2218 expect ( DEFAULT_OPTIONS_TO_BE_DISPLAYED . wait ) . toBe ( 1234 )
2319 expect ( DEFAULT_OPTIONS . wait ) . toBe ( 1234 )
2420 } )
21+
22+ test ( 'setDefaultOptions should update both DEFAULT_OPTIONS_TO_BE_DISPLAYED and DEFAULT_OPTIONS' , ( ) => {
23+ expect ( DEFAULT_OPTIONS_TO_BE_DISPLAYED . wait ) . not . toBe ( 1234 )
24+ expect ( DEFAULT_OPTIONS . wait ) . not . toBe ( 1234 )
25+
26+ setDefaultOptions ( { wait : 1234 } )
27+
28+ expect ( DEFAULT_OPTIONS_TO_BE_DISPLAYED . wait ) . toBe ( 1234 )
29+ expect ( DEFAULT_OPTIONS . wait ) . toBe ( 1234 )
30+ } )
2531} )
2632
0 commit comments