aladin-lite icon indicating copy to clipboard operation
aladin-lite copied to clipboard

test: add initialization of aladin with default parameters test

Open ManonMarchand opened this issue 2 years ago • 3 comments

What the PR does

It tries to add a very basic test where an Aladin instance with default parameters is created in a window and this should match a snapshot.

Why it is in draft state

Running

npm run test:unit

Lead to the following failure:

 FAIL  tests/unit/Aladin.test.js [ tests/unit/Aladin.test.js ]
Error: Failed to resolve entry for package "/home/manon.marchand/Documents/cds-astro-github/aladin-lite/src/core/pkg". The package may have incorrect main/module/exports specified in its package.json.
 ❯ packageEntryFailure node_modules/vite/dist/node/chunks/dep-52909643.js:28725:11
 ❯ resolvePackageEntry node_modules/vite/dist/node/chunks/dep-52909643.js:28722:5
 ❯ tryCleanFsResolve node_modules/vite/dist/node/chunks/dep-52909643.js:28381:28
 ❯ tryFsResolve node_modules/vite/dist/node/chunks/dep-52909643.js:28328:17
 ❯ Context.resolveId node_modules/vite/dist/node/chunks/dep-52909643.js:28153:28
 ❯ Object.resolveId node_modules/vite/dist/node/chunks/dep-52909643.js:44276:64
 ❯ TransformContext.resolve node_modules/vite/dist/node/chunks/dep-52909643.js:43992:23
 ❯ normalizeUrl node_modules/vite/dist/node/chunks/dep-52909643.js:41836:34
 ❯ async file:/home/manon.marchand/Documents/cds-astro-github/aladin-lite/node_modules/vite/dist/node/chunks/dep-52909643.js:41998:47

@onekiloparsec : thanks a lot for setting up the first test in this repo. I read through vittest documentation, and I'd like to add more tests, but I'm stuck. Would you have any pointers on how to make this one work?

ManonMarchand avatar Mar 08 '24 10:03 ManonMarchand

Thanks for the ping Marion. For sure I'd be happy to help. I will have a look at it ASAP.

onekiloparsec avatar Mar 08 '24 10:03 onekiloparsec

Sorry Marion for the late reply. I've had a look at your test. Unfortunately, you immediately test something that is actually very hard to test: snapshot matching! Moreover, testing the init (which itself is executing quite a few things) is also quite ambitious. I would rather start testing the small/useful methods (mine is a utility method) to practice first.

onekiloparsec avatar Mar 13 '24 11:03 onekiloparsec

Trying myself your PR... I agree that the failure and the error message indicates something wrong with the import of the Rust/Cargo part. I keep searching.

onekiloparsec avatar Mar 13 '24 11:03 onekiloparsec