/** * Common公用方法测试用例 */ import test from 'node:test'; import assert from 'node:assert'; import common from '../common.mjs'; test('Common function sortDict test', (t) => { let params = { b: 2, a: 1 }; const expectRes = { a: 1, b: 2 }; assert.deepEqual(common.sortDict(params), expectRes); }); test('Common function joinDict test', (t) => { let params = { b: 2, a: 1 }; const expectRes = "a=1&b=2"; assert.strictEqual(common.joinDict(common.sortDict(params)), expectRes); }); test('Common function getConfigFromJsonFile test', async (t) => { let filename = 'config.json'; let config = await common.getConfigFromJsonFile(filename); assert.ok(config); const expectName = 'Hero Union'; assert.strictEqual(config.name, expectName); });