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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JavaString } from './string';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think importing JavaString is the correct way to go here. The mapper argument passed to the constructor can do this for you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey,

Thank you for taking the time to review this.

Will take a look at how this can be done using the mapper, and will also add tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cjihrig,

I've made the changes, please do let me know if there is anything else that would be required.

Thank you for your time.

import { toJSON } from './to-json';

export class JavaArray extends Array<any> {
Expand All @@ -7,6 +8,13 @@ export class JavaArray extends Array<any> {
// splice sends a single object
values = [values];
}
values = values.map(value => {
if (typeof value === 'string' && !((value as any) instanceof JavaString)) {
return new JavaString(value);
}
return value;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note here, but the indentation is off.


if (values.length !== 1) {
super(...values);
} else {
Expand Down