Skip to content

Commit 11d9bca

Browse files
committed
fix: ci
1 parent f6d0cf0 commit 11d9bca

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

config/config.default.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ export default (appInfo: EggAppConfig) => {
197197
client: {
198198
node: process.env.CNPMCORE_CONFIG_ES_CLIENT_NODE,
199199
auth: {
200-
username: process.env.CNPMCORE_CONFIG_ES_CLIENT_AUTH_USERNAME,
201-
password: process.env.CNPMCORE_CONFIG_ES_CLIENT_AUTH_PASSWORD,
200+
username: process.env.CNPMCORE_CONFIG_ES_CLIENT_AUTH_USERNAME as string,
201+
password: process.env.CNPMCORE_CONFIG_ES_CLIENT_AUTH_PASSWORD as string,
202202
},
203203
},
204204
};

test/port/controller/package/SearchPackageController.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('test/port/controller/package/SearchPackageController.test.ts', () => {
5858
describe('[PUT /-/v1/search/sync/:fullname] sync()', async () => {
5959
it('should throw 451 when enableElasticsearch is false', async () => {
6060
mock(app.config.cnpmcore, 'enableElasticsearch', false);
61-
await await app.httpRequest()
61+
await app.httpRequest()
6262
.put('/-/v1/search/sync/example')
6363
.expect(451);
6464
});
@@ -92,14 +92,19 @@ describe('test/port/controller/package/SearchPackageController.test.ts', () => {
9292
});
9393

9494
describe('[DELETE /-/v1/search/sync/:fullname] delete()', async () => {
95+
let admin:Awaited<ReturnType<typeof TestUtil.createAdmin>>;
96+
beforeEach(async () => {
97+
admin = await TestUtil.createAdmin();
98+
});
9599
it('should throw 451 when enableElasticsearch is false', async () => {
96100
mock(app.config.cnpmcore, 'enableElasticsearch', false);
97-
await await app.httpRequest()
101+
await app.httpRequest()
98102
.delete('/-/v1/search/sync/example')
103+
.set('authorization', admin.authorization)
99104
.expect(451);
100105
});
101106

102-
it('should upsert a example package', async () => {
107+
it('should delete a example package', async () => {
103108
const name = 'testmodule-search-package';
104109
mockES.add({
105110
method: 'DELETE',
@@ -110,9 +115,12 @@ describe('test/port/controller/package/SearchPackageController.test.ts', () => {
110115
};
111116
});
112117
mock(app.config.cnpmcore, 'allowPublishNonScopePackage', true);
118+
mock(app.config.cnpmcore, 'enableElasticsearch', true);
113119
mock(app.config.cnpmcore, 'registry', 'https://registry.example.com');
120+
114121
const res = await app.httpRequest()
115-
.delete(`/-/v1/search/sync/${name}`);
122+
.delete(`/-/v1/search/sync/${name}`)
123+
.set('authorization', admin.authorization)
116124
assert.equal(res.body.package, name);
117125
});
118126
});

0 commit comments

Comments
 (0)