Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a9ecd0b8d |
@@ -5,6 +5,7 @@
|
||||
"www": {
|
||||
"site": "www",
|
||||
"tenantId": 2,
|
||||
"currencyCode": "EUR",
|
||||
"searchUrl": "https://www.yehwang.com/search.html?q=",
|
||||
"siteMap": "site-map.json",
|
||||
"language": "en"
|
||||
@@ -12,6 +13,7 @@
|
||||
"us": {
|
||||
"site": "us",
|
||||
"tenantId": 2,
|
||||
"currencyCode": "USD",
|
||||
"searchUrl": "https://us.yehwang.com/search.html?q=",
|
||||
"siteMap": "site-map-us.json",
|
||||
"language": "en"
|
||||
@@ -19,6 +21,7 @@
|
||||
"eu": {
|
||||
"site": "www",
|
||||
"tenantId": 2,
|
||||
"currencyCode": "EUR",
|
||||
"searchUrl": "https://www.yehwang.com/search.html?q=",
|
||||
"siteMap": "site-map.json",
|
||||
"language": "en"
|
||||
|
||||
@@ -8,7 +8,7 @@ function loadSites(env) {
|
||||
const fallback = {
|
||||
defaultSite: 'www',
|
||||
profiles: {
|
||||
www: { site: 'www', tenantId: null, languageId: null, currencyCode: 'USD', searchUrl: 'https://www.yehwang.com/search.html?q=', siteMap: 'site-map.json' },
|
||||
www: { site: 'www', tenantId: null, languageId: null, currencyCode: 'EUR', searchUrl: 'https://www.yehwang.com/search.html?q=', siteMap: 'site-map.json' },
|
||||
},
|
||||
inboxes: {},
|
||||
};
|
||||
|
||||
@@ -569,3 +569,30 @@ test('create_opportunity: creates opportunity + note + follow-up task', async ()
|
||||
const personIdx = twenty.calls.findIndex((c) => c[0] === 'createPerson');
|
||||
assert.ok(companyIdx >= 0 && personIdx > companyIdx, 'company must be created before person');
|
||||
});
|
||||
|
||||
test('sites.json: www/eu -> EUR, us -> USD', () => {
|
||||
const sites = require('../config/sites.json');
|
||||
assert.equal(sites.profiles.www.currencyCode, 'EUR');
|
||||
assert.equal(sites.profiles.eu.currencyCode, 'EUR');
|
||||
assert.equal(sites.profiles.us.currencyCode, 'USD');
|
||||
});
|
||||
|
||||
test('search_products: passes the site currency to the product RPC', async () => {
|
||||
const rpc = fakeRpc(() => []);
|
||||
const cfg = {
|
||||
...baseCfg,
|
||||
sites: {
|
||||
defaultSite: 'www',
|
||||
profiles: { www: { site: 'www', tenantId: 2, languageId: 1, currencyCode: 'EUR', searchUrl: 'https://www.yehwang.com/search.html?q=' } },
|
||||
inboxes: { '1': 'www' },
|
||||
},
|
||||
};
|
||||
const tools = createTools(cfg, { rpc, twenty: fakeTwenty() });
|
||||
const tool = tools.find((t) => t.name === 'search_products');
|
||||
await tool.handler({ query: 'rings' }, { inboxId: '1' });
|
||||
const call = rpc.calls[0];
|
||||
assert.equal(call.method, '/product/list');
|
||||
assert.equal(call.params[0].currencyCode, 'EUR');
|
||||
assert.equal(call.params[0].tenantBaseCurrency, 'EUR');
|
||||
assert.equal(call.params[0].reqContext.currencyCode, 'EUR');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user