@things-factory/organization 10.1.278 → 10.1.280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +24 -8
- package/CHANGELOG.md +0 -8
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/component/approval-line-brief.js.map +0 -1
- package/dist-client/component/approval-line-edit.js.map +0 -1
- package/dist-client/component/approval-line-items-editor-popup.js.map +0 -1
- package/dist-client/component/approval-line-items-editor.js.map +0 -1
- package/dist-client/component/approval-line-selector.js.map +0 -1
- package/dist-client/component/approval-line-templates-manager.js.map +0 -1
- package/dist-client/component/approval-line-view.js.map +0 -1
- package/dist-client/component/assignees-editor-popup.js.map +0 -1
- package/dist-client/component/assignees-editor.js.map +0 -1
- package/dist-client/component/assignees-view.js.map +0 -1
- package/dist-client/component/copy-from.js.map +0 -1
- package/dist-client/component/department-selector.js.map +0 -1
- package/dist-client/component/department-view.js.map +0 -1
- package/dist-client/component/index.js.map +0 -1
- package/dist-client/component/popup-actions-row.test.d.ts +0 -1
- package/dist-client/component/popup-actions-row.test.js +0 -42
- package/dist-client/component/popup-actions-row.test.js.map +0 -1
- package/dist-client/component/recipients-editor-popup.js.map +0 -1
- package/dist-client/component/recipients-editor.js.map +0 -1
- package/dist-client/component/recipients-view.js.map +0 -1
- package/dist-client/entity360/department-360.js.map +0 -1
- package/dist-client/entity360/person-membership-section.js.map +0 -1
- package/dist-client/filters-form/filter-department-object.js.map +0 -1
- package/dist-client/filters-form/ox-filter-department-object.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-approval-line.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-assignees.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-department-object.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-recipients.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-approval-line.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-assignees.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-department-object.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-recipients.js.map +0 -1
- package/dist-client/index.js.map +0 -1
- package/dist-client/my-picture-model.js.map +0 -1
- package/dist-client/my-picture.js.map +0 -1
- package/dist-client/pages/approval-line/approval-line-list-page.js.map +0 -1
- package/dist-client/pages/approval-line/common-approval-line-templates-page.js.map +0 -1
- package/dist-client/pages/approval-line/my-approval-line-templates-page.js.map +0 -1
- package/dist-client/pages/department/department-importer.js.map +0 -1
- package/dist-client/pages/department/department-list-page.js.map +0 -1
- package/dist-client/pages/department/department-patch.js.map +0 -1
- package/dist-client/pages/employee/employee-importer.js.map +0 -1
- package/dist-client/pages/employee/employee-list-page.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-files.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-form.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-list-page.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-preview.js.map +0 -1
- package/dist-client/pages/employee-profile/my-employee-profile-page.js.map +0 -1
- package/dist-client/route.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-client/types/approval-line.js.map +0 -1
- package/dist-client/types/contact.js.map +0 -1
- package/dist-client/types/department.js.map +0 -1
- package/dist-client/types/employee.js.map +0 -1
- package/dist-client/types/index.js.map +0 -1
- package/dist-client/types/org-member.js.map +0 -1
- package/dist-server/ai-entry/employee-profile-entry.js.map +0 -1
- package/dist-server/ai-entry/entry-target-shape.js.map +0 -1
- package/dist-server/ai-entry/organization-entry-rules.js.map +0 -1
- package/dist-server/ai-entry/organization-entry-targets.js.map +0 -1
- package/dist-server/controllers/register-employee-as-system-user.js.map +0 -1
- package/dist-server/index.js.map +0 -1
- package/dist-server/migrations/1723861013111-seed-organization-codes.js.map +0 -1
- package/dist-server/migrations/index.js.map +0 -1
- package/dist-server/role-tasks.js.map +0 -1
- package/dist-server/routes.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-item.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-mutation.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-query.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-type.js.map +0 -1
- package/dist-server/service/approval-line/approval-line.js.map +0 -1
- package/dist-server/service/approval-line/index.js.map +0 -1
- package/dist-server/service/audience/audience-member.js.map +0 -1
- package/dist-server/service/audience/audience.js.map +0 -1
- package/dist-server/service/certificate/employment-certificate-rules.js.map +0 -1
- package/dist-server/service/certificate/employment-certificate-templates.js.map +0 -1
- package/dist-server/service/certificate/employment-certificates.js.map +0 -1
- package/dist-server/service/department/department-history.js.map +0 -1
- package/dist-server/service/department/department-mutation.js.map +0 -1
- package/dist-server/service/department/department-parent.js.map +0 -1
- package/dist-server/service/department/department-query.js.map +0 -1
- package/dist-server/service/department/department-type.js.map +0 -1
- package/dist-server/service/department/department.js.map +0 -1
- package/dist-server/service/department/event-subscriber.js.map +0 -1
- package/dist-server/service/department/index.js.map +0 -1
- package/dist-server/service/domain-reference.js.map +0 -1
- package/dist-server/service/employee/employee-control-no.js.map +0 -1
- package/dist-server/service/employee/employee-day.js.map +0 -1
- package/dist-server/service/employee/employee-history.js.map +0 -1
- package/dist-server/service/employee/employee-mutation.js.map +0 -1
- package/dist-server/service/employee/employee-private.js.map +0 -1
- package/dist-server/service/employee/employee-query.js.map +0 -1
- package/dist-server/service/employee/employee-type.js.map +0 -1
- package/dist-server/service/employee/employee.js.map +0 -1
- package/dist-server/service/employee/event-subscriber.js.map +0 -1
- package/dist-server/service/employee/index.js.map +0 -1
- package/dist-server/service/employee/my-employee-refusal.js.map +0 -1
- package/dist-server/service/employee/my-employee.js.map +0 -1
- package/dist-server/service/employee/working-employees.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-document.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-mutation.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-query.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-rows.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-rules.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-type.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile.js.map +0 -1
- package/dist-server/service/employee-profile/index.js.map +0 -1
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/dist-server/work-doors.js.map +0 -1
- package/spec/unit/approval-line.spec.ts +0 -329
- package/spec/unit/department.spec.ts +0 -253
- package/spec/unit/employee.spec.ts +0 -271
- package/spec/unit/my-employee.spec.ts +0 -102
- package/tests/approval-line-brief-plan.test.ts +0 -35
- package/tests/approval-line-edit.test.ts +0 -78
- package/tests/approval-line-mark.test.ts +0 -68
- package/tests/approval-line-step-fields.test.ts +0 -108
- package/tests/assignees-editor-no-role.test.ts +0 -32
- package/tests/audience.test.ts +0 -85
- package/tests/copy-from.test.ts +0 -17
- package/tests/department-open-fields.test.ts +0 -72
- package/tests/department-parent.test.ts +0 -187
- package/tests/department-patch.test.ts +0 -52
- package/tests/department-query-shape.test.ts +0 -130
- package/tests/department-selector.test.ts +0 -32
- package/tests/domain-reference.test.ts +0 -186
- package/tests/employee-day.test.ts +0 -165
- package/tests/employee-private.test.ts +0 -37
- package/tests/employee-profile-db.test.ts +0 -261
- package/tests/employee-profile-document.test.ts +0 -282
- package/tests/employee-profile-entry.test.ts +0 -72
- package/tests/employee-profile-rules.test.ts +0 -103
- package/tests/entity360.test.ts +0 -36
- package/tests/my-picture.test.ts +0 -21
- package/tests/organization-entry-targets.test.ts +0 -236
- package/tests/refusals-in-korean.test.ts +0 -48
- package/tests/register-employee-role.test.ts +0 -97
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Employee Unit Tests
|
|
3
|
-
* 직원 엔티티 단위 테스트
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { TestDatabase } from '../../../../test/test-database'
|
|
7
|
-
import { withTestTransaction } from '../../../../test/test-context'
|
|
8
|
-
import {
|
|
9
|
-
domainFactory,
|
|
10
|
-
userFactory,
|
|
11
|
-
employeeFactory,
|
|
12
|
-
departmentFactory
|
|
13
|
-
} from '../../../../test/factories'
|
|
14
|
-
import { EmployeeType } from '../../../../test/entities/schemas'
|
|
15
|
-
|
|
16
|
-
describe('Employee Entity Tests', () => {
|
|
17
|
-
let testDb: TestDatabase
|
|
18
|
-
|
|
19
|
-
beforeAll(async () => {
|
|
20
|
-
testDb = TestDatabase.getInstance()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('Employee 생성', () => {
|
|
24
|
-
it('Employee가 올바르게 생성되어야 한다', async () => {
|
|
25
|
-
await withTestTransaction(async (context) => {
|
|
26
|
-
const { tx, domain } = context.state
|
|
27
|
-
|
|
28
|
-
// When
|
|
29
|
-
const employee = await employeeFactory.createWithDomain(
|
|
30
|
-
{
|
|
31
|
-
controlNo: 'EMP-001',
|
|
32
|
-
name: 'John Doe',
|
|
33
|
-
jobPosition: 'Engineer',
|
|
34
|
-
type: EmployeeType.FULLTIME
|
|
35
|
-
},
|
|
36
|
-
domain,
|
|
37
|
-
tx
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
// Then
|
|
41
|
-
expect(employee).toBeDefined()
|
|
42
|
-
expect(employee.id).toBeDefined()
|
|
43
|
-
expect(employee.controlNo).toBe('EMP-001')
|
|
44
|
-
expect(employee.name).toBe('John Doe')
|
|
45
|
-
expect(employee.jobPosition).toBe('Engineer')
|
|
46
|
-
expect(employee.type).toBe(EmployeeType.FULLTIME)
|
|
47
|
-
expect(employee.domain?.id).toBe(domain.id)
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('controlNo는 필수 필드여야 한다', async () => {
|
|
52
|
-
await withTestTransaction(async (context) => {
|
|
53
|
-
const { tx, domain } = context.state
|
|
54
|
-
|
|
55
|
-
// When
|
|
56
|
-
const employee = await employeeFactory.createWithDomain(
|
|
57
|
-
{ controlNo: 'REQUIRED-001' },
|
|
58
|
-
domain,
|
|
59
|
-
tx
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
// Then
|
|
63
|
-
expect(employee.controlNo).toBe('REQUIRED-001')
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('다양한 EmployeeType이 지원되어야 한다', async () => {
|
|
68
|
-
await withTestTransaction(async (context) => {
|
|
69
|
-
const { tx, domain } = context.state
|
|
70
|
-
|
|
71
|
-
// When: FULLTIME
|
|
72
|
-
const fulltime = await employeeFactory.createWithDomain(
|
|
73
|
-
{ type: EmployeeType.FULLTIME },
|
|
74
|
-
domain,
|
|
75
|
-
tx
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
// When: PARTTIME
|
|
79
|
-
const parttime = await employeeFactory.createWithDomain(
|
|
80
|
-
{ type: EmployeeType.PARTTIME },
|
|
81
|
-
domain,
|
|
82
|
-
tx
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
// When: TEMPORARY
|
|
86
|
-
const temporary = await employeeFactory.createWithDomain(
|
|
87
|
-
{ type: EmployeeType.TEMPORARY },
|
|
88
|
-
domain,
|
|
89
|
-
tx
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
// Then
|
|
93
|
-
expect(fulltime.type).toBe(EmployeeType.FULLTIME)
|
|
94
|
-
expect(parttime.type).toBe(EmployeeType.PARTTIME)
|
|
95
|
-
expect(temporary.type).toBe(EmployeeType.TEMPORARY)
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
describe('Employee-User 연결', () => {
|
|
101
|
-
it('Employee와 User가 연결될 수 있어야 한다', async () => {
|
|
102
|
-
await withTestTransaction(async (context) => {
|
|
103
|
-
const { tx, domain, user } = context.state
|
|
104
|
-
|
|
105
|
-
// When
|
|
106
|
-
const employee = await employeeFactory.createWithUser({}, user, domain, tx)
|
|
107
|
-
|
|
108
|
-
// Then
|
|
109
|
-
expect(employee.user?.id).toBe(user.id)
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('User 없이도 Employee 생성이 가능해야 한다', async () => {
|
|
114
|
-
await withTestTransaction(async (context) => {
|
|
115
|
-
const { tx, domain } = context.state
|
|
116
|
-
|
|
117
|
-
// When
|
|
118
|
-
const employee = await employeeFactory.createWithDomain({}, domain, tx)
|
|
119
|
-
|
|
120
|
-
// Then
|
|
121
|
-
expect(employee).toBeDefined()
|
|
122
|
-
expect(employee.user).toBeUndefined()
|
|
123
|
-
})
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
describe('Employee-Department 관계', () => {
|
|
128
|
-
it('Employee가 Department에 속할 수 있어야 한다', async () => {
|
|
129
|
-
await withTestTransaction(async (context) => {
|
|
130
|
-
const { tx, domain } = context.state
|
|
131
|
-
|
|
132
|
-
// Given
|
|
133
|
-
const department = await departmentFactory.createWithDomain(
|
|
134
|
-
{ name: 'Engineering' },
|
|
135
|
-
domain,
|
|
136
|
-
tx
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
// When
|
|
140
|
-
const employee = await employeeFactory.createWithDepartment({}, department, tx)
|
|
141
|
-
|
|
142
|
-
// Then
|
|
143
|
-
expect(employee.department?.id).toBe(department.id)
|
|
144
|
-
})
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
describe('Supervisor 관계', () => {
|
|
149
|
-
it('Employee에게 Supervisor를 설정할 수 있어야 한다', async () => {
|
|
150
|
-
await withTestTransaction(async (context) => {
|
|
151
|
-
const { tx, domain } = context.state
|
|
152
|
-
|
|
153
|
-
// Given
|
|
154
|
-
const supervisor = await employeeFactory.createManager({}, domain, tx)
|
|
155
|
-
|
|
156
|
-
// When
|
|
157
|
-
const employee = await employeeFactory.createWithSupervisor({}, supervisor, tx)
|
|
158
|
-
|
|
159
|
-
// Then
|
|
160
|
-
expect(employee.supervisor?.id).toBe(supervisor.id)
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
it('조직 구조가 올바르게 생성되어야 한다', async () => {
|
|
165
|
-
await withTestTransaction(async (context) => {
|
|
166
|
-
const { tx, domain } = context.state
|
|
167
|
-
|
|
168
|
-
// When
|
|
169
|
-
const { manager, employees, department } = await employeeFactory.createOrganizationStructure(
|
|
170
|
-
domain,
|
|
171
|
-
tx
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
// Then
|
|
175
|
-
expect(manager).toBeDefined()
|
|
176
|
-
expect(manager.jobPosition).toBe('Manager')
|
|
177
|
-
expect(employees.length).toBe(3)
|
|
178
|
-
employees.forEach(emp => {
|
|
179
|
-
expect(emp.supervisor?.id).toBe(manager.id)
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
describe('Employee 속성', () => {
|
|
186
|
-
it('입사일/퇴사일이 설정될 수 있어야 한다', async () => {
|
|
187
|
-
await withTestTransaction(async (context) => {
|
|
188
|
-
const { tx, domain } = context.state
|
|
189
|
-
|
|
190
|
-
// Given
|
|
191
|
-
const hiredOn = '2020-01-15'
|
|
192
|
-
const retiredOn = '2024-12-31'
|
|
193
|
-
|
|
194
|
-
// When
|
|
195
|
-
const employee = await employeeFactory.createWithDomain(
|
|
196
|
-
{ hiredOn, retiredOn },
|
|
197
|
-
domain,
|
|
198
|
-
tx
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
// Then
|
|
202
|
-
expect(employee.hiredOn).toEqual(hiredOn)
|
|
203
|
-
expect(employee.retiredOn).toEqual(retiredOn)
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
it('비상연락처 정보가 저장되어야 한다', async () => {
|
|
208
|
-
await withTestTransaction(async (context) => {
|
|
209
|
-
const { tx, domain } = context.state
|
|
210
|
-
|
|
211
|
-
// When
|
|
212
|
-
const employee = await employeeFactory.createWithDomain(
|
|
213
|
-
{
|
|
214
|
-
emergencyContact: 'Jane Doe',
|
|
215
|
-
emergencyContactPhone: '010-1234-5678'
|
|
216
|
-
},
|
|
217
|
-
domain,
|
|
218
|
-
tx
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
// Then
|
|
222
|
-
expect(employee.emergencyContact).toBe('Jane Doe')
|
|
223
|
-
expect(employee.emergencyContactPhone).toBe('010-1234-5678')
|
|
224
|
-
})
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
it('급여 계좌 정보가 저장되어야 한다', async () => {
|
|
228
|
-
await withTestTransaction(async (context) => {
|
|
229
|
-
const { tx, domain } = context.state
|
|
230
|
-
|
|
231
|
-
// When
|
|
232
|
-
const employee = await employeeFactory.createWithDomain(
|
|
233
|
-
{
|
|
234
|
-
bankName: 'KB Bank',
|
|
235
|
-
bankAccount: '123-456-789012'
|
|
236
|
-
},
|
|
237
|
-
domain,
|
|
238
|
-
tx
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
// Then
|
|
242
|
-
expect(employee.bankName).toBe('KB Bank')
|
|
243
|
-
expect(employee.bankAccount).toBe('123-456-789012')
|
|
244
|
-
})
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
it('active 상태가 관리되어야 한다', async () => {
|
|
248
|
-
await withTestTransaction(async (context) => {
|
|
249
|
-
const { tx, domain } = context.state
|
|
250
|
-
|
|
251
|
-
// When: active=true
|
|
252
|
-
const activeEmployee = await employeeFactory.createWithDomain(
|
|
253
|
-
{ active: true },
|
|
254
|
-
domain,
|
|
255
|
-
tx
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
// When: active=false (퇴사자)
|
|
259
|
-
const inactiveEmployee = await employeeFactory.createWithDomain(
|
|
260
|
-
{ active: false },
|
|
261
|
-
domain,
|
|
262
|
-
tx
|
|
263
|
-
)
|
|
264
|
-
|
|
265
|
-
// Then
|
|
266
|
-
expect(activeEmployee.active).toBe(true)
|
|
267
|
-
expect(inactiveEmployee.active).toBe(false)
|
|
268
|
-
})
|
|
269
|
-
})
|
|
270
|
-
})
|
|
271
|
-
})
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ★ **「이 사용자의 사원 기록」 판정** — 한 자리에서 답하는지, 그리고 답할 수 없을 때 말하는지.
|
|
3
|
-
*
|
|
4
|
-
* ── 왜 생겼나 (2026-09-03, UX 레인이 겪음) ──────────────────────────────────
|
|
5
|
-
* 사원 기록이 없는 계정이 「내 결재선」에 이름과 설명을 다 입력하고 저장을 눌렀다. 그때 실패했다.
|
|
6
|
-
* 그 화면은 사원이어야 쓸 수 있는데 그 사실을 미리 말하지 않았고, 빈 목록에는 「해당하는 것이
|
|
7
|
-
* 없습니다」가 떴다 — 없는 것이 아니라 **가질 수 없는** 것이었다.
|
|
8
|
-
*
|
|
9
|
-
* 원인은 같은 물음을 네 자리가 각자 다루던 것이다. 그래서 판정을 한 자리에 두고, 이 시험이 그
|
|
10
|
-
* 자리를 지킨다.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
* **판정만 가져온다.** 배선(`my-employee.ts`)은 `Employee` 엔티티를 가져오고, 그것이
|
|
15
|
-
* `@things-factory/contact` 를 딸려 와 import 시점에 설정을 읽는다 — 시험이 서지 않는다.
|
|
16
|
-
* 실제로 그렇게 터졌고, 그래서 판정을 갈라 뒀다.
|
|
17
|
-
*/
|
|
18
|
-
import {
|
|
19
|
-
ambiguousEmployeeRejection,
|
|
20
|
-
noEmployeeRejection,
|
|
21
|
-
theOneEmployee
|
|
22
|
-
} from '../../server/service/employee/my-employee-refusal'
|
|
23
|
-
|
|
24
|
-
describe('내 사원 기록 판정', () => {
|
|
25
|
-
describe('거절 문장', () => {
|
|
26
|
-
it('★ 개발자의 말로 답하지 않는다 — 이 문장은 사용자 얼굴까지 간다', () => {
|
|
27
|
-
const error = noEmployeeRejection(undefined)
|
|
28
|
-
|
|
29
|
-
expect(error.message).not.toContain('employee object')
|
|
30
|
-
/* 「누가 붙여 줄 수 있는가」가 문장에 있어야 사용자가 다음 할 일을 안다. */
|
|
31
|
-
expect(error.message).toContain('administrator')
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('★ 화면이 문장을 파싱하지 않고 가를 수 있다 — 번역하면 문장이 바뀐다', () => {
|
|
35
|
-
expect(noEmployeeRejection(undefined).extensions).toMatchObject({
|
|
36
|
-
code: 'FORBIDDEN',
|
|
37
|
-
requires: 'no-employee'
|
|
38
|
-
})
|
|
39
|
-
expect(ambiguousEmployeeRejection(undefined, 2).extensions).toMatchObject({
|
|
40
|
-
code: 'FORBIDDEN',
|
|
41
|
-
requires: 'ambiguous-employee',
|
|
42
|
-
count: 2
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('★ 두 거절이 서로 다른 코드다 — 고칠 것이 다르다', () => {
|
|
47
|
-
/* 없는 것은 붙이면 되고, 여럿인 것은 하나만 남겨야 한다. */
|
|
48
|
-
expect(noEmployeeRejection(undefined).extensions.requires).not.toBe(
|
|
49
|
-
ambiguousEmployeeRejection(undefined, 2).extensions.requires
|
|
50
|
-
)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('요청의 언어로 옮긴다 — 번역기가 있으면 그것을 쓴다', () => {
|
|
54
|
-
const context = { t: (key: string) => (key === 'error.no-employee-for-user' ? '연결된 직원 정보가 없습니다' : key) }
|
|
55
|
-
|
|
56
|
-
expect(noEmployeeRejection(context).message).toBe('연결된 직원 정보가 없습니다')
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
it('★ 번역기가 키를 그대로 돌려주면 영어 문장으로 되돌린다', () => {
|
|
60
|
-
/* i18next 는 키를 못 찾으면 키를 돌려준다. 그걸 쓰면 사용자가 키를 읽는다. */
|
|
61
|
-
const context = { t: (key: string) => key }
|
|
62
|
-
|
|
63
|
-
expect(noEmployeeRejection(context).message).not.toBe('error.no-employee-for-user')
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('번역기가 던져도 거절은 그대로 전달된다', () => {
|
|
67
|
-
const context = {
|
|
68
|
-
t: () => {
|
|
69
|
-
throw new Error('번역기가 터졌다')
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
expect(() => noEmployeeRejection(context)).not.toThrow()
|
|
74
|
-
expect(noEmployeeRejection(context).extensions.requires).toBe('no-employee')
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
describe('하나를 골라야 할 때', () => {
|
|
79
|
-
it('★ 하나면 그것을 답한다', () => {
|
|
80
|
-
expect(theOneEmployee([{ id: 'e1' }], undefined)).toEqual({ id: 'e1' })
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
it('★ 없으면 거절한다 — 소유자가 틀린 행을 남기지 않게', () => {
|
|
84
|
-
expect(() => theOneEmployee([], undefined)).toThrow(
|
|
85
|
-
expect.objectContaining({ extensions: expect.objectContaining({ requires: 'no-employee' }) })
|
|
86
|
-
)
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('★ 여럿이면 아무 것이나 집지 않고 거절한다 — 표가 여럿을 막지 않는다', () => {
|
|
90
|
-
/*
|
|
91
|
-
* 유일 제약은 `(domain, controlNo, deletedAt)` 이고 `(domain, user)` 에는 없다. 예전 코드는
|
|
92
|
-
* `findOneBy` 로 읽어 **드라이버가 먼저 준 하나**를 집었고, 그 사람의 개인 결재선이 엉뚱한
|
|
93
|
-
* 사원 기록에 붙었다. 오류는 안 났다.
|
|
94
|
-
*/
|
|
95
|
-
expect(() => theOneEmployee([{ id: 'e1' }, { id: 'e2' }], undefined)).toThrow(
|
|
96
|
-
expect.objectContaining({
|
|
97
|
-
extensions: expect.objectContaining({ requires: 'ambiguous-employee', count: 2 })
|
|
98
|
-
})
|
|
99
|
-
)
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* approval-line-brief draws a request on its way: whose turn it is and what is behind it. Left
|
|
6
|
-
* without `current` it marks the submitter's turn, which the instance ribbon relies on for a draft.
|
|
7
|
-
*
|
|
8
|
-
* The activity catalog draws a form's line as it is set, with nobody's turn in it (2026-10-18). `plan`
|
|
9
|
-
* is that mode: no seat is current, none is past, and every seat reads at ink colour. A copy of this
|
|
10
|
-
* component in worklist would have been the third drawing of a line; a mode on the one drawing is not.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const source = readFileSync(path.join(__dirname, '../client/component/approval-line-brief.ts'), 'utf-8')
|
|
14
|
-
|
|
15
|
-
describe('approval-line-brief in plan mode', () => {
|
|
16
|
-
it('declares plan as a reflected boolean, so the style can see it', () => {
|
|
17
|
-
expect(source).toMatch(/@property\(\{ type: Boolean, reflect: true \}\) plan: boolean = false/)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('marks no seat current or past - the submitter included', () => {
|
|
21
|
-
const marks = source.match(/\?(current|past)=\$\{[^}]*\}/g) || []
|
|
22
|
-
|
|
23
|
-
expect(marks).toHaveLength(4)
|
|
24
|
-
expect(marks.filter(mark => !mark.includes('!this.plan &&'))).toEqual([])
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('keeps the old reading when plan is not set: no current means the submitter\'s turn', () => {
|
|
28
|
-
expect(source).toMatch(/\?current=\$\{!this\.plan && this\.current <= 0\}/)
|
|
29
|
-
expect(source).toMatch(/@property\(\{ type: Number \}\) current: number = -1/)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('draws every seat at ink colour in plan mode', () => {
|
|
33
|
-
expect(source).toMatch(/:host\(\[plan\]\) li \{\s*color: var\(--ui-ink/)
|
|
34
|
-
})
|
|
35
|
-
})
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
lineAfterCopy,
|
|
3
|
-
lineFromRows,
|
|
4
|
-
participationChoice,
|
|
5
|
-
PARTICIPATION_CHOICES
|
|
6
|
-
} from '../client/component/approval-line-edit'
|
|
7
|
-
|
|
8
|
-
const ROLE = { id: 'role-1', name: '대표' }
|
|
9
|
-
const PERSON = { id: 'employee-1', name: '홍길동' }
|
|
10
|
-
|
|
11
|
-
describe('the line the editor hands on is read off the rows on screen', () => {
|
|
12
|
-
it('keeps type, approver, participation and notifyAfter, in row order', () => {
|
|
13
|
-
expect(
|
|
14
|
-
lineFromRows([
|
|
15
|
-
{ type: 'Role', approver: ROLE, participation: '' },
|
|
16
|
-
{ type: 'Employee', approver: PERSON, participation: 'reference', notifyAfter: '2' }
|
|
17
|
-
])
|
|
18
|
-
).toEqual([
|
|
19
|
-
{ type: 'Role', approver: ROLE, participation: undefined, notifyAfter: undefined },
|
|
20
|
-
{ type: 'Employee', approver: PERSON, participation: 'reference', notifyAfter: 2 }
|
|
21
|
-
])
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('drops a row with no type - an added row nobody filled', () => {
|
|
25
|
-
expect(lineFromRows([{ type: 'Role', approver: ROLE }, { approver: PERSON }, {}])).toHaveLength(1)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('reads the API spelling of a reference', () => {
|
|
29
|
-
expect(lineFromRows([{ type: 'Role', approver: ROLE, participation: 'Reference' }])[0].participation).toBe('reference')
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('no rows: an empty line', () => {
|
|
33
|
-
expect(lineFromRows(undefined)).toEqual([])
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
describe('copying a saved line', () => {
|
|
38
|
-
const current = [{ type: 'Role', approver: ROLE }] as any
|
|
39
|
-
|
|
40
|
-
it('nothing picked: the line being edited stays as it is', () => {
|
|
41
|
-
expect(lineAfterCopy(current, undefined)).toBe(current)
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('emptied on purpose: an empty line', () => {
|
|
45
|
-
expect(lineAfterCopy(current, null)).toEqual([])
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('a picked line comes over with its reference steps and their notify point', () => {
|
|
49
|
-
const picked = {
|
|
50
|
-
model: [
|
|
51
|
-
{ type: 'Role', approver: ROLE },
|
|
52
|
-
{ type: 'Employee', approver: PERSON, participation: 'Reference', notifyAfter: 1 }
|
|
53
|
-
]
|
|
54
|
-
} as any
|
|
55
|
-
|
|
56
|
-
expect(lineAfterCopy(current, picked)).toEqual([
|
|
57
|
-
{ type: 'Role', approver: ROLE, participation: undefined, notifyAfter: undefined },
|
|
58
|
-
{ type: 'Employee', approver: PERSON, participation: 'reference', notifyAfter: 1 }
|
|
59
|
-
])
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
describe('the participation cell names approval too', () => {
|
|
64
|
-
it('a step with nothing stored reads as approval', () => {
|
|
65
|
-
expect(participationChoice({}).key).toBe('label.participation-approval')
|
|
66
|
-
expect(participationChoice({ participation: undefined }).key).toBe('label.participation-approval')
|
|
67
|
-
expect(participationChoice({ participation: null }).key).toBe('label.participation-approval')
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('a reference reads as reference, in either spelling', () => {
|
|
71
|
-
expect(participationChoice({ participation: 'reference' }).key).toBe('label.participation-reference')
|
|
72
|
-
expect(participationChoice({ participation: 'Reference' }).key).toBe('label.participation-reference')
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('every choice the cell can draw is a choice the select offers', () => {
|
|
76
|
-
expect(PARTICIPATION_CHOICES.map(one => one.value)).toEqual(['', 'reference'])
|
|
77
|
-
})
|
|
78
|
-
})
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
import { approvalLineMark } from '../client/types/approval-line'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 「이 업무에 결재자가 있나」를 화면 셋이 각각 셌다. 업무정의 리스트의 사람 표만 결재선이 비었는지로
|
|
8
|
-
* 답해서, 참조만 있는 줄도 사람 아이콘을 얻었다 — BatchRelease 가 그랬다.
|
|
9
|
-
*
|
|
10
|
-
* 참조는 의견을 낼 뿐 판정하지 않는다. 참조만 있는 결재선으로 규제를 걸면 건은 올라가고 아무도 못
|
|
11
|
-
* 내린다.
|
|
12
|
-
*
|
|
13
|
-
* 이 고침이 가르는 축을 먼저 적는다:
|
|
14
|
-
* ① 줄이 없다 → none
|
|
15
|
-
* ② 줄은 있고 결재 0 → reference-only ← 전에는 person/group 이 나오던 자리
|
|
16
|
-
* ③ 결재 1 → one
|
|
17
|
-
* ④ 결재 2 이상 → many
|
|
18
|
-
* ⑤ 빈 participation → 결재다 (옛 행)
|
|
19
|
-
* ⑥ 렌더러가 길이가 아니라 이 답으로 그린다
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const approval = { participation: undefined }
|
|
23
|
-
const reference = { participation: 'reference' }
|
|
24
|
-
|
|
25
|
-
describe('approval line mark', () => {
|
|
26
|
-
it('★ 줄이 없으면 아무것도 아니다', () => {
|
|
27
|
-
expect(approvalLineMark(undefined)).toEqual('none')
|
|
28
|
-
expect(approvalLineMark(null)).toEqual('none')
|
|
29
|
-
expect(approvalLineMark([])).toEqual('none')
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('★ 참조만 있는 줄은 결재자가 있는 것으로 세지 않는다', () => {
|
|
33
|
-
expect(approvalLineMark([reference])).toEqual('reference-only')
|
|
34
|
-
expect(approvalLineMark([reference, reference])).toEqual('reference-only')
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('★ 참조만 있는 것과 줄이 아예 없는 것을 가른다', () => {
|
|
38
|
-
/* 고칠 사람이 할 일이 다르다 — 하나는 줄을 만들고, 하나는 그 줄에 결재자를 더한다. */
|
|
39
|
-
expect(approvalLineMark([reference])).not.toEqual(approvalLineMark([]))
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('★ 결재 단계를 센다. 줄의 길이가 아니다', () => {
|
|
43
|
-
expect(approvalLineMark([approval])).toEqual('one')
|
|
44
|
-
expect(approvalLineMark([approval, reference])).toEqual('one')
|
|
45
|
-
expect(approvalLineMark([reference, approval, reference])).toEqual('one')
|
|
46
|
-
expect(approvalLineMark([approval, approval])).toEqual('many')
|
|
47
|
-
expect(approvalLineMark([reference, approval, approval])).toEqual('many')
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('빈 participation 은 결재다 — 그 칸이 생기기 전에 쌓인 줄이 있다', () => {
|
|
51
|
-
expect(approvalLineMark([{}])).toEqual('one')
|
|
52
|
-
expect(approvalLineMark([{ participation: null }])).toEqual('one')
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('★ 격자 칸이 줄의 길이로 가르지 않는다', () => {
|
|
56
|
-
/*
|
|
57
|
-
* 전에는 `value.length == 1` 로 person 을, 그보다 많으면 group 을 그렸다. 그 셈은 참조를
|
|
58
|
-
* 결재자로 읽는다. 이 줄이 없으면 렌더러가 다시 자기 셈을 쓴다.
|
|
59
|
-
*/
|
|
60
|
-
const source = readFileSync(
|
|
61
|
-
path.resolve(__dirname, '..', 'client', 'grist-editor', 'grist-renderer-approval-line.ts'),
|
|
62
|
-
'utf-8'
|
|
63
|
-
).replace(/\/\*[\s\S]*?\*\//g, '')
|
|
64
|
-
|
|
65
|
-
expect(/approvalLineMark\(/.test(source)).toEqual(true)
|
|
66
|
-
expect(/value\.length/.test(source)).toEqual(false)
|
|
67
|
-
})
|
|
68
|
-
})
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { readdirSync, readFileSync, statSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Every screen that reads an approval line step asks for every field the step carries.
|
|
6
|
-
*
|
|
7
|
-
* The approval line editor keeps `type`, `approver`, `participation` and `notifyAfter` of a step
|
|
8
|
-
* (approval-line-edit's lineFromRows; `value` is left to `approver` on purpose). Screens asked for
|
|
9
|
-
* some of them. A screen that reopens a line and saves it again
|
|
10
|
-
* writes back only what it read, so a missing `participation` turns a reference step into an
|
|
11
|
-
* approver and a missing `notifyAfter` wipes the notify point - with no error. Found so far: the
|
|
12
|
-
* worklist screens (notifyAfter, twelve selections), the copy-from selector and the two template
|
|
13
|
-
* pages here (both), and meta-ui's activity definition (both).
|
|
14
|
-
*
|
|
15
|
-
* A gql`` document is a template literal, so type checking cannot see a missing field. This reads the
|
|
16
|
-
* documents of every package's client: any `approvalLine { }` or `model { }` selection that asks for
|
|
17
|
-
* `approver` is a step selection.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const packagesDir = path.resolve(__dirname, '../..')
|
|
21
|
-
|
|
22
|
-
function sources(dir: string): string[] {
|
|
23
|
-
return readdirSync(dir).flatMap(name => {
|
|
24
|
-
if (name === 'node_modules' || name.startsWith('dist')) {
|
|
25
|
-
return []
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const file = path.join(dir, name)
|
|
29
|
-
|
|
30
|
-
if (statSync(file).isDirectory()) {
|
|
31
|
-
return sources(file)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return file.endsWith('.ts') ? [file] : []
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** The top-level field names of each `approvalLine { }` / `model { }` selection in a source. */
|
|
39
|
-
function selections(source: string): string[][] {
|
|
40
|
-
const found: string[][] = []
|
|
41
|
-
|
|
42
|
-
for (const match of source.matchAll(/\b(?:approvalLine|model)\s*\{/g)) {
|
|
43
|
-
const fields: string[] = []
|
|
44
|
-
let depth = 0
|
|
45
|
-
let word = ''
|
|
46
|
-
|
|
47
|
-
const take = () => {
|
|
48
|
-
if (depth === 1 && word) fields.push(word)
|
|
49
|
-
word = ''
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
for (let at = match.index! + match[0].length - 1; at < source.length; at++) {
|
|
53
|
-
const char = source[at]
|
|
54
|
-
|
|
55
|
-
if (char === '{') {
|
|
56
|
-
take()
|
|
57
|
-
depth++
|
|
58
|
-
} else if (char === '}') {
|
|
59
|
-
take()
|
|
60
|
-
if (!--depth) break
|
|
61
|
-
} else if (/\w/.test(char)) {
|
|
62
|
-
word += char
|
|
63
|
-
} else {
|
|
64
|
-
take()
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
found.push(fields)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return found
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** What the editor keeps of a step - read less and the next save loses the rest. */
|
|
75
|
-
const STEP_FIELDS = ['type', 'participation', 'notifyAfter', 'approver']
|
|
76
|
-
|
|
77
|
-
const clients = readdirSync(packagesDir)
|
|
78
|
-
.map(name => path.join(packagesDir, name, 'client'))
|
|
79
|
-
.filter(dir => statSync(path.dirname(dir)).isDirectory() && readdirSync(path.dirname(dir)).includes('client'))
|
|
80
|
-
|
|
81
|
-
const screens = clients
|
|
82
|
-
.flatMap(sources)
|
|
83
|
-
.map(file => ({
|
|
84
|
-
file: path.relative(packagesDir, file),
|
|
85
|
-
steps: selections(readFileSync(file, 'utf-8')).filter(fields => fields.includes('approver'))
|
|
86
|
-
}))
|
|
87
|
-
.filter(one => one.steps.length)
|
|
88
|
-
|
|
89
|
-
describe('every screen that reads an approval line step asks for all of its fields', () => {
|
|
90
|
-
it('the scan finds the screens', () => {
|
|
91
|
-
expect(screens.map(one => one.file)).toEqual(
|
|
92
|
-
expect.arrayContaining([
|
|
93
|
-
'organization/client/component/approval-line-selector.ts',
|
|
94
|
-
'organization/client/pages/approval-line/my-approval-line-templates-page.ts',
|
|
95
|
-
'worklist/client/pages/activity-catalog/activity-detail-page.ts'
|
|
96
|
-
])
|
|
97
|
-
)
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it.each(screens.map(one => [one.file, one.steps] as [string, string[][]]))('%s', (file, steps) => {
|
|
101
|
-
for (const fields of steps) {
|
|
102
|
-
expect({ asks: fields, missing: STEP_FIELDS.filter(field => !fields.includes(field)) }).toEqual({
|
|
103
|
-
asks: fields,
|
|
104
|
-
missing: []
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
})
|