Open hachimetsu opened 7 months ago
i used my most of the time to just create test case for asar and still not done so i just created a pull request
i only done changes in src/fiddle.ts file added the fromASAR function which unpack asar content to tempDir and then call fromFolder on tempDir
@erickzhao can i also help i would like to learn how to create test case
what should i do in test case ? I know how to make a test case pass, but then it doesn't behave like a real test case anymore.
A test case should show an error if there's one, but I'm unsure what conditions would constitute an error in this situation.
i did search about api-extractor i did not created a new pull because i want to compete the test case part too
A test case should show an error if there's one, but I'm unsure what conditions would constitute an error in this situation.
Do you mean a negative case? You can simply use not
before condition, e.g. expect(fiddle!.mainPath).not.toBe(asarPath)
, but I don't think it's needed anyway? The test case could be structured like reads fiddles from gists
test:
mainPath
of the fiddle is exist and has a basename of main.js
You can be more rigorous by making sure the file list and files' content are identical by comparing it with fiddleFixture('642fa8daaebea6044c9079e3f8a46390')
just like in the reads fiddles from local folders
test.
thanks for suggestion
we test if mainPath in fiddle object is same as provided path and there content are same or not
asarPath: path to asar file (example fiddle-core/tests/fixtures/fiddle.asar
)
mainPath: path to dir where content from asar get extracted (example fiddle-core-running-temp-path/extract/temp/fiddle
)
for now what i did for test
but then testing of asar will depend on content of example fiddle if in future fiddle example get changed then asar file must be create from that example
Yeah that might happen. I have an idea, what about archiving the fiddleFixture('642fa8daaebea6044c9079e3f8a46390')
as ASAR on the fly when testing it? Save it in tmpdir
and let asarPath
points to it. Then you can create fiddle fromASAR with it. Don't worry about cleaning up, afterEach(()=>{fs.removeSync(tmpdir);})
already done the cleaning job for you.
100
what improvement should i do am i doing right ?