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

Feature/web avatar loading #65

Merged
merged 10 commits into from
Nov 14, 2023
Merged

Feature/web avatar loading #65

merged 10 commits into from
Nov 14, 2023

Conversation

TheCodeTherapy
Copy link
Contributor

This PR aims to provide avatar loading through MML m-character avatar descriptions.

What kind of change does your PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Refactor
  • Tests
  • Other, please describe:

Does your PR fulfill the following requirements?

  • The title references the corresponding issue # (if relevant)

if (hasCurrentCharacter && props.currentCharacter) {
const assetsExist = checkAgainstCollection(props.collectionData, props.currentCharacter);
if (assetsExist) {
console.log("here! we have a current character!");
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover dev comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


export type LoadingErrors = string[];

export const parseMMLDescription = (
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a library function in 3d-web-avatar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

} from "./test-data";
import { extractNumberFromErrorMessage } from "./test-utils";

describe("WebAvatarClient Test Utils", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests could include the parsed character data as well as the errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

});
});

describe("WebAvatarClient MML Parsing", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest simplifying these tests to be an object contents equality check rather than pattern matching. It would be easier to see what the expected outcome was and would be less brittle, even if it were more code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests now include the parsed data compared to the expected outcome through a toStrictEqual object comparison.

@@ -0,0 +1,108 @@
export const validMCharacter = `
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to include syntactically-invalid strings too. Even if the DOMParser implementation handles this simply it's good to have defined behaviour in case the implementation changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarcusLongmuir Can you give me one example of such strings?

@@ -0,0 +1,43 @@
import { CollectionDataType } from "@mml-io/3d-web-avatar-editor-ui";
Copy link
Contributor

@MarcusLongmuir MarcusLongmuir Nov 14, 2023

Choose a reason for hiding this comment

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

This function/file (findAssetsInCollection) should probably be in the @mml-io/3d-web-avatar-editor-ui package.

It shouldn't be in this package (@mml-io/3d-web-avatar) because this package doesn't have a dependency on the @mml-io/3d-web-avatar-editor-ui package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@TheCodeTherapy TheCodeTherapy merged commit 3c01b88 into main Nov 14, 2023
@deej-io deej-io deleted the feature/web-avatar-loading branch August 5, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants