-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
2 deletions.
There are no files selected for viewing
30 changes: 28 additions & 2 deletions
30
src/modules/persistence/inmemory/__tests__/collection-meta.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
it('works', () => { | ||
expect(1).toBe(1); | ||
import { CollectionMeta } from '../collection-meta'; | ||
|
||
describe('CollectionMeta', () => { | ||
let collectionMeta: CollectionMeta; | ||
|
||
beforeEach(() => { | ||
collectionMeta = new CollectionMeta(); | ||
}); | ||
|
||
it('should create an instance of CollectionMeta', () => { | ||
expect(collectionMeta).toBeInstanceOf(CollectionMeta); | ||
}); | ||
|
||
it('should return undefined on calling init', async () => { | ||
const metaStructure = { collectionName: 'test', columns: [], indexes: [] }; | ||
|
||
expect(await collectionMeta.init('test', metaStructure)).toBeUndefined(); | ||
}); | ||
|
||
it('should return undefined when no meta data is set', async () => { | ||
expect(await collectionMeta.get()).toBeUndefined(); | ||
}); | ||
|
||
it('should update the meta value', async () => { | ||
const metaStructure = { collectionName: 'test', columns: [], indexes: [] }; | ||
await collectionMeta.update('test', metaStructure); | ||
expect(await collectionMeta.get()).toBeUndefined() | ||
}); | ||
}); |