summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2021-03-13 23:22:54 +0900
committerGitHub <noreply@github.com>2021-03-13 23:22:54 +0900
commit7d02b36092bbb4e1887abde57500e3aba13497f4 (patch)
tree0ea2abdd223a392d2f89b0d34f47ec4790687986 /test
parentFix Schema (#7347) (diff)
downloadsharkey-7d02b36092bbb4e1887abde57500e3aba13497f4.tar.gz
sharkey-7d02b36092bbb4e1887abde57500e3aba13497f4.tar.bz2
sharkey-7d02b36092bbb4e1887abde57500e3aba13497f4.zip
Fix assets test and favicon type (#7344)
* fix * koa-faviconはimage/x-iconがデフォルトらしい * シンプルに * faviconなど
Diffstat (limited to 'test')
-rw-r--r--test/fetch-resource.ts19
-rw-r--r--test/utils.ts2
2 files changed, 14 insertions, 7 deletions
diff --git a/test/fetch-resource.ts b/test/fetch-resource.ts
index bd3a325dc2..12a37b6cb0 100644
--- a/test/fetch-resource.ts
+++ b/test/fetch-resource.ts
@@ -22,6 +22,7 @@ const UNSPECIFIED = '*/*';
// Response Contet-Type
const AP = 'application/activity+json; charset=utf-8';
+const JSON = 'application/json; charset=utf-8';
const HTML = 'text/html; charset=utf-8';
describe('Fetch resource', () => {
@@ -50,33 +51,39 @@ describe('Fetch resource', () => {
}));
it('GET root', async(async () => {
- const res = await simpleGet('/', 'text/html');
+ const res = await simpleGet('/');
assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.type, HTML);
}));
it('GET docs', async(async () => {
- const res = await simpleGet('/docs/ja-JP/about', 'text/html');
+ const res = await simpleGet('/docs/ja-JP/about');
assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.type, HTML);
}));
it('GET api-doc', async(async () => {
- const res = await simpleGet('/api-doc', 'text/html');
+ const res = await simpleGet('/api-doc');
assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.type, HTML);
}));
it('GET api.json', async(async () => {
- const res = await simpleGet('/api.json', 'application/json');
+ const res = await simpleGet('/api.json');
assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.type, JSON);
}));
it('GET favicon.ico', async(async () => {
- const res = await simpleGet('/favicon.ico', 'image/png');
+ const res = await simpleGet('/favicon.ico');
assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.type, 'image/x-icon');
}));
it('GET apple-touch-icon.png', async(async () => {
- const res = await simpleGet('/apple-touch-icon.png', 'image/png');
+ const res = await simpleGet('/apple-touch-icon.png');
assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.type, 'image/png');
}));
});
diff --git a/test/utils.ts b/test/utils.ts
index 55e877a8a2..b0393ee192 100644
--- a/test/utils.ts
+++ b/test/utils.ts
@@ -110,7 +110,7 @@ export function connectStream(user: any, channel: string, listener: (message: Re
});
}
-export const simpleGet = async (path: string, accept: string): Promise<{ status?: number, type?: string, location?: string }> => {
+export const simpleGet = async (path: string, accept = '*/*'): Promise<{ status?: number, type?: string, location?: string }> => {
// node-fetchだと3xxを取れない
return await new Promise((resolve, reject) => {
const req = http.request(`http://localhost:${port}${path}`, {