You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
585 B
35 lines
585 B
8 months ago
|
/**
|
||
|
* 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);
|
||
|
});
|
||
|
|