updates on the admin and zone things and minor changes
This commit is contained in:
@@ -87,8 +87,10 @@ describe('a tenant session never matches on a hub id', () => {
|
||||
it('a booking whose pickuphubid is 5 does not land in tenant location 5', () => {
|
||||
// Two different id spaces. Matching them would file an order under a
|
||||
// kitchen it has nothing to do with, on a bare numeric collision.
|
||||
// A client location's zone id is prefixed ('loc:5') precisely so it can
|
||||
// never be confused with hub 5, which a client now also sees.
|
||||
const { result } = setup({ user: { tenantid: '13' }, locations: [KITCHEN] });
|
||||
expect(inZone(result, '5', {
|
||||
expect(inZone(result, 'loc:5', {
|
||||
bookingid: 3, bookingno: 'DM-X', tenantid: '13', pickuphubid: 5,
|
||||
pickupaddress: 'Gate 3', deliveryaddress: 'Block C'
|
||||
})).toBe(false);
|
||||
@@ -96,11 +98,28 @@ describe('a tenant session never matches on a hub id', () => {
|
||||
|
||||
it('but its own tenantlocationid still matches', () => {
|
||||
const { result } = setup({ user: { tenantid: '13' }, locations: [KITCHEN] });
|
||||
expect(inZone(result, '5', {
|
||||
expect(inZone(result, 'loc:5', {
|
||||
bookingid: 4, bookingno: 'DM-Y', tenantid: '13', tenantlocationid: 5,
|
||||
pickupaddress: 'Gate 3', deliveryaddress: 'Block C'
|
||||
})).toBe(true);
|
||||
});
|
||||
|
||||
it('a client who picks a Doormile HUB is matched on hub ids, never on location ids', () => {
|
||||
const { result } = setup({ user: { tenantid: '13' }, locations: [KITCHEN] });
|
||||
expect(inZone(result, '5', {
|
||||
bookingid: 5, bookingno: 'DM-H', tenantid: '13', pickuphubid: 5,
|
||||
pickupaddress: 'Gate 3', deliveryaddress: 'Block C'
|
||||
})).toBe(true);
|
||||
expect(inZone(result, '5', {
|
||||
bookingid: 6, bookingno: 'DM-L', tenantid: '13', tenantlocationid: 5,
|
||||
pickupaddress: 'Gate 3', deliveryaddress: 'Block C'
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it("never shows a client another tenant's order, whatever zone is picked", () => {
|
||||
const { result } = setup({ user: { tenantid: '13' }, locations: [KITCHEN] });
|
||||
expect(inZone(result, '5', { bookingid: 7, tenantid: '99', pickuphubid: 5, pickupaddress: 'a' })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the city comparison, which needs a city on the hub', () => {
|
||||
@@ -172,9 +191,18 @@ describe('one id space at a time', () => {
|
||||
const KITCHEN = { tenantlocationid: 5, locationname: 'Indiranagar Kitchen',
|
||||
city: 'Bengaluru', latitude: 12.9784, longitude: 77.6408, pincode: '560038' };
|
||||
const { result } = setup({ user: { tenantid: '13' }, locations: [KITCHEN] });
|
||||
expect(inZone(result, '5', { bookingid: 1, tenantid: '13', tenantlocationid: 5,
|
||||
expect(inZone(result, 'loc:5', { bookingid: 1, tenantid: '13', tenantlocationid: 5,
|
||||
pickupaddress: 'a', deliveryaddress: 'b' })).toBe(true);
|
||||
expect(inZone(result, '5', { bookingid: 2, tenantid: '13', servicinghubid: 5,
|
||||
expect(inZone(result, 'loc:5', { bookingid: 2, tenantid: '13', servicinghubid: 5,
|
||||
pickupaddress: 'a', deliveryaddress: 'b' })).toBe(false);
|
||||
});
|
||||
|
||||
it('a deactivated tenant location is not offered as a zone', () => {
|
||||
const LIVE = { tenantlocationid: 7, locationname: 'Saibaba Colony', status: 'Active' };
|
||||
const OLD = { tenantlocationid: 8, locationname: 'Main Branch', status: 'Inactive' };
|
||||
const { result } = setup({ user: { tenantid: '13' }, locations: [LIVE, OLD] });
|
||||
const ids = result.current.zones.map((z) => z.hubid);
|
||||
expect(ids).toContain('loc:7');
|
||||
expect(ids).not.toContain('loc:8');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user