Skip to content

Commit

Permalink
feat(amplify-appsync-simulator): using this.mapper in map.keySet
Browse files Browse the repository at this point in the history
  • Loading branch information
alichherawalla committed Jul 6, 2021
1 parent 775b4c1 commit 98b4482
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ describe('JavaMap', () => {
it('entrySet', () => {
const obj = { foo: 'Foo Value', bar: 'Bar Value' };
const map = new JavaMap(obj, identityMapper);
expect(map.entrySet().toJSON()).toEqual([{ key: 'foo', value: 'Foo Value' }, { key: 'bar', value: 'Bar Value' }]);
expect(map.entrySet().toJSON()).toEqual([
{ key: 'foo', value: 'Foo Value' },
{ key: 'bar', value: 'Bar Value' },
]);
});

it('equal', () => {
Expand All @@ -65,13 +68,13 @@ describe('JavaMap', () => {

it('keySet', () => {
const obj = { foo: 'Foo Value', bar: 'Bar Value' };
const map = new JavaMap(obj, identityMapper);
const map = new JavaMap(obj, mapper);
expect(map.keySet().toJSON()).toEqual(['foo', 'bar']);
});

it('keySet returns a JavaArray with each element of type JavaString', () => {
const obj = { foo: 'Foo Value', bar: 'Bar Value' };
const map = new JavaMap(obj, identityMapper);
const map = new JavaMap(obj, mapper);
expect(map.keySet()).toEqual(new JavaArray([new JavaString('foo'), new JavaString('bar')], mapper));
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { JavaArray } from './array';
import { toJSON } from './to-json';
import { map } from './mapper';

export class JavaMap {
private map: Map<string, any>;
Expand Down Expand Up @@ -57,7 +56,7 @@ export class JavaMap {
}

keySet() {
return map(Array.from(this.map.keys()));
return this.mapper(Array.from(this.map.keys()));
}

put(key, value) {
Expand Down

0 comments on commit 98b4482

Please sign in to comment.