fix(api): close v2 mobile contract gaps
This commit is contained in:
@@ -182,3 +182,56 @@ test('proxy forwards direct core upload aliases to core api', async () => {
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(seenUrl, 'https://core.example/core/staff/certificates/upload');
|
||||
});
|
||||
|
||||
test('proxy forwards PUT document upload aliases to core api', async () => {
|
||||
process.env.QUERY_API_BASE_URL = 'https://query.example';
|
||||
process.env.CORE_API_BASE_URL = 'https://core.example';
|
||||
process.env.COMMAND_API_BASE_URL = 'https://command.example';
|
||||
|
||||
let seenUrl = null;
|
||||
let seenMethod = null;
|
||||
const app = createApp({
|
||||
fetchImpl: async (url, init = {}) => {
|
||||
seenUrl = `${url}`;
|
||||
seenMethod = init.method;
|
||||
return new Response(JSON.stringify({ ok: true }), {
|
||||
status: 200,
|
||||
headers: { 'content-type': 'application/json' },
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const res = await request(app)
|
||||
.put('/staff/profile/documents/doc-1/upload')
|
||||
.set('Authorization', 'Bearer test-token')
|
||||
.send({ verificationId: 'verification-1' });
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(seenMethod, 'PUT');
|
||||
assert.equal(seenUrl, 'https://core.example/core/staff/documents/doc-1/upload');
|
||||
});
|
||||
|
||||
test('proxy forwards rapid order process alias to core api', async () => {
|
||||
process.env.QUERY_API_BASE_URL = 'https://query.example';
|
||||
process.env.CORE_API_BASE_URL = 'https://core.example';
|
||||
process.env.COMMAND_API_BASE_URL = 'https://command.example';
|
||||
|
||||
let seenUrl = null;
|
||||
const app = createApp({
|
||||
fetchImpl: async (url) => {
|
||||
seenUrl = `${url}`;
|
||||
return new Response(JSON.stringify({ ok: true }), {
|
||||
status: 200,
|
||||
headers: { 'content-type': 'application/json' },
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const res = await request(app)
|
||||
.post('/rapid-orders/process')
|
||||
.set('Authorization', 'Bearer test-token')
|
||||
.send({ text: 'Need 2 servers ASAP for 4 hours' });
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(seenUrl, 'https://core.example/core/rapid-orders/process');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user