smoke.mjs 632 B

123456789101112131415161718192021
  1. // __SKILL_NAME__ 冒烟测试
  2. // 运行:npm test 或 node test/smoke.mjs
  3. import test from 'node:test';
  4. import assert from 'node:assert/strict';
  5. import { greet, VERSION, SKILL_NAME } from '../lib/index.mjs';
  6. test('导出核心常量', () => {
  7. assert.equal(VERSION, '0.1.0');
  8. assert.equal(SKILL_NAME, '__SKILL_NAME__');
  9. });
  10. test('greet 返回预期文本', () => {
  11. assert.equal(greet('world'), `Hello, world! 来自 __SKILL_NAME__ v${VERSION}`);
  12. assert.equal(greet(), 'Hello, world! 来自 __SKILL_NAME__ v0.1.0');
  13. });
  14. test('greet 接受自定义名字', () => {
  15. assert.ok(greet('Fmode').includes('Fmode'));
  16. });