Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Apr 14, 2024
1 parent 023b54a commit a85ea6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/unit/entity/helpers/converters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ const mockEntityAttributes = {
propertyName: 'boolean',
type: Boolean,
},
binary: {
propertyName: 'binary',
type: Uint8Array,
},
} as any as AttributesMetadata;

const dynamoObject = {
Expand All @@ -102,6 +106,7 @@ const dynamoObject = {
set: { SS: ['1', '2', '3'] },
array: { L: [{ S: '1' }, { S: '2' }] },
boolean: { BOOL: true },
binary: { B: new Uint8Array([1, 2, 3]) },
};

describe('Converters entity helpers', () => {
Expand Down Expand Up @@ -136,15 +141,15 @@ describe('Converters entity helpers', () => {
getEntityMetadataSpy.mockReturnValue(metadata as any);

expect(convertAttributeValuesToEntity(MockEntity, dynamoObject)).toEqual(mockInstance);
expect(truncateValueSpy).toBeCalledTimes(15);
expect(truncateValueSpy).toBeCalledTimes(16);
});

test('Should return object in dynamode format', async () => {
getEntityAttributesSpy.mockReturnValue(mockEntityAttributes);
getEntityMetadataSpy.mockReturnValue(metadata as any);

expect(convertAttributeValuesToEntity(MockEntity, dynamoObject)).toEqual(mockInstance);
expect(truncateValueSpy).toBeCalledTimes(15);
expect(truncateValueSpy).toBeCalledTimes(16);
});
});

Expand All @@ -162,7 +167,7 @@ describe('Converters entity helpers', () => {
getEntityAttributesSpy.mockReturnValue(mockEntityAttributes);

expect(convertEntityToAttributeValues(MockEntity, mockInstance)).toEqual(dynamoObject);
expect(transformValueSpy).toBeCalledTimes(15);
expect(transformValueSpy).toBeCalledTimes(16);
});
});

Expand Down
1 change: 1 addition & 0 deletions tests/unit/stream/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const validMockEntityImage = {
boolean: { BOOL: true },
strDate: { S: '2001-09-09T01:46:40.000Z' },
numDate: { N: '1000000000000' },
binary: { B: new Uint8Array([1, 2, 3]) },
};

const validNewImageStream: DynamoDBRecord = {
Expand Down

0 comments on commit a85ea6c

Please sign in to comment.