v4.0.18版本提交
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { formatStoreDisplayAddress } from './store-address';
|
||||
|
||||
describe('formatStoreDisplayAddress', () => {
|
||||
it('concatenates dropdown region with street-only detail', () => {
|
||||
expect(
|
||||
formatStoreDisplayAddress({
|
||||
province: '河南省',
|
||||
cityName: '郑州市',
|
||||
district: '金水区',
|
||||
address: '金水东路333号',
|
||||
}),
|
||||
).toBe('河南省郑州市金水区金水东路333号');
|
||||
});
|
||||
|
||||
it('does not strip region prefix already present in detail', () => {
|
||||
expect(
|
||||
formatStoreDisplayAddress({
|
||||
province: '河南省',
|
||||
cityName: '郑州市',
|
||||
district: '金水区',
|
||||
address: '河南省郑州市金水区金水东路333号',
|
||||
}),
|
||||
).toBe('河南省郑州市金水区河南省郑州市金水区金水东路333号');
|
||||
});
|
||||
|
||||
it('returns fallback when all parts are empty', () => {
|
||||
expect(formatStoreDisplayAddress({})).toBe('地址待完善');
|
||||
expect(formatStoreDisplayAddress({}, '')).toBe('');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user