32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
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('');
|
|
});
|
|
});
|