Fix assets test and favicon type (#7344)
* fix * koa-faviconはimage/x-iconがデフォルトらしい * シンプルに * faviconなど
This commit is contained in:
		
							parent
							
								
									9e634360fa
								
							
						
					
					
						commit
						7d02b36092
					
				
					 5 changed files with 16 additions and 9 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								assets/favicon.ico
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/favicon.ico
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 88 KiB | 
|  | @ -322,7 +322,7 @@ proxyRemoteFilesDescription: "この設定を有効にすると、未保存ま | ||||||
| driveCapacityPerLocalAccount: "ローカルユーザーひとりあたりのドライブ容量" | driveCapacityPerLocalAccount: "ローカルユーザーひとりあたりのドライブ容量" | ||||||
| driveCapacityPerRemoteAccount: "リモートユーザーひとりあたりのドライブ容量" | driveCapacityPerRemoteAccount: "リモートユーザーひとりあたりのドライブ容量" | ||||||
| inMb: "メガバイト単位" | inMb: "メガバイト単位" | ||||||
| iconUrl: "アイコン画像のURL" | iconUrl: "アイコン画像のURL (faviconなど)" | ||||||
| bannerUrl: "バナー画像のURL" | bannerUrl: "バナー画像のURL" | ||||||
| basicInfo: "基本情報" | basicInfo: "基本情報" | ||||||
| pinnedUsers: "ピン留めユーザー" | pinnedUsers: "ピン留めユーザー" | ||||||
|  |  | ||||||
|  | @ -45,7 +45,7 @@ app.use(views(__dirname + '/views', { | ||||||
| })); | })); | ||||||
| 
 | 
 | ||||||
| // Serve favicon
 | // Serve favicon
 | ||||||
| app.use(favicon(`${__dirname}/../../../assets/favicon.png`)); | app.use(favicon(`${__dirname}/../../../assets/favicon.ico`)); | ||||||
| 
 | 
 | ||||||
| // Common request handler
 | // Common request handler
 | ||||||
| app.use(async (ctx, next) => { | app.use(async (ctx, next) => { | ||||||
|  |  | ||||||
|  | @ -22,6 +22,7 @@ const UNSPECIFIED = '*/*'; | ||||||
| 
 | 
 | ||||||
| // Response Contet-Type
 | // Response Contet-Type
 | ||||||
| const AP = 'application/activity+json; charset=utf-8'; | const AP = 'application/activity+json; charset=utf-8'; | ||||||
|  | const JSON = 'application/json; charset=utf-8'; | ||||||
| const HTML = 'text/html; charset=utf-8'; | const HTML = 'text/html; charset=utf-8'; | ||||||
| 
 | 
 | ||||||
| describe('Fetch resource', () => { | describe('Fetch resource', () => { | ||||||
|  | @ -50,33 +51,39 @@ describe('Fetch resource', () => { | ||||||
| 		})); | 		})); | ||||||
| 
 | 
 | ||||||
| 		it('GET root', async(async () => { | 		it('GET root', async(async () => { | ||||||
| 			const res = await simpleGet('/', 'text/html'); | 			const res = await simpleGet('/'); | ||||||
| 			assert.strictEqual(res.status, 200); | 			assert.strictEqual(res.status, 200); | ||||||
|  | 			assert.strictEqual(res.type, HTML); | ||||||
| 		})); | 		})); | ||||||
| 
 | 
 | ||||||
| 		it('GET docs', async(async () => { | 		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.status, 200); | ||||||
|  | 			assert.strictEqual(res.type, HTML); | ||||||
| 		})); | 		})); | ||||||
| 
 | 
 | ||||||
| 		it('GET api-doc', async(async () => { | 		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.status, 200); | ||||||
|  | 			assert.strictEqual(res.type, HTML); | ||||||
| 		})); | 		})); | ||||||
| 
 | 
 | ||||||
| 		it('GET api.json', async(async () => { | 		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.status, 200); | ||||||
|  | 			assert.strictEqual(res.type, JSON); | ||||||
| 		})); | 		})); | ||||||
| 
 | 
 | ||||||
| 		it('GET favicon.ico', async(async () => { | 		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.status, 200); | ||||||
|  | 			assert.strictEqual(res.type, 'image/x-icon'); | ||||||
| 		})); | 		})); | ||||||
| 
 | 
 | ||||||
| 		it('GET apple-touch-icon.png', async(async () => { | 		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.status, 200); | ||||||
|  | 			assert.strictEqual(res.type, 'image/png'); | ||||||
| 		})); | 		})); | ||||||
| 	}); | 	}); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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を取れない
 | 	// node-fetchだと3xxを取れない
 | ||||||
| 	return await new Promise((resolve, reject) => { | 	return await new Promise((resolve, reject) => { | ||||||
| 		const req = http.request(`http://localhost:${port}${path}`, { | 		const req = http.request(`http://localhost:${port}${path}`, { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue