@@ -5,8 +5,8 @@ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
5
5
6
6
let index = 0
7
7
8
- for ( const compressionType of Object . values ( CompressionType ) ) {
9
- // for (const compressionType of [CompressionType.msgpack]) {
8
+ // for (const compressionType of Object.values(CompressionType)) {
9
+ for ( const compressionType of [ CompressionType . msgpack ] ) {
10
10
it ( 'GistDatabase - initialize with existing gist id' , async ( ) => {
11
11
const db = new GistDatabase ( {
12
12
token : process . env . GIST_TOKEN
@@ -242,6 +242,44 @@ describe('GistDatabase - works with nested keys', () => {
242
242
} )
243
243
} )
244
244
245
+ describe ( 'GistDatabase - validates key names' , ( ) => {
246
+ let db : GistDatabase
247
+ beforeAll ( async ( ) => {
248
+ db = new GistDatabase ( {
249
+ token : process . env . GIST_TOKEN ,
250
+ compression : CompressionType . pretty
251
+ } )
252
+ } )
253
+ afterAll ( async ( ) => {
254
+ await db . destroy ( )
255
+ } )
256
+ it ( 'checks key name' , async ( ) => {
257
+ await db . set ( 'test-test' , {
258
+ value : {
259
+ name : 'test'
260
+ }
261
+ } )
262
+
263
+ await db . set ( 'test_test' , {
264
+ value : {
265
+ name : 'test'
266
+ }
267
+ } )
268
+
269
+ expect ( await db . get ( 'test-test' ) ) . toMatchObject ( {
270
+ value : {
271
+ name : 'test'
272
+ }
273
+ } )
274
+
275
+ expect ( await db . get ( 'test_test' ) ) . toMatchObject ( {
276
+ value : {
277
+ name : 'test'
278
+ }
279
+ } )
280
+ } )
281
+ } )
282
+
245
283
describe ( 'GistDatabase - advanced scenario 1' , ( ) => {
246
284
let db : GistDatabase
247
285
beforeAll ( async ( ) => {
0 commit comments