Skip to content

Commit

Permalink
test: fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemain committed Oct 15, 2024
1 parent 0c837ef commit ce7e416
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions __tests__/__mocks__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const githubAppId = process.env.GITHUB_APPID || 'mock-app-id';
const githubPrivateKey =
process.env.GITHUB_APP_PRIVATE_KEY || 'mock-private-key';

export function prepareEnv() {
export async function prepareEnv() {
const kv = new LocalKV();
Environment.initialize(runtimeConfig, {
KV: kv,
MESSAGE_QUEUE: {} as any,
ENVIRONMENT: 'unittest',
});

kv.put(
await kv.put(
`${GitHubCommon.GITHUB_APP_SETTINGS_PREFIX}mock`,
JSON.stringify({
appSettings: {
Expand All @@ -31,6 +31,6 @@ export function prepareEnv() {
console.log('prepare env done');
console.log(
'app settings',
kv.get(`${GitHubCommon.GITHUB_APP_SETTINGS_PREFIX}mock`),
await kv.get(`${GitHubCommon.GITHUB_APP_SETTINGS_PREFIX}mock`),
);
}
2 changes: 1 addition & 1 deletion __tests__/queue/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const botId = 'mock';

describe('queue', () => {
beforeAll(() => {
prepareEnv();
return prepareEnv();
});

it('should work', async () => {
Expand Down

0 comments on commit ce7e416

Please sign in to comment.