# 6. 시험(Testing)

## 6.1 유닛 테스트(Unit test)

유닛 테스트로 63.7%의 Line Coverage와 67.5%의 Function Coverage를 달성했다.
### permission.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|permission.test|✅|14ms|
|permission empty|✅|16ms|
### session.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|Session : set |✅|14ms|
|Session : delete |✅|16ms|
|Login Handler : login with invalid format |✅|15ms|
|Login Handler : login with invalid password |✅|16ms|
|Login Handler : login |✅|15ms|
|Login Handler : logout with no session |✅|17ms|
|Login Handler : logout |✅|16ms|
|getSession|✅|15ms|
|getSession with invalid cookie|✅|15ms|
### user.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|user.createAdminUser|✅|5ms|
### filedoc.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|readDocFile|✅|12ms|
|readDocFile: not found|✅|15ms|
|readDocFile: invalid json|✅|15ms|
|saveDocFile|✅|15ms|
### methodHandle.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|methodHandle: basic methods|✅|14ms|
|methodHandle: not found|✅|15ms|
|methodHandle: options|✅|17ms|
### route.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|route: basic route|✅|6ms|
|route: double slash route|✅|12ms|
|route: double match|✅|16ms|
|route: test context|✅|15ms|
|route: test regex|✅|15ms|
|route: test not found|✅|2ms|
|route: encode_route|✅|12ms|
|route: router in router|✅|15ms|
### chunk.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|basic chunk operation : create chunk |✅|13ms|
|basic chunk operation : delete chunk |✅|15ms|
|basic chunk operation : modify chunk |✅|16ms|
|basic chunk operation : move chunk |✅|16ms|
|basic chunk operation : invalid chunk operation |✅|16ms|
|test chunk notification operation|✅|16ms|
|test chunk conflict|✅|15ms|
|test chunk conflict resolve with history|✅|32ms|
### doc.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|handleDocumentMethod|✅|5ms|
|handleTagMethod : setTag |✅|9ms|
|handleTagMethod : getTag |✅|16ms|
|handleTagMethod : conflict |✅|16ms|
### share.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|handleShareGetInfo|✅|16ms|
|handleShareDocMethod|✅|2ms|
|handleShareMethod with no existing share token|✅|12ms|
### server.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|server rpc test|✅|4s|
### fswatcher.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|WatchFilteredReadWriter|✅|79ms|
### readWriter.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|QueueReadWriter|✅|57ms|
### util.test.ts
| name | result | duration |
| ---- | ------ | -------- |
|watcher util isHidden|✅|5ms|

### Total

| name | passed | Steps | Failed | duration |
| ---- | ------ | ----- | ------ | -------- |
| ok | 35 | 15 | 0 | 4726ms |

## 6.2 기능 테스트(Functional Test)

<% const keys = Array.from(it.table.keys()); %>

<% keys.forEach(c=>{ 
  const issues = it.table.get(c);
  const ts = issues.map(x=> it.testcases.filter(y=>y.id==x.number)).flat();
  if(ts?.length == 0) return; %>
<%~`\n\n### ${c}\n\n`%>
<%~"<table>"%>
<%~"<thead>"%>
<%~"<tr>"%>
<%~"<th>ID</th>"%>
<%~"<th>Content</th>"%>
<%~"<th>Procedure</th>"%>
<%~"<th>Test Data</th>"%>
<%~"<th>P/F</th>"%>
<%~"</tr>"%>
<%~"</thead>"%>
<%~"<tbody>"%>
<% ts.forEach((y,i)=>{
      const id = y.subId ? `${y.id}-${y.subId}` : y.id;%>
<%~"<tr>"%>
<%~`<td>${id}</td>`%>
<%~`<td>${y.content}</td>`%>
<%~`<td>${y.procedure}</td>`%>
<%~`<td>${y.testData ?? ""}</td>`%>
<%~`<td>${y.pass ? "✅" : "❌"}</td>`%>
<%~"</tr>"%>
<%});%>
<%~"</tbody>"%>
<%~"</table>"%>
<% });%>