Skip to content

Commit

Permalink
fix(conversion): 🐛 never build dotLottie instance before conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf committed Nov 4, 2024
1 parent 4c0b6cd commit 5372c7c
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 15 deletions.
2 changes: 0 additions & 2 deletions packages/dotlottie-js/src/v1/browser/dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export async function toDotLottieV1(arrayBuffer: ArrayBuffer): Promise<DotLottie

const dotLottieV2 = await new DotLottie().fromArrayBuffer(arrayBuffer);

await dotLottieV2.build();

const animationIds = dotLottieV2.animations.map((animation) => animation.id);

for (const animationId of animationIds) {
Expand Down
2 changes: 0 additions & 2 deletions packages/dotlottie-js/src/v1/node/dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export async function toDotLottieV1(arrayBuffer: ArrayBuffer): Promise<DotLottie

const dotLottieV2 = await new DotLottie().fromArrayBuffer(arrayBuffer);

await dotLottieV2.build();

const animationIds = dotLottieV2.animations.map((animation) => animation.id);

for (const animationId of animationIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,7 @@ describe('fromArrayBuffer', () => {
dotlottie = await dotlottie.fromArrayBuffer(arrayBuffer);

expect(dotlottie.animations.length).toBe(6);
// eslint-disable-next-line no-warning-comments
// TODO: fix this
// expect(dotlottie.getImages().length).toBe(16);
expect(dotlottie.getImages().length).toBe(16);
expect(dotlottie.animations[0]?.id).toEqual('v1');
expect(dotlottie.animations[1]?.id).toEqual('v2');
expect(dotlottie.animations[2]?.id).toEqual('v3');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,12 @@ describe('fromArrayBuffer', () => {

test('loads a dotLottie containing images from an array buffer', async () => {
const arrayBuffer = bigMergedDotLottie;

let dotlottie = new DotLottie();

dotlottie = await dotlottie.fromArrayBuffer(arrayBuffer);

expect(dotlottie.animations.length).toBe(6);
// eslint-disable-next-line no-warning-comments
// TODO: fix this
// expect(dotlottie.getImages().length).toBe(16);
expect(dotlottie.getImages().length).toBe(16);
expect(dotlottie.animations[0]?.id).toEqual('v1');
expect(dotlottie.animations[1]?.id).toEqual('v2');
expect(dotlottie.animations[2]?.id).toEqual('v3');
Expand Down
2 changes: 0 additions & 2 deletions packages/dotlottie-js/src/v2/browser/dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export async function toDotLottieV2(arrayBuffer: ArrayBuffer): Promise<DotLottie
const dotLottieV2 = new DotLottie();
const dotLottieV1 = await new DotLottieV1().fromArrayBuffer(arrayBuffer);

await dotLottieV1.build();

const animationIds = dotLottieV1.animations.map((animation) => animation.id);

for (const animationId of animationIds) {
Expand Down
2 changes: 0 additions & 2 deletions packages/dotlottie-js/src/v2/node/dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export async function toDotLottieV2(arrayBuffer: ArrayBuffer): Promise<DotLottie
const dotLottieV2 = new DotLottie();
const dotLottieV1 = await new DotLottieV1().fromArrayBuffer(arrayBuffer);

await dotLottieV1.build();

const animationIds = dotLottieV1.animations.map((animation) => animation.id);

for (const animationId of animationIds) {
Expand Down

0 comments on commit 5372c7c

Please sign in to comment.