Skip to content

Commit

Permalink
✅ collection meta tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elmarti committed Apr 13, 2023
1 parent 1eb30df commit 0a0fb0d
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/modules/persistence/inmemory/__tests__/collection-meta.test.ts
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()
});
});

0 comments on commit 0a0fb0d

Please sign in to comment.