prices: fold groceries and CS skins into one price tracker (/trackers/prices) with tabs
Deploy production / deploy (push) Successful in 1m30s
Deploy production / deploy (push) Successful in 1m30s
- tab registry in #lib/price-trackers (add a tab = route + entry + icon) - groceries -> /trackers/prices/groceries (owner-only), CS prices -> /trackers/prices/cs (public) - old /trackers/groceries/* and /projects/cs-prices/* redirect (301 GET, 308 POST) with query - nav: one prices entry replaces groceries and skins; cyan price-tag icon
This commit is contained in:
1 parent
c175c25615
commit
81b0c51672
29 files changed
+163
-28
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { defaultPriceTab, legacyPriceRedirect, visiblePriceTabs } from './price-trackers';
|
||||
|
||||
describe('price tracker', () => {
|
||||
it('redirects old groceries and CS prices URLs with their sub-paths', () => {
|
||||
expect(legacyPriceRedirect('/trackers/groceries')).toEqual({
|
||||
to: '/trackers/prices/groceries',
|
||||
private: true
|
||||
});
|
||||
expect(legacyPriceRedirect('/trackers/groceries/stats')?.to).toBe(
|
||||
'/trackers/prices/groceries/stats'
|
||||
);
|
||||
expect(legacyPriceRedirect('/projects/cs-prices/ak-47-redline')).toEqual({
|
||||
to: '/trackers/prices/cs/ak-47-redline',
|
||||
private: false
|
||||
});
|
||||
expect(legacyPriceRedirect('/projects/cs-prices/api/series')?.to).toBe(
|
||||
'/trackers/prices/cs/api/series'
|
||||
);
|
||||
expect(legacyPriceRedirect('/trackers/groceriesx')).toBeNull();
|
||||
expect(legacyPriceRedirect('/trackers/prices/cs')).toBeNull();
|
||||
});
|
||||
it('hides private tabs from everyone but the owner', () => {
|
||||
expect(visiblePriceTabs(false).map((t) => t.slug)).toEqual(['cs']);
|
||||
expect(visiblePriceTabs(true).map((t) => t.slug)).toEqual(['groceries', 'cs']);
|
||||
expect(defaultPriceTab(false).slug).toBe('cs');
|
||||
expect(defaultPriceTab(true).slug).toBe('groceries');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user