1
1
import fs from 'node:fs' ;
2
+ import path from 'node:path' ;
2
3
import { KeyValues } from '../src' ;
3
4
4
5
const defaultOptions : Options = {
@@ -77,8 +78,9 @@ describe('KeyValues Default Test', () => {
77
78
it ( 'should return the default path to the json file' , ( ) => {
78
79
const keyValues = new KeyValues ( ) ;
79
80
const filePath = keyValues . file ( ) ;
80
- // expect(filePath).toMatch(/\.json$/);
81
- expect ( filePath ) . toBe ( 'localdb\\keyvalues.json' ) ;
81
+
82
+ const expectedPath = path . join ( 'localdb' , 'keyvalues.json' ) ;
83
+ expect ( filePath ) . toStrictEqual ( expectedPath ) ;
82
84
} ) ;
83
85
84
86
it ( 'should reset options object to defaultOptions' , ( ) => {
@@ -132,7 +134,7 @@ describe('KeyValues Default Test', () => {
132
134
expect ( kvs . getSync ( 'recObject' ) ) . toBeUndefined ( ) ;
133
135
expect ( kvs . getSync ( 'recDictionary' ) ) . toBeUndefined ( ) ;
134
136
expect ( kvs . getSync ( 'recArray' ) ) . not . toBeUndefined ( ) ;
135
- expect ( kvs . getSync ( 'recArray' ) ) . toMatchSnapshot ( [ 'Heliomar' , 'Marques' ] ) ;
137
+ expect ( kvs . getSync ( 'recArray' ) ) . toStrictEqual ( [ 'Heliomar' , 'Marques' ] ) ;
136
138
137
139
kvs . setSync ( 'recNull' , Object . values ( recNull ) [ 0 ] ) ;
138
140
kvs . setSync ( 'recStr' , Object . values ( recStr ) [ 0 ] ) ;
@@ -148,7 +150,7 @@ describe('KeyValues Default Test', () => {
148
150
expect ( kvs . getSync ( 'recBool' ) ) . not . toBeUndefined ( ) ;
149
151
expect ( kvs . getSync ( 'recObject' ) ) . not . toBeUndefined ( ) ;
150
152
expect ( kvs . getSync ( 'recDictionary' ) ) . not . toBeUndefined ( ) ;
151
- expect ( kvs . getSync < string [ ] > ( 'recArray' ) ) . toMatchSnapshot ( [ 'Heliomar' , 'Marques' ] ) ;
153
+ expect ( kvs . getSync < string [ ] > ( 'recArray' ) ) . toStrictEqual ( [ 'Heliomar' , 'Marques' ] ) ;
152
154
} ) ;
153
155
154
156
it ( 'test set/get property Array' , ( ) => {
0 commit comments