feat: add public seller directory
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { buildApp } from '../../src/app/build-app.js';
|
||||
|
||||
test('returns only public seller identity fields', async (testContext) => {
|
||||
const app = buildApp({
|
||||
publicSellerService: {
|
||||
async list() {
|
||||
return [{
|
||||
id: 'seller-1',
|
||||
userId: 'private-user-id',
|
||||
displayName: 'Catalog Owner',
|
||||
createdAt: new Date('2026-09-07T00:00:00.000Z'),
|
||||
updatedAt: new Date('2026-09-07T00:00:00.000Z'),
|
||||
}];
|
||||
},
|
||||
},
|
||||
});
|
||||
testContext.after(() => app.close());
|
||||
|
||||
const response = await app.inject({ method: 'GET', url: '/api/v1/public/sellers' });
|
||||
|
||||
assert.equal(response.statusCode, 200);
|
||||
assert.deepEqual(response.json().data[0], {
|
||||
id: 'seller-1',
|
||||
displayName: 'Catalog Owner',
|
||||
createdAt: '2026-09-07T00:00:00.000Z',
|
||||
updatedAt: '2026-09-07T00:00:00.000Z',
|
||||
});
|
||||
assert.equal('userId' in response.json().data[0], false);
|
||||
});
|
||||
Reference in New Issue
Block a user