mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-14 08:26:16 -08:00
refactor(tooling): [MOD-PLUGIN-01] generate typed plugins with safe output handling
This commit is contained in:
1 parent
07d5bfef2e
commit
28c7abb2bb
32 files changed
+958
-161
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { createRequire } from 'node:module'
|
||||
// eslint-disable-next-line test/no-import-node-test -- Verify the generated distribution contracts.
|
||||
import test from 'node:test'
|
||||
import plugin from 'artplayer-plugin-{{name}}'
|
||||
import legacy from 'artplayer-plugin-{{name}}/legacy'
|
||||
|
||||
test('classic factory and historical default alias return the synchronous plugin result', () => {
|
||||
const require = createRequire(import.meta.url)
|
||||
for (const factory of [plugin, legacy, require('artplayer-plugin-{{name}}'), require('artplayer-plugin-{{name}}/legacy')]) {
|
||||
assert.equal(factory.default, factory)
|
||||
const result = factory({})({})
|
||||
assert.deepEqual(result, { name: '{{export}}' })
|
||||
assert.equal(result instanceof Promise, false)
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user