refactor: 去掉 replaceAllKeys 无人使用的返回值
两处调用点都是裸语句、忽略返回值,函数保持原地修改语义,调用方行为不变。 连带删掉专门断言返回值的那个用例,其余测试不变。
This commit is contained in:
parent
72bc6c9af2
commit
102c75079d
|
|
@ -10,5 +10,4 @@
|
|||
export function replaceAllKeys(target, values) {
|
||||
Object.keys(target).forEach(key => { delete target[key] })
|
||||
Object.assign(target, values)
|
||||
return target
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,4 @@ describe('replaceAllKeys', () => {
|
|||
expect(form.code).toBe('B')
|
||||
expect(form.status).toBe('active')
|
||||
})
|
||||
|
||||
test('返回 target,便于链式书写', () => {
|
||||
const form = {}
|
||||
|
||||
expect(replaceAllKeys(form, { code: 'A' })).toBe(form)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user