Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(amplify-appsync-simulator): string functions not called on items … #7636

Merged
merged 5 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { JavaArray } from './../../../velocity/value-mapper/array';
import { JavaMap } from '../../../velocity/value-mapper/map';
import { JavaString } from '../../../velocity/value-mapper/string';
import { map as mapper } from '../../../velocity/value-mapper/mapper';

describe('JavaMap', () => {
let identityMapper = jest.fn().mockImplementation(val => val);
Expand Down Expand Up @@ -66,6 +69,12 @@ describe('JavaMap', () => {
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, mapper);
expect(map.keySet()).toEqual(new JavaArray([new JavaString('foo'), new JavaString('bar')], mapper));
});

it('put', () => {
const map = new JavaMap({}, identityMapper);
map.put('foo', 'Foo Value');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class JavaMap {
}

keySet() {
return new JavaArray(Array.from(this.map.keys()), this.mapper);
return new JavaArray(Array.from(this.map.keys()).map(this.mapper as any), this.mapper);
}

put(key, value) {
Expand Down