@things-factory/organization 10.1.277 → 10.1.279
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/dist-server/service/employee-profile/index.d.ts +1 -1
- package/dist-server/service/index.d.ts +2 -2
- 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,282 +0,0 @@
|
|
|
1
|
-
import { Workbook } from 'exceljs'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
COLUMN_WIDTHS,
|
|
5
|
-
ROSTER_WIDTHS,
|
|
6
|
-
careerLengthOf,
|
|
7
|
-
careerMonths,
|
|
8
|
-
heightOf,
|
|
9
|
-
rosterTaglineOf,
|
|
10
|
-
taglineOf,
|
|
11
|
-
dotted,
|
|
12
|
-
layoutHtml,
|
|
13
|
-
periodOf,
|
|
14
|
-
profileFileName,
|
|
15
|
-
profileFooterHtml,
|
|
16
|
-
profileHtml,
|
|
17
|
-
profilePreviewHtml,
|
|
18
|
-
profileSheetLayout,
|
|
19
|
-
profileWorkbook,
|
|
20
|
-
profileWordsOf,
|
|
21
|
-
lead,
|
|
22
|
-
rosterLayout,
|
|
23
|
-
sheetNamesOf,
|
|
24
|
-
type ProfileSheetWords
|
|
25
|
-
} from '../server/service/employee-profile/employee-profile-document'
|
|
26
|
-
import { inShowingOrder, newestFirst } from '../server/service/employee-profile/employee-profile-rules'
|
|
27
|
-
|
|
28
|
-
/** The profiles a quotation attaches - one layout, painted as Excel and as HTML for PDF (ADR-0169 decision 5). */
|
|
29
|
-
const COUNTS: Record<string, (...args: number[]) => string> = {
|
|
30
|
-
years: (years, months) => `${years}y${months}m`,
|
|
31
|
-
projectCount: n => `${n}p`,
|
|
32
|
-
certificateCount: n => `${n}c`,
|
|
33
|
-
peopleCount: n => `${n}people`
|
|
34
|
-
}
|
|
35
|
-
const WORDS = new Proxy({} as any, { get: (_target, key) => COUNTS[String(key)] ?? `<${String(key)}>` }) as ProfileSheetWords
|
|
36
|
-
|
|
37
|
-
const TODAY = new Date('2026-10-28T00:00:00Z')
|
|
38
|
-
|
|
39
|
-
const KIM = {
|
|
40
|
-
name: '김하늘',
|
|
41
|
-
departmentName: '개발팀',
|
|
42
|
-
jobPosition: '과장',
|
|
43
|
-
jobResponsibility: '팀장',
|
|
44
|
-
hiredOn: '2020-03-02',
|
|
45
|
-
profile: {
|
|
46
|
-
summary: 'MES 10년',
|
|
47
|
-
skills: ['TypeScript', 'PostgreSQL'],
|
|
48
|
-
educations: [{ school: '서울대', major: '컴퓨터공학', degree: '학사', startedOn: '2005-03', endedOn: '2009-02' }],
|
|
49
|
-
certificates: [{ name: '정보처리기사', issuer: '한국산업인력공단', acquiredOn: '2010-05-01' }],
|
|
50
|
-
careers: [{ company: 'A사', department: '연구소', position: '대리', startedOn: '2009-03', endedOn: '2019-12', duties: 'ERP' }],
|
|
51
|
-
projects: [{ name: '미라텍 MES', client: '미라텍', startedOn: '2024-01', role: 'PM', duties: '설계', technologies: 'Node' }]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const valuesOf = (line: { cells: { value: string }[] }) => line.cells.map(cell => cell.value)
|
|
56
|
-
|
|
57
|
-
describe('one layout of a staffing profile', () => {
|
|
58
|
-
const cellsOf = (lines: ReturnType<typeof profileSheetLayout>, role: string) => lines.flatMap(line => line.cells.filter(cell => cell.role === role).map(cell => cell.value))
|
|
59
|
-
|
|
60
|
-
it('★ the name large with where the person stands, then the figures a buyer weighs', () => {
|
|
61
|
-
const lines = profileSheetLayout(KIM, WORDS, '(주)하티오랩', TODAY)
|
|
62
|
-
expect(valuesOf(lines[0])).toEqual(['(주)하티오랩', '<title>'])
|
|
63
|
-
expect(lines[1].cells).toEqual([{ col: 1, span: 6, value: '김하늘', role: 'name' }])
|
|
64
|
-
expect(valuesOf(lines[2])).toEqual(['개발팀 · 과장 / 팀장 · <hiredOn> 2020.03.02'])
|
|
65
|
-
expect(lines[3].cells[0].role).toBe('rule')
|
|
66
|
-
expect(cellsOf(lines, 'statLabel')).toEqual(['<careerLength>', '<projectsDone>', '<certificatesHeld>'])
|
|
67
|
-
expect(cellsOf(lines, 'statValue')).toEqual([careerLengthOf(KIM, WORDS, TODAY), '1p', '1c'])
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('★ the expertise, then the projects first - careers, certificates and education after; no line to sign', () => {
|
|
71
|
-
const lines = profileSheetLayout(KIM, WORDS, '(주)하티오랩', TODAY)
|
|
72
|
-
expect(cellsOf(lines, 'section')).toEqual(['<expertise>', '<projects>', '<careers>', '<certificates>', '<educations>'])
|
|
73
|
-
expect(cellsOf(lines, 'summary')).toEqual(['MES 10년'])
|
|
74
|
-
expect(cellsOf(lines, 'skills')).toEqual(['TypeScript, PostgreSQL'])
|
|
75
|
-
const rowAfter = (section: string) => valuesOf(lines[lines.findIndex(line => line.cells[0]?.value === section && line.cells[0].role === 'section') + 3])
|
|
76
|
-
expect(rowAfter('<projects>')).toEqual(['2024.01 ~ <ongoing>', '미라텍 MES', '미라텍', 'PM', '설계', 'Node'])
|
|
77
|
-
expect(rowAfter('<careers>')).toEqual(['2009.03 ~ 2019.12', 'A사', '연구소', '대리', 'ERP'])
|
|
78
|
-
expect(rowAfter('<certificates>')).toEqual(['2010.05.01', '정보처리기사', '한국산업인력공단'])
|
|
79
|
-
expect(rowAfter('<educations>')).toEqual(['2005.03 ~ 2009.02', '서울대', '컴퓨터공학', '학사'])
|
|
80
|
-
expect(JSON.stringify(lines)).not.toMatch(/affirmation|signature/)
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
it('every other row of a table is shaded', () => {
|
|
84
|
-
const two = { ...KIM, profile: { ...KIM.profile, projects: [KIM.profile.projects[0], KIM.profile.projects[0], KIM.profile.projects[0]] } }
|
|
85
|
-
const lines = profileSheetLayout(two, WORDS, '', TODAY)
|
|
86
|
-
const rows = lines.filter(line => line.cells[0]?.role === 'value' && line.cells.length === 6)
|
|
87
|
-
expect(rows.map(line => !!line.zebra)).toEqual([false, true, false])
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('a person with nothing written: dashes for the figures, no summary box, every table says so', () => {
|
|
91
|
-
const lines = profileSheetLayout({ name: '박지민', profile: null }, WORDS, '', TODAY)
|
|
92
|
-
expect(cellsOf(lines, 'statValue')).toEqual(['—', '—', '—'])
|
|
93
|
-
expect(cellsOf(lines, 'summary')).toEqual([])
|
|
94
|
-
expect(cellsOf(lines, 'none')).toEqual(['<none>', '<none>', '<none>', '<none>'])
|
|
95
|
-
expect(taglineOf({ name: '박지민' }, WORDS)).toBe('')
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('★ the career counts the months worked once - earlier jobs and the time here, overlaps not twice', () => {
|
|
99
|
-
expect(careerMonths({ hiredOn: '2026-01-15' }, TODAY)).toBe(10)
|
|
100
|
-
expect(careerMonths({ hiredOn: '2025-10-01', profile: { careers: [{ startedOn: '2025-01', endedOn: '2025-12' }] } }, TODAY)).toBe(22)
|
|
101
|
-
expect(careerMonths({ profile: { careers: [{ startedOn: '2024-01' }] } }, TODAY)).toBe(34)
|
|
102
|
-
expect(careerMonths({ profile: { careers: [{ endedOn: '2020-01' }] } }, TODAY)).toBe(0)
|
|
103
|
-
expect(careerLengthOf(KIM, WORDS, TODAY)).toBe(`${Math.floor(careerMonths(KIM, TODAY) / 12)}y${careerMonths(KIM, TODAY) % 12}m`)
|
|
104
|
-
expect(careerLengthOf({}, WORDS, TODAY)).toBe('')
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
it('periods and days in the dotted form, an open end still going on', () => {
|
|
108
|
-
expect(dotted('2023-03')).toBe('2023.03')
|
|
109
|
-
expect(periodOf('2024-01', '', 'now')).toBe('2024.01 ~ now')
|
|
110
|
-
expect(periodOf('', '2024-01', 'now')).toBe('~ 2024.01')
|
|
111
|
-
expect(periodOf(undefined, undefined, 'now')).toBe('')
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
it('★ newest first, as a résumé reads: by the end, one still going on top, then by the start; undated rows last', () => {
|
|
115
|
-
const careers = [
|
|
116
|
-
{ company: 'A', startedOn: '2010-03', endedOn: '2014-02' },
|
|
117
|
-
{ company: 'undated' },
|
|
118
|
-
{ company: 'B', startedOn: '2014-03', endedOn: '2019-12' },
|
|
119
|
-
{ company: 'now', startedOn: '2020-01' },
|
|
120
|
-
{ company: 'C', startedOn: '2016-01', endedOn: '2019-12' }
|
|
121
|
-
]
|
|
122
|
-
expect(newestFirst(careers).map(row => row.company)).toEqual(['now', 'C', 'B', 'A', 'undated'])
|
|
123
|
-
expect(careers[0].company).toBe('A')
|
|
124
|
-
expect(newestFirst([{ name: 'old', acquiredOn: '2015-05-01' }, { name: 'new', acquiredOn: '2023-01-10' }]).map(row => row.name)).toEqual(['new', 'old'])
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('★ a profile is shown in that order wherever it is read - put in it as it is loaded, the stored order untouched', () => {
|
|
128
|
-
const profile = inShowingOrder({ careers: [{ company: 'old', startedOn: '2001-01', endedOn: '2005-01' }, { company: 'now', startedOn: '2010-01' }], projects: null as any, skills: ['b', 'a'] } as any)
|
|
129
|
-
expect(profile.careers.map((row: any) => row.company)).toEqual(['now', 'old'])
|
|
130
|
-
expect(profile.projects).toBeNull()
|
|
131
|
-
expect(profile.skills).toEqual(['b', 'a'])
|
|
132
|
-
const entity = require('fs').readFileSync(require('path').join(__dirname, '../server/service/employee-profile/employee-profile.ts'), 'utf8')
|
|
133
|
-
expect(entity).toMatch(/^ @AfterLoad\(\)\n showNewestFirst\(\) \{\n inShowingOrder\(this\)/m)
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
it('★ every dated table of the page reads newest first', () => {
|
|
137
|
-
const person = {
|
|
138
|
-
...KIM,
|
|
139
|
-
profile: {
|
|
140
|
-
projects: [{ name: 'P-old', startedOn: '2018-01', endedOn: '2018-06' }, { name: 'P-new', startedOn: '2024-01' }],
|
|
141
|
-
careers: [{ company: 'C-old', startedOn: '2010-01', endedOn: '2012-01' }, { company: 'C-new', startedOn: '2012-02', endedOn: '2015-01' }],
|
|
142
|
-
certificates: [{ name: 'T-old', acquiredOn: '2011-01-01' }, { name: 'T-new', acquiredOn: '2020-01-01' }],
|
|
143
|
-
educations: [{ school: 'E-old', startedOn: '2001-03', endedOn: '2005-02' }, { school: 'E-new', startedOn: '2005-03', endedOn: '2007-02' }]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
const text = profileSheetLayout(person as any, WORDS, 'Co', TODAY).flatMap(line => line.cells.map(cell => cell.value)).join('|')
|
|
147
|
-
for (const [newer, older] of [['P-new', 'P-old'], ['C-new', 'C-old'], ['T-new', 'T-old'], ['E-new', 'E-old']]) expect(text.indexOf(newer)).toBeLessThan(text.indexOf(older))
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
it('a roster: how many and their experience on average, then two lines a person in the order picked', () => {
|
|
151
|
-
const lines = rosterLayout([KIM, { name: '박지민', hiredOn: '2025-10-01' }], WORDS, 'C', TODAY)
|
|
152
|
-
expect(valuesOf(lines[0])).toEqual(['C', '<writtenOn> 2026.10.28'])
|
|
153
|
-
expect(valuesOf(lines[1])).toEqual(['<rosterTitle>'])
|
|
154
|
-
const average = Math.round((careerMonths(KIM, TODAY) + 13) / 2)
|
|
155
|
-
expect(valuesOf(lines[2])).toEqual([`2people · <averageCareer> ${Math.floor(average / 12)}y${average % 12}m`])
|
|
156
|
-
expect(valuesOf(lines[5])).toEqual(['<number>', '<name>', '<department>', '<jobPosition>', '<careerLength>'])
|
|
157
|
-
expect(lines.slice(6).map(line => valuesOf(line).slice(0, 2))).toEqual([['1', '김하늘'], ['TypeScript, PostgreSQL'], ['2', '박지민']])
|
|
158
|
-
/* The number runs down the person's two lines; the skills sit under the name; none written, one line. */
|
|
159
|
-
expect([lines[6].cells[0].col, lines[6].cells[0].rows]).toEqual([1, 2])
|
|
160
|
-
expect(lines[7].cells.map(cell => [cell.col, cell.span ?? 1, cell.role])).toEqual([[2, 5, 'value']])
|
|
161
|
-
expect(lines[8].cells[0].rows).toBe(1)
|
|
162
|
-
const three = rosterLayout([KIM, { name: '박지민' }, KIM], WORDS, 'C', TODAY).slice(6)
|
|
163
|
-
expect(three.map(line => [valuesOf(line)[0], line.zebra ?? false])).toEqual([['1', false], ['TypeScript, PostgreSQL', false], ['2', true], ['3', false], ['TypeScript, PostgreSQL', false]])
|
|
164
|
-
/* The roster's own widths: a narrow number; the pages keep theirs. */
|
|
165
|
-
expect(ROSTER_WIDTHS[0]).toBeLessThan(Math.min(...ROSTER_WIDTHS.slice(1)))
|
|
166
|
-
expect(ROSTER_WIDTHS.reduce((sum, one) => sum + one, 0)).toBe(COLUMN_WIDTHS.reduce((sum, one) => sum + one, 0))
|
|
167
|
-
expect(rosterTaglineOf([], WORDS, TODAY)).toBe('0people')
|
|
168
|
-
})
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
describe('painted as Excel', () => {
|
|
172
|
-
it('★ a ruled line is as tall as its longest cell wraps - Excel does not grow it for written text', () => {
|
|
173
|
-
const one = heightOf({ cells: [{ col: 1, value: '2012.03 ~ 2019.02', role: 'value' }, { col: 2, span: 5, value: '짧음', role: 'value' }] })!
|
|
174
|
-
const wrapped = heightOf({ cells: [{ col: 5, value: '요구 분석, 설계, 일정·인력 관리와 고객 보고', role: 'value' }] })!
|
|
175
|
-
expect(one).toBe(22)
|
|
176
|
-
expect(wrapped).toBeGreaterThan(one)
|
|
177
|
-
expect(heightOf({ cells: [{ col: 1, span: 6, value: 'x', role: 'name' }] })).toBeUndefined()
|
|
178
|
-
expect(heightOf({ cells: [{ col: 1, value: 'a\nb\nc', role: 'value' }] })).toBe(52)
|
|
179
|
-
expect(heightOf({ cells: [{ col: 1, span: 6, value: '짧은 소개', role: 'summary' }] })).toBe(30)
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
async function readBack(people: any[]) {
|
|
183
|
-
const buffer = await profileWorkbook(people, WORDS, '(주)하티오랩', TODAY).xlsx.writeBuffer()
|
|
184
|
-
const book = new Workbook()
|
|
185
|
-
await book.xlsx.load(buffer as any)
|
|
186
|
-
return book
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
it('★ several people open with the roster, then a sheet a person in the order picked - read back from the file', async () => {
|
|
190
|
-
const book = await readBack([KIM, { name: '박지민' }])
|
|
191
|
-
expect(book.worksheets.map(sheet => sheet.name)).toEqual(['<rosterTitle>', '김하늘', '박지민'])
|
|
192
|
-
/* The number is merged down the person's two lines, its text at the top. */
|
|
193
|
-
const roster = book.worksheets[0]
|
|
194
|
-
expect(roster.getCell('A7').isMerged && roster.getCell('A8').isMerged).toBe(true)
|
|
195
|
-
expect(roster.getCell('A8').master.address).toBe('A7')
|
|
196
|
-
expect(roster.getCell('A7').value).toBe('1')
|
|
197
|
-
expect(roster.getCell('A7').alignment?.vertical).toBe('top')
|
|
198
|
-
expect(roster.getCell('A9').isMerged).toBe(false)
|
|
199
|
-
/* The roster sheet takes its own widths - a narrow number - and a person's sheet the page's. */
|
|
200
|
-
expect(book.worksheets.map(sheet => sheet.getColumn(1).width)).toEqual([ROSTER_WIDTHS[0], COLUMN_WIDTHS[0], COLUMN_WIDTHS[0]])
|
|
201
|
-
expect((await readBack([KIM])).worksheets.map(sheet => sheet.name)).toEqual(['김하늘'])
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
it('★ the title spans the page, labels and heads are shaded and ruled, values ruled and wrapped, A4 to one page wide', async () => {
|
|
205
|
-
const sheet = (await readBack([KIM])).getWorksheet('김하늘')!
|
|
206
|
-
expect(sheet.getCell('A2').value).toBe('김하늘')
|
|
207
|
-
expect(sheet.getCell('A2').font).toMatchObject({ bold: true, size: 22, color: { argb: 'FF1F3A5F' } })
|
|
208
|
-
expect(sheet.getCell('F2').isMerged).toBe(true)
|
|
209
|
-
expect(sheet.getCell('A4').border?.bottom?.style).toBe('thick')
|
|
210
|
-
const rows = sheet.getRows(1, sheet.rowCount)!
|
|
211
|
-
const head = rows.find(row => row.getCell(1).value === '<period>')!
|
|
212
|
-
expect((head.getCell(1).fill as any)?.fgColor?.argb).toBe('FF1F3A5F')
|
|
213
|
-
expect(head.getCell(1).font?.color?.argb).toBe('FFFFFFFF')
|
|
214
|
-
const value = sheet.getRow(head.number + 1).getCell(2)
|
|
215
|
-
expect(value.value).toBe('미라텍 MES')
|
|
216
|
-
expect(value.border?.right?.style).toBe('thin')
|
|
217
|
-
expect(value.alignment).toMatchObject({ wrapText: true, indent: 1 })
|
|
218
|
-
expect(sheet.headerFooter.oddFooter).toBe('&L&8(주)하티오랩 · <title>&R&8&P / &N')
|
|
219
|
-
expect(sheet.pageSetup).toMatchObject({ paperSize: 9, orientation: 'portrait', fitToWidth: 1, fitToHeight: 0 })
|
|
220
|
-
expect(sheet.views[0]).toMatchObject({ showGridLines: false })
|
|
221
|
-
expect(sheet.getColumn(1).width).toBe(18)
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
it('★ sheet names Excel takes: at most 31 characters, none of \\ / ? * [ ] :, no two alike, none the roster has', () => {
|
|
225
|
-
const names = sheetNamesOf(['홍길동', '홍길동', 'HONG', 'hong', 'a/b:c*d?[e]', '', null, 'x'.repeat(40), 'x'.repeat(40), '인력 현황'], ['인력 현황'])
|
|
226
|
-
expect(names.slice(0, 7)).toEqual(['홍길동', '홍길동 (2)', 'HONG', 'hong (2)', 'a b c d e', '#6', '#7'])
|
|
227
|
-
expect(names[7]).toBe('x'.repeat(31))
|
|
228
|
-
expect(names[8]).toBe('x'.repeat(27) + ' (2)')
|
|
229
|
-
expect(names[9]).toBe('인력 현황 (2)')
|
|
230
|
-
})
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
describe('painted as HTML for the PDF', () => {
|
|
234
|
-
it('★ a page a person after the roster, the same cells, spans as colspan, text escaped', () => {
|
|
235
|
-
const html = profileHtml([KIM, { name: '<b>박</b>' }], WORDS, 'C', TODAY)
|
|
236
|
-
expect(html.match(/<section class="sheet">/g)).toHaveLength(3)
|
|
237
|
-
/* The roster's number spans the person's two lines; the second line leaves its column out. */
|
|
238
|
-
expect(html).toContain('<td class="value" rowspan="2" style="vertical-align:top">1</td>')
|
|
239
|
-
expect(html).toMatch(/rowspan="2"[^]*?<\/tr><tr[^>]*><td class="value" colspan="5">TypeScript, PostgreSQL<\/td><\/tr>/)
|
|
240
|
-
const firstCol = [...html.matchAll(/<colgroup><col style="width:([\d.]+)%">/g)].map(match => Number(match[1]))
|
|
241
|
-
expect(firstCol[0]).toBeCloseTo((ROSTER_WIDTHS[0] / 104) * 100, 1)
|
|
242
|
-
expect(firstCol[1]).toBeCloseTo((COLUMN_WIDTHS[0] / 104) * 100, 1)
|
|
243
|
-
expect(html).toContain('<td class="name" colspan="6">김하늘</td>')
|
|
244
|
-
expect(html).toContain('<span class="tag">TypeScript</span><span class="tag">PostgreSQL</span>')
|
|
245
|
-
expect(html).toMatch(/<tr class="zebra"|<tr style/)
|
|
246
|
-
expect(html).toContain('<b>박</b>')
|
|
247
|
-
expect(html).not.toContain('<b>박</b>')
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
it('a line keeps its line breaks, an empty line is a gap, a cell left of the first one is filled', () => {
|
|
251
|
-
expect(layoutHtml([{ cells: [{ col: 2, value: 'a\nb', role: 'value' }] }])).toContain('<td colspan="1"></td><td class="value">a<br>b</td><td colspan="4"></td>')
|
|
252
|
-
expect(layoutHtml([{ cells: [] }])).toContain('<tr class="gap">')
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
it('the foot of every PDF page: the employer and the page of how many, a brace in the name opening no template', () => {
|
|
256
|
-
const footer = profileFooterHtml('{{evil}} & Co', WORDS)
|
|
257
|
-
expect(footer).toContain('{{evil}} & Co · <title>')
|
|
258
|
-
expect(footer).toContain('<span class="pageNumber"></span> / <span class="totalPages"></span>')
|
|
259
|
-
})
|
|
260
|
-
|
|
261
|
-
it('★ the preview is the same pages as one document, shown as sheets of A4 on a screen', () => {
|
|
262
|
-
const page = profilePreviewHtml([KIM], WORDS, 'C', TODAY)
|
|
263
|
-
expect(page.startsWith('<!doctype html>')).toBe(true)
|
|
264
|
-
expect(page).toContain(profileHtml([KIM], WORDS, 'C', TODAY))
|
|
265
|
-
expect(page).toMatch(/@media screen \{[\s\S]*\.sheet \{[^}]*width: 210mm/)
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
it('the words head as a document heads - a capital first where the language has one', () => {
|
|
269
|
-
expect(lead('proyectos')).toBe('Proyectos')
|
|
270
|
-
expect(lead('프로젝트 이력')).toBe('프로젝트 이력')
|
|
271
|
-
expect(lead('')).toBe('')
|
|
272
|
-
const words = profileWordsOf(key => (key === 'text.employee-profile-doc-years' ? '{years} años' : 'habilidades'))
|
|
273
|
-
expect(words.skills).toBe('Habilidades')
|
|
274
|
-
expect(words.years(2, 0)).toBe('{years} años')
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
it('the file is named by the word and the day', () => {
|
|
278
|
-
expect(profileFileName('인력프로필', 'xlsx', new Date(2026, 9, 7))).toBe('인력프로필-20261007.xlsx')
|
|
279
|
-
expect(profileFileName('인력프로필', 'pdf', new Date(2026, 9, 7))).toBe('인력프로필-20261007.pdf')
|
|
280
|
-
expect(profileFileName('인력프로필', 'html', new Date(2026, 9, 7))).toBe('인력프로필-20261007.html')
|
|
281
|
-
})
|
|
282
|
-
})
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The person's own profile as the assistant's 입력안 (ADR-0169 decision 10): a résumé read into rows of sections, each
|
|
3
|
-
* section added to one's own profile by one call of addToMyEmployeeProfile, nothing kept taken away.
|
|
4
|
-
*/
|
|
5
|
-
import { clearEntryTargets, declareEntryTarget } from '../../ai-assistant/server/service/data-entry/entry-target'
|
|
6
|
-
import { profileAdditionOf, profileEntryIssues, PROFILE_ENTRY_FIELDS } from '../server/ai-entry/employee-profile-entry'
|
|
7
|
-
import { employeeProfileEntryTarget, ORGANIZATION_EMPLOYEE_PROFILE } from '../server/ai-entry/organization-entry-targets'
|
|
8
|
-
import { addedProfileOf } from '../server/service/employee-profile/employee-profile-rules'
|
|
9
|
-
|
|
10
|
-
import en from '../translations/en.json'
|
|
11
|
-
import es from '../translations/es.json'
|
|
12
|
-
import ko from '../translations/ko.json'
|
|
13
|
-
|
|
14
|
-
const row = (values: Record<string, unknown>, index = 0) => ({ index, values, sources: [], issues: [] })
|
|
15
|
-
|
|
16
|
-
describe("the assistant's 입력안 of one's own profile", () => {
|
|
17
|
-
afterEach(() => clearEntryTargets())
|
|
18
|
-
|
|
19
|
-
it('★ is accepted by the assistant as declared - one call of addToMyEmployeeProfile a section', () => {
|
|
20
|
-
const target = employeeProfileEntryTarget()
|
|
21
|
-
expect(() => declareEntryTarget(target as any)).not.toThrow()
|
|
22
|
-
expect(target.key).toBe(ORGANIZATION_EMPLOYEE_PROFILE)
|
|
23
|
-
expect(target.mutation).toMatch(/addToMyEmployeeProfile\(profile: \$profile\)/)
|
|
24
|
-
expect(target.group?.by).toBe('section')
|
|
25
|
-
expect(target.description).toMatch(/OWN/)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('★ the rows of a section become what the door adds - only the section fields', () => {
|
|
29
|
-
expect(profileAdditionOf([row({ section: 'summary', text: ' MES 12년 ' })])).toEqual({ summary: 'MES 12년' })
|
|
30
|
-
expect(profileAdditionOf([row({ section: 'skill', text: 'TypeScript' }), row({ section: 'skill', text: 'PLC' }, 1)])).toEqual({ skills: ['TypeScript', 'PLC'] })
|
|
31
|
-
expect(profileAdditionOf([row({ section: 'project', name: '미라텍 MES', client: '미라텍', startedOn: '2024-01', role: 'PM', school: '섞임' })])).toEqual({
|
|
32
|
-
projects: [{ name: '미라텍 MES', client: '미라텍', startedOn: '2024-01', endedOn: '', role: 'PM', duties: '', technologies: '' }]
|
|
33
|
-
})
|
|
34
|
-
expect(profileAdditionOf([row({ section: 'education', school: '한양대', degree: '학사' })])).toEqual({
|
|
35
|
-
educations: [{ school: '한양대', major: '', degree: '학사', startedOn: '', endedOn: '' }]
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('a row without what its section needs is kept out, and so is a second summary', () => {
|
|
40
|
-
const issues = profileEntryIssues([
|
|
41
|
-
row({ section: 'project', client: '미라텍' }),
|
|
42
|
-
row({ section: 'certificate', name: 'PMP' }, 1),
|
|
43
|
-
row({ section: 'summary', text: 'a' }, 2),
|
|
44
|
-
row({ section: 'summary', text: 'b' }, 3)
|
|
45
|
-
])
|
|
46
|
-
expect(issues[0]).toEqual([{ field: 'name', code: 'required', blocking: true }])
|
|
47
|
-
expect(issues[1]).toEqual([])
|
|
48
|
-
expect(issues[2]).toEqual([])
|
|
49
|
-
expect(issues[3].map(issue => issue.code)).toEqual(['one-summary'])
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('★ adding takes nothing away: a summary given replaces, skills and rows are added unless already there', () => {
|
|
53
|
-
const held = { summary: '옛 요약', skills: ['TypeScript'], projects: [{ name: 'A', client: 'X' }], educations: [], certificates: [], careers: [] }
|
|
54
|
-
const added = addedProfileOf(held, { summary: '새 요약', skills: ['typescript', 'PLC'], projects: [{ name: ' a ', client: 'x' }, { name: 'B' }] })
|
|
55
|
-
expect(added).toEqual({ summary: '새 요약', skills: ['TypeScript', 'PLC'], educations: [], certificates: [], careers: [], projects: [{ name: 'A', client: 'X' }, { name: 'B' }] })
|
|
56
|
-
expect(addedProfileOf(held, { skills: ['Go'] }).summary).toBe('옛 요약')
|
|
57
|
-
expect(addedProfileOf(null, { certificates: [{ name: 'PMP' }] }).certificates).toEqual([{ name: 'PMP' }])
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('every word the card shows is in the languages the application runs', () => {
|
|
61
|
-
const keys = [
|
|
62
|
-
employeeProfileEntryTarget().labelKey,
|
|
63
|
-
...PROFILE_ENTRY_FIELDS.map(field => field.labelKey!),
|
|
64
|
-
...PROFILE_ENTRY_FIELDS.find(field => field.name === 'section')!.values!.map(value => `text.organization-entry-profile-section-${value}`),
|
|
65
|
-
'text.organization-entry-profile-one-summary'
|
|
66
|
-
]
|
|
67
|
-
for (const [language, words] of Object.entries({ ko, en, es } as Record<string, Record<string, string>>)) {
|
|
68
|
-
const missing = keys.filter(key => !(key in words) && !['label.department'].includes(key))
|
|
69
|
-
expect([language, missing]).toEqual([language, []])
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
})
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { employeesWithProfiles, isActiveEmployee, profileDocumentOf, PROFILE_ROW_FIELDS } from '../server/service/employee-profile/employee-profile-rules'
|
|
2
|
-
import { addSkills, blankRow, completenessOf, headlineOf, periodLabelOf, PROFILE_SECTIONS, profileFormOf, profileInputOf } from '../client/pages/employee-profile/employee-profile-form'
|
|
3
|
-
|
|
4
|
-
/** The employee's profile is saved whole, as the screen holds it (ADR-0169 decision 2). */
|
|
5
|
-
describe("an employee's profile as it is saved", () => {
|
|
6
|
-
it('★ blank rows the screen added and did not fill go; the rest are trimmed and keep only their own fields', () => {
|
|
7
|
-
const saved = profileDocumentOf({
|
|
8
|
-
summary: ' 백엔드 10년 ',
|
|
9
|
-
skills: [' TypeScript ', 'PostgreSQL', '', 'TypeScript'],
|
|
10
|
-
educations: [{ school: ' 서울대 ', major: '컴퓨터공학', degree: '', startedOn: '2005-03', endedOn: '2009-02', salary: 1 }, { school: ' ', major: '' }],
|
|
11
|
-
certificates: [{}],
|
|
12
|
-
careers: null,
|
|
13
|
-
projects: [{ name: 'MES 구축', client: '미라텍', technologies: 'Node' }]
|
|
14
|
-
})
|
|
15
|
-
expect(saved).toEqual({
|
|
16
|
-
summary: '백엔드 10년',
|
|
17
|
-
skills: ['TypeScript', 'PostgreSQL'],
|
|
18
|
-
educations: [{ school: '서울대', major: '컴퓨터공학', startedOn: '2005-03', endedOn: '2009-02' }],
|
|
19
|
-
certificates: [],
|
|
20
|
-
careers: [],
|
|
21
|
-
projects: [{ name: 'MES 구축', client: '미라텍', technologies: 'Node' }]
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('an empty document empties the profile', () => {
|
|
26
|
-
expect(profileDocumentOf({})).toEqual({ summary: null, skills: [], educations: [], certificates: [], careers: [], projects: [] })
|
|
27
|
-
expect(profileDocumentOf(null)).toEqual({ summary: null, skills: [], educations: [], certificates: [], careers: [], projects: [] })
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('★ the screen edits exactly the fields the server keeps, section by section', () => {
|
|
31
|
-
for (const section of PROFILE_SECTIONS) {
|
|
32
|
-
expect([section.key, section.fields.map(field => field.name).sort()]).toEqual([section.key, [...PROFILE_ROW_FIELDS[section.key]].sort()])
|
|
33
|
-
}
|
|
34
|
-
expect(PROFILE_SECTIONS.map(section => section.key).sort()).toEqual(Object.keys(PROFILE_ROW_FIELDS).sort())
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('skills are added as typed - split at commas and line ends, no repeat whatever the case', () => {
|
|
38
|
-
expect(addSkills(['Java'], ' java, Spring ,,\nKotlin, spring ')).toEqual(['Java', 'Spring', 'Kotlin'])
|
|
39
|
-
const form = profileFormOf({ summary: 'S', skills: ['A', 'B'], projects: [{ name: 'P', other: 'x' }] })
|
|
40
|
-
expect(form.skills).toEqual(['A', 'B'])
|
|
41
|
-
expect(profileInputOf(form).skills).toEqual(['A', 'B'])
|
|
42
|
-
expect(profileFormOf(null)).toEqual({ summary: '', skills: [], educations: [], certificates: [], careers: [], projects: [] })
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('★ a job or project begun and not ended is going on; going on is never sent, and sends no end', () => {
|
|
46
|
-
const form = profileFormOf({ projects: [{ name: 'P', startedOn: '2024-01', endedOn: null, other: 'x' }], careers: [{ company: 'A', startedOn: '2020-01', endedOn: '2023-12' }] })
|
|
47
|
-
expect(form.projects).toEqual([{ name: 'P', client: '', role: '', startedOn: '2024-01', endedOn: '', technologies: '', duties: '', ongoing: 'true' }])
|
|
48
|
-
expect(form.careers[0].ongoing).toBe('')
|
|
49
|
-
const sent = profileInputOf({ ...form, careers: [{ ...form.careers[0], ongoing: 'true' }] })
|
|
50
|
-
expect(sent.careers).toEqual([{ company: 'A', department: '', position: '', startedOn: '2020-01', endedOn: '', duties: '' }])
|
|
51
|
-
expect(sent.projects[0]).not.toHaveProperty('ongoing')
|
|
52
|
-
const projects = PROFILE_SECTIONS.find(section => section.key === 'projects')!
|
|
53
|
-
expect(blankRow(projects)).toHaveProperty('ongoing', '')
|
|
54
|
-
expect(blankRow(PROFILE_SECTIONS.find(section => section.key === 'certificates')!)).toEqual({ name: '', issuer: '', acquiredOn: '' })
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it("a row's headline and period in one line each", () => {
|
|
58
|
-
const projects = PROFILE_SECTIONS.find(section => section.key === 'projects')!
|
|
59
|
-
expect(headlineOf(projects, { name: '미라텍 MES', client: '', role: 'PM' })).toBe('미라텍 MES · PM')
|
|
60
|
-
expect(periodLabelOf({ startedOn: '2024-01', endedOn: '', ongoing: 'true' }, '현재')).toBe('2024.01 ~ 현재')
|
|
61
|
-
expect(periodLabelOf({ startedOn: '2020-01', endedOn: '2023-12' }, '현재')).toBe('2020.01 ~ 2023.12')
|
|
62
|
-
expect(periodLabelOf({ name: 'x', acquiredOn: '2010-05-01' }, '현재')).toBe('2010.05.01')
|
|
63
|
-
expect(periodLabelOf({ startedOn: '', endedOn: '' }, '현재')).toBe('')
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('★ complete when the summary, skills, education and projects are written - jobs and certificates are not asked', () => {
|
|
67
|
-
const empty = profileFormOf(null)
|
|
68
|
-
expect(completenessOf(empty)).toEqual({ percent: 0, missing: ['summary', 'skills', 'educations', 'projects'] })
|
|
69
|
-
expect(completenessOf({ ...empty, summary: ' ', skills: ['A'] })).toEqual({ percent: 25, missing: ['summary', 'educations', 'projects'] })
|
|
70
|
-
expect(completenessOf({ ...empty, summary: 'S', skills: ['A'], educations: [{}], projects: [{}] }).percent).toBe(100)
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
/** Who the profile list shows: everyone still working here, with or without a profile (ADR-0169 decision 4). */
|
|
75
|
-
describe('the active employees and their profiles', () => {
|
|
76
|
-
const today = '2026-10-27'
|
|
77
|
-
|
|
78
|
-
it('★ an employee marked inactive, or whose retire day has come, is not listed', () => {
|
|
79
|
-
expect(isActiveEmployee({ id: '1' }, today)).toBe(true)
|
|
80
|
-
expect(isActiveEmployee({ id: '1', active: true, retiredOn: null }, today)).toBe(true)
|
|
81
|
-
expect(isActiveEmployee({ id: '1', active: null }, today)).toBe(true)
|
|
82
|
-
expect(isActiveEmployee({ id: '1', active: false }, today)).toBe(false)
|
|
83
|
-
expect(isActiveEmployee({ id: '1', retiredOn: '2026-10-27' }, today)).toBe(false)
|
|
84
|
-
expect(isActiveEmployee({ id: '1', retiredOn: '2026-10-28' }, today)).toBe(true)
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('★ each active employee once, by name, with the profile written or none', () => {
|
|
88
|
-
const rows = employeesWithProfiles(
|
|
89
|
-
[
|
|
90
|
-
{ id: 'b', name: '박지민', controlNo: '2', department: { name: '개발' }, jobPosition: '과장', hiredOn: '2020-01-01' },
|
|
91
|
-
{ id: 'a', name: '김하늘', controlNo: '1', department: null },
|
|
92
|
-
{ id: 'c', name: '최퇴사', retiredOn: '2025-01-01' }
|
|
93
|
-
],
|
|
94
|
-
[{ employeeId: 'b', summary: 'S' }, { employeeId: 'c', summary: 'gone' }],
|
|
95
|
-
today
|
|
96
|
-
)
|
|
97
|
-
expect(rows.map(row => [row.name, row.departmentName, row.profile?.summary ?? null])).toEqual([
|
|
98
|
-
['김하늘', undefined, null],
|
|
99
|
-
['박지민', '개발', 'S']
|
|
100
|
-
])
|
|
101
|
-
expect(rows[1]).toMatchObject({ employeeId: 'b', controlNo: '2', jobPosition: '과장', hiredOn: '2020-01-01' })
|
|
102
|
-
})
|
|
103
|
-
})
|
package/tests/entity360.test.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
const here = (file: string) =>
|
|
5
|
-
readFileSync(path.resolve(__dirname, '..', file), 'utf-8').replace(/\/\*[\s\S]*?\*\//g, '')
|
|
6
|
-
|
|
7
|
-
describe('the organization 360', () => {
|
|
8
|
-
it('★ registers Department before the membership section can draw it as a link', () => {
|
|
9
|
-
const bootstrap = here('client/bootstrap.ts')
|
|
10
|
-
expect(bootstrap).toMatch(/registerDepartmentKind\(\)\s*\n\s*registerPersonMembershipSection\(\)/)
|
|
11
|
-
|
|
12
|
-
const department = here('client/entity360/department-360.ts')
|
|
13
|
-
expect(department).toMatch(/kind: 'department',\s*typenames: \['Department'\]/)
|
|
14
|
-
expect(department).toMatch(/registerEntity360Section\('department', \{\s*name: 'overview'/)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('★ opens a department from the membership instead of ending the organizational trail in plain text', () => {
|
|
18
|
-
const membership = here('client/entity360/person-membership-section.ts')
|
|
19
|
-
expect(membership).toMatch(/department \{\s*id\s+__typename\s+name/)
|
|
20
|
-
expect(membership).toMatch(/entity360Name\(one\.department, one\.department\.name \|\| none\)/)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('★ the reusable department cell opens the same 360, with a typename supplied by its employee query', () => {
|
|
24
|
-
const renderer = here('client/grist-editor/grist-renderer-department-object.ts')
|
|
25
|
-
expect(renderer).toMatch(/entity360Name\(value, name \|\| ''\)/)
|
|
26
|
-
|
|
27
|
-
const employees = here('client/pages/employee/employee-list-page.ts')
|
|
28
|
-
expect(employees).toMatch(/department \{\s*id\s+__typename\s+controlNo/)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('keeps the manager as an employee name until the server supplies the linked user identity', () => {
|
|
32
|
-
const department = here('client/entity360/department-360.ts')
|
|
33
|
-
expect(department).toMatch(/manager \{\s*name\s*\}/)
|
|
34
|
-
expect(department).toMatch(/department\.manager\?\.name \|\| none/)
|
|
35
|
-
})
|
|
36
|
-
})
|
package/tests/my-picture.test.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { pictureOf } from '../client/my-picture-model'
|
|
2
|
-
|
|
3
|
-
/** Which picture is the signed-in person's, for the header's avatar. */
|
|
4
|
-
describe('the signed-in person\'s picture', () => {
|
|
5
|
-
it('★ the first employee record that has a picture is the face', () => {
|
|
6
|
-
expect(
|
|
7
|
-
pictureOf([
|
|
8
|
-
{ profile: null },
|
|
9
|
-
{ profile: { left: 3 } },
|
|
10
|
-
{ profile: { picture: '/attachment/a.png', left: 10, top: -5, zoom: 1.5 } },
|
|
11
|
-
{ profile: { picture: '/attachment/b.png' } }
|
|
12
|
-
])
|
|
13
|
-
).toEqual({ picture: '/attachment/a.png', left: 10, top: -5, zoom: 1.5 })
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('★ no record, or none with a picture, is none - the avatar draws a monogram', () => {
|
|
17
|
-
expect(pictureOf([])).toBeNull()
|
|
18
|
-
expect(pictureOf(undefined)).toBeNull()
|
|
19
|
-
expect(pictureOf([{ profile: { zoom: 2 } }, {}])).toBeNull()
|
|
20
|
-
})
|
|
21
|
-
})
|