Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jihchi committed Mar 14, 2024
1 parent 74a00b2 commit 4702949
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ const debug = createDebug('app:main');
const pptr = createDebug('app:pptr');
const app = new Koa();

app.use(cors({ allowMethods: 'GET' }));
app.use(
cors({
allowMethods: 'GET',
origin(ctx) {
return ctx.get('Origin') || '*';
},
})
);
app.use(route.get('/', views.home));
app.use(route.get('/services/oembed', views.servicesOembed));
app.use(route.get('/img/:encodedCode', views.img));
Expand Down
3 changes: 2 additions & 1 deletion test/kitchensink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ describe('app', () => {
});

describe('Fixed #272, ER diagram', () => {
const encodedPath = 'pako:eNpFjrEKwzAMRH_F3FjyBd4CXTt1a9VBxEpqiO3gyEMJ_ve4SaE36R6H7jYMyQksJF89T5kDRdPUPwn9hfAy2wm-WjX7OJn-JJUiOgTJgb1rH44gQd8ShGDb6WTkMiuBYm1RLprunzjAai7SoSyOVX61sCPPa6MLx0dKfy_Oa8q3c-Uxtu7OaTo4';
const encodedPath =
'pako:eNpFjrEKwzAMRH_F3FjyBd4CXTt1a9VBxEpqiO3gyEMJ_ve4SaE36R6H7jYMyQksJF89T5kDRdPUPwn9hfAy2wm-WjX7OJn-JJUiOgTJgb1rH44gQd8ShGDb6WTkMiuBYm1RLprunzjAai7SoSyOVX61sCPPa6MLx0dKfy_Oa8q3c-Uxtu7OaTo4';

test('img', async () => {
const resp = await request.get(`/img/${encodedPath}`);
Expand Down

0 comments on commit 4702949

Please sign in to comment.