@things-factory/organization 10.1.278 → 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/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,32 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The assignees editor does not offer Role (ADR-0091 decision 9).
|
|
6
|
-
*
|
|
7
|
-
* The worklist refuses a Role assignee by name on every activity save and on issue. "Anyone of the role"
|
|
8
|
-
* lives in the activity's assigneeRole only, so a Role row here could only end in a refusal on save.
|
|
9
|
-
* The approval-line editor is a different thing and keeps Role.
|
|
10
|
-
*/
|
|
11
|
-
const read = (file: string) => readFileSync(path.resolve(__dirname, '..', file), 'utf-8')
|
|
12
|
-
|
|
13
|
-
describe('the assignees editor', () => {
|
|
14
|
-
const source = read('client/component/assignees-editor.ts')
|
|
15
|
-
|
|
16
|
-
it('does not offer Role as an assignee type', () => {
|
|
17
|
-
const options = source.match(/options: targetTypeOptions\(\[([^\]]*)\]/)?.[1] ?? ''
|
|
18
|
-
expect(options).toMatch(/'Employee'/)
|
|
19
|
-
expect(options).not.toMatch(/'Role'/)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('has no Role branch or role lookup', () => {
|
|
23
|
-
expect(source).not.toMatch(/case 'Role'/)
|
|
24
|
-
expect(source).not.toMatch(/queryName: 'roles'/)
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
describe('the approval-line editor', () => {
|
|
29
|
-
it('keeps Role', () => {
|
|
30
|
-
expect(read('client/component/approval-line-items-editor.ts')).toMatch(/options: targetTypeOptions\(\['Employee', 'Department', 'Role'/)
|
|
31
|
-
})
|
|
32
|
-
})
|
package/tests/audience.test.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whom an audience names (ADR-0163 decision 2) - the one rule a shared dashboard card and an announcement ask.
|
|
3
|
-
*/
|
|
4
|
-
import { audienceReaches, audienceTargetRefusal, departmentsOfEmployees, withAncestors, withDescendants } from '../server/service/audience/audience'
|
|
5
|
-
|
|
6
|
-
/* 본부 > 영업팀 > 영업1파트, and 경영지원 on its own. */
|
|
7
|
-
const TREE = new Map<string, string | null>([
|
|
8
|
-
['hq', null],
|
|
9
|
-
['sales', 'hq'],
|
|
10
|
-
['sales-1', 'sales'],
|
|
11
|
-
['admin', null]
|
|
12
|
-
])
|
|
13
|
-
|
|
14
|
-
const member = (departmentIds: string[], roleIds: string[] = []) => ({ userId: 'u-me', domainId: 'd1', departmentIds, roleIds })
|
|
15
|
-
|
|
16
|
-
describe('who an audience reaches', () => {
|
|
17
|
-
it('★ the domain, a person, a department one stands in, a role one holds - and no one else', () => {
|
|
18
|
-
const me = member(['sales'], ['role-hr'])
|
|
19
|
-
expect(audienceReaches([{ scope: 'DOMAIN', targetId: 'd1' }], me)).toBe(true)
|
|
20
|
-
expect(audienceReaches([{ scope: 'DOMAIN', targetId: 'd2' }], me)).toBe(false)
|
|
21
|
-
expect(audienceReaches([{ scope: 'USER', targetId: 'u-me' }], me)).toBe(true)
|
|
22
|
-
expect(audienceReaches([{ scope: 'USER', targetId: 'u-other' }], me)).toBe(false)
|
|
23
|
-
expect(audienceReaches([{ scope: 'DEPARTMENT', targetId: 'sales' }], me)).toBe(true)
|
|
24
|
-
expect(audienceReaches([{ scope: 'DEPARTMENT', targetId: 'admin' }], me)).toBe(false)
|
|
25
|
-
expect(audienceReaches([{ scope: 'ROLE', targetId: 'role-hr' }], me)).toBe(true)
|
|
26
|
-
expect(audienceReaches([{ scope: 'ROLE', targetId: 'role-finance' }], me)).toBe(false)
|
|
27
|
-
expect(audienceReaches([], me)).toBe(false)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('★ a department reaches the people of the departments under it (the user, 2026-10-26), not those above or beside', () => {
|
|
31
|
-
const inPart = member(withAncestors(['sales-1'], TREE))
|
|
32
|
-
expect(audienceReaches([{ scope: 'DEPARTMENT', targetId: 'hq' }], inPart)).toBe(true)
|
|
33
|
-
expect(audienceReaches([{ scope: 'DEPARTMENT', targetId: 'sales' }], inPart)).toBe(true)
|
|
34
|
-
const inTeam = member(withAncestors(['sales'], TREE))
|
|
35
|
-
expect(audienceReaches([{ scope: 'DEPARTMENT', targetId: 'sales-1' }], inTeam)).toBe(false)
|
|
36
|
-
expect(audienceReaches([{ scope: 'DEPARTMENT', targetId: 'admin' }], inTeam)).toBe(false)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('a person without a user or a domain is reached by nothing', () => {
|
|
40
|
-
expect(audienceReaches([{ scope: 'DOMAIN', targetId: 'd1' }], { userId: '', domainId: 'd1', departmentIds: [], roleIds: [] })).toBe(false)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
describe('the department tree', () => {
|
|
45
|
-
it('★ up from a department to the top, and down to every department under it', () => {
|
|
46
|
-
expect(withAncestors(['sales-1'], TREE).sort()).toEqual(['hq', 'sales', 'sales-1'])
|
|
47
|
-
expect(withDescendants(['hq'], TREE).sort()).toEqual(['hq', 'sales', 'sales-1'])
|
|
48
|
-
expect(withDescendants(['admin'], TREE)).toEqual(['admin'])
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('a loop in the tree ends the walk', () => {
|
|
52
|
-
const loop = new Map<string, string | null>([
|
|
53
|
-
['a', 'b'],
|
|
54
|
-
['b', 'a']
|
|
55
|
-
])
|
|
56
|
-
expect(withAncestors(['a'], loop).sort()).toEqual(['a', 'b'])
|
|
57
|
-
expect(withDescendants(['a'], loop).sort()).toEqual(['a', 'b'])
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('★ only active employee records count, and a record without a department adds none', () => {
|
|
61
|
-
expect(
|
|
62
|
-
departmentsOfEmployees([
|
|
63
|
-
{ active: true, department: { id: 'sales' } },
|
|
64
|
-
{ active: false, department: { id: 'admin' } },
|
|
65
|
-
{ active: null, department: { id: 'hq' } },
|
|
66
|
-
{ active: true, department: null },
|
|
67
|
-
{ active: true, department: { id: 'sales' } }
|
|
68
|
-
])
|
|
69
|
-
).toEqual(['sales'])
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
describe('what may be addressed', () => {
|
|
74
|
-
const domain = { domainId: 'd1', departmentIds: ['hq', 'sales'], roleIds: ['role-hr'] }
|
|
75
|
-
it('★ a known scope with a target of this domain', () => {
|
|
76
|
-
expect(audienceTargetRefusal({ scope: 'DOMAIN', targetId: 'd1' }, domain)).toBeUndefined()
|
|
77
|
-
expect(audienceTargetRefusal({ scope: 'DOMAIN', targetId: 'd2' }, domain)).toBe('another-domain')
|
|
78
|
-
expect(audienceTargetRefusal({ scope: 'DEPARTMENT', targetId: 'sales' }, domain)).toBeUndefined()
|
|
79
|
-
expect(audienceTargetRefusal({ scope: 'DEPARTMENT', targetId: 'elsewhere' }, domain)).toBe('unknown-department')
|
|
80
|
-
expect(audienceTargetRefusal({ scope: 'ROLE', targetId: 'role-hr' }, domain)).toBeUndefined()
|
|
81
|
-
expect(audienceTargetRefusal({ scope: 'ROLE', targetId: 'role-x' }, domain)).toBe('unknown-role')
|
|
82
|
-
expect(audienceTargetRefusal({ scope: 'TEAM', targetId: 'x' }, domain)).toBe('unknown-scope')
|
|
83
|
-
expect(audienceTargetRefusal({ scope: 'USER', targetId: '' }, domain)).toBe('no-target')
|
|
84
|
-
})
|
|
85
|
-
})
|
package/tests/copy-from.test.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { offersCopyFrom } from '../client/component/copy-from'
|
|
2
|
-
|
|
3
|
-
describe('the approval line editor offers "copy from" only when there is something to copy', () => {
|
|
4
|
-
it('saved lines: the button stands', () => {
|
|
5
|
-
expect(offersCopyFrom(1)).toBe(true)
|
|
6
|
-
expect(offersCopyFrom(12)).toBe(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('none saved: no button, so no empty window', () => {
|
|
10
|
-
expect(offersCopyFrom(0)).toBe(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('not counted yet, or the count failed: no button', () => {
|
|
14
|
-
expect(offersCopyFrom(undefined)).toBe(false)
|
|
15
|
-
expect(offersCopyFrom(null)).toBe(false)
|
|
16
|
-
})
|
|
17
|
-
})
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
import { ROLE_TASKS } from '../server/role-tasks'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Every seat reads the departments; the people in them stay the roster's (ADR-0139, the user 2026-10-29).
|
|
8
|
-
*
|
|
9
|
-
* A sales seat saving an opportunity was refused `department:query`: the opportunity names a department. The
|
|
10
|
-
* department's own fields say nothing about anybody; `manager` and `members` lead to employee records. So those two
|
|
11
|
-
* ask `employee:query` on the field, and the list doors are searched, filtered and sorted only by the open fields -
|
|
12
|
-
* filtering by a closed one would tell, by whether a department stays in the list, what it holds.
|
|
13
|
-
*/
|
|
14
|
-
const read = (file: string) => readFileSync(path.resolve(__dirname, '..', file), 'utf-8')
|
|
15
|
-
const CLOSED = ['manager', 'members']
|
|
16
|
-
|
|
17
|
-
describe('the department list every seat reads', () => {
|
|
18
|
-
const entity = read('server/service/department/department.ts')
|
|
19
|
-
const doors = read('server/service/department/department-query.ts')
|
|
20
|
-
|
|
21
|
-
it.each(CLOSED)('★ %s asks employee:query on the declared field', field => {
|
|
22
|
-
expect(entity).toMatch(
|
|
23
|
-
new RegExp(`@Directive\\('@privilege\\(category: "employee", privilege: "query", domainOwnerGranted: true\\)'\\)\\n @Field\\([^\\n]*\\)\\n ${field}\\?:`)
|
|
24
|
-
)
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it.each(CLOSED)('★ %s is nullable, so a seat refused it still gets the list above it', field => {
|
|
28
|
-
expect(entity).toMatch(new RegExp(` @Field\\([^\\n]*\\{ nullable: true \\}\\)\\n ${field}\\?:`))
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it("★ members are resolved - the department's own employees in its domain - so a seat that may read them gets them", () => {
|
|
32
|
-
const resolver = doors.slice(doors.indexOf('async members('), doors.indexOf('@FieldResolver', doors.indexOf('async members(')))
|
|
33
|
-
expect(doors).toMatch(/@FieldResolver\(type => \[Employee\], \{ nullable: true \}\)\n async members\(/)
|
|
34
|
-
expect(resolver).toMatch(/domain: \{ id: department\.domainId \}, department: \{ id: department\.id \}/)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('★ no other field of a department asks a privilege', () => {
|
|
38
|
-
const asked = [...entity.matchAll(/@privilege\([^\n]*\n @Field\([^\n]*\)\n (\w+)\?:/g)].map(match => match[1])
|
|
39
|
-
expect(asked.sort()).toEqual([...CLOSED].sort())
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('★ every list door reads by the same rules, and those rules name no closed field', () => {
|
|
43
|
-
const rules = doors.slice(doors.indexOf('const DEPARTMENT_LIST_RULES = {'), doors.indexOf('}', doors.indexOf('const DEPARTMENT_LIST_RULES = {')))
|
|
44
|
-
for (const key of ['searchables', 'filterables', 'sortables']) expect([key, rules.includes(`${key}: [`)]).toEqual([key, true])
|
|
45
|
-
for (const field of [...CLOSED, 'managerId']) expect([field, rules.includes(`'${field}'`)]).toEqual([field, false])
|
|
46
|
-
for (const door of ['async departmentRoots(', 'async departments(', 'async children(']) {
|
|
47
|
-
const body = doors.slice(doors.indexOf(door), doors.indexOf('getManyAndCount', doors.indexOf(door)))
|
|
48
|
-
expect([door, body.includes('...DEPARTMENT_LIST_RULES')]).toEqual([door, true])
|
|
49
|
-
}
|
|
50
|
-
expect(doors.match(/searchables: \[/g)).toHaveLength(1)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('★ the department picker asks nothing a seat without employee:query is refused', () => {
|
|
54
|
-
const picker = read('client/component/department-selector.ts')
|
|
55
|
-
const fragment = picker.slice(picker.indexOf('fragment SubDepartment on Department'), picker.indexOf('`', picker.indexOf('fragment SubDepartment on Department')))
|
|
56
|
-
for (const field of CLOSED) expect([field, new RegExp(`^\\s+${field}\\b`, 'm').test(fragment)]).toEqual([field, false])
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
it('★ the department table does not offer sorting by its head', () => {
|
|
60
|
-
const screen = read('client/pages/department/department-list-page.ts')
|
|
61
|
-
const column = screen.slice(screen.indexOf("name: 'manager',"), screen.indexOf("type: 'checkbox'", screen.indexOf("name: 'manager',")))
|
|
62
|
-
expect(column).toMatch(/\n sortable: false,\n width: 120/)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('★ reading the departments is a task of its own, holding department:query alone, named in every language', () => {
|
|
66
|
-
expect(ROLE_TASKS.find(task => task.id === 'organization.departments-reading')?.grants).toEqual([{ category: 'department', axes: ['query'] }])
|
|
67
|
-
for (const lang of ['en', 'ko', 'ja', 'zh', 'ms', 'es']) {
|
|
68
|
-
const words = JSON.parse(read(`translations/${lang}.json`))
|
|
69
|
-
expect([lang, !!words['task.organization.departments-reading.name'], !!words['task.organization.departments-reading.description']]).toEqual([lang, true, true])
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
})
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A department's parent can be set, changed and cleared from the department list, and a loop is refused.
|
|
3
|
-
*
|
|
4
|
-
* The list had no parent cell. Departments made anywhere but "add child node" on a new row stayed top-level
|
|
5
|
-
* for good — OA's five all were — and the department selector, which drew the first top-level department
|
|
6
|
-
* only, could offer one of the five.
|
|
7
|
-
*
|
|
8
|
-
* This sends the list's patch through the server's own DepartmentPatch and the real updateMultipleDepartment,
|
|
9
|
-
* on sqlite, and reads the parent back from the table.
|
|
10
|
-
*/
|
|
11
|
-
import 'reflect-metadata'
|
|
12
|
-
|
|
13
|
-
const { existsSync } = require('fs')
|
|
14
|
-
const { join } = require('path')
|
|
15
|
-
const { DataSource } = require('typeorm')
|
|
16
|
-
const { buildSchema, Resolver, Query, Mutation, Arg, Ctx } = require('type-graphql')
|
|
17
|
-
const { graphql } = require('graphql')
|
|
18
|
-
|
|
19
|
-
const shell = require('@things-factory/shell')
|
|
20
|
-
const authBase = require('@things-factory/auth-base')
|
|
21
|
-
const contact = require('@things-factory/contact')
|
|
22
|
-
/* contact's Contact names a biz-base Counterparty (ADR-0122 decision C), so its entities come along. */
|
|
23
|
-
const bizBase = require('@things-factory/biz-base')
|
|
24
|
-
|
|
25
|
-
function loadCompiled(modulePath: string): any {
|
|
26
|
-
const resolved = join(__dirname, '..', 'dist-server', `${modulePath}.js`)
|
|
27
|
-
if (!existsSync(resolved)) {
|
|
28
|
-
throw new Error(`organization build output is missing: ${resolved}\nBuild it first: npm run build:server`)
|
|
29
|
-
}
|
|
30
|
-
return require(resolved)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let dataSource: any
|
|
34
|
-
let Department: any
|
|
35
|
-
let schema: any
|
|
36
|
-
let domain: any
|
|
37
|
-
let user: any
|
|
38
|
-
|
|
39
|
-
const SAVE = `
|
|
40
|
-
mutation ($patches: [DepartmentPatch!]!) {
|
|
41
|
-
updateMultipleDepartment(patches: $patches) { id name }
|
|
42
|
-
}
|
|
43
|
-
`
|
|
44
|
-
|
|
45
|
-
beforeAll(async () => {
|
|
46
|
-
const organization = loadCompiled('service/index')
|
|
47
|
-
Department = loadCompiled('service/department/department').Department
|
|
48
|
-
const { DepartmentMutation } = loadCompiled('service/department/department-mutation')
|
|
49
|
-
const { DepartmentPatch } = loadCompiled('service/department/department-type')
|
|
50
|
-
|
|
51
|
-
dataSource = new DataSource({
|
|
52
|
-
type: 'sqlite',
|
|
53
|
-
database: ':memory:',
|
|
54
|
-
synchronize: true,
|
|
55
|
-
dropSchema: true,
|
|
56
|
-
namingStrategy: new shell.NamingStrategy(),
|
|
57
|
-
entities: [...shell.entities, ...authBase.entities, ...bizBase.entities, ...contact.entities, ...organization.entities],
|
|
58
|
-
logging: false
|
|
59
|
-
})
|
|
60
|
-
await dataSource.initialize()
|
|
61
|
-
shell.addDataSource('default', dataSource)
|
|
62
|
-
shell.addDataSource('tx', dataSource)
|
|
63
|
-
|
|
64
|
-
/* The real mutation behind the real input type; the context stands in for what its directives set up. */
|
|
65
|
-
class DepartmentParentProbe {
|
|
66
|
-
probe() {
|
|
67
|
-
return true
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async updateMultipleDepartment(patches: any[], context: any) {
|
|
71
|
-
return await new DepartmentMutation().updateMultipleDepartment(patches, context)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
Query(() => Boolean)(DepartmentParentProbe.prototype, 'probe', Object.getOwnPropertyDescriptor(DepartmentParentProbe.prototype, 'probe'))
|
|
75
|
-
Arg('patches', () => [DepartmentPatch])(DepartmentParentProbe.prototype, 'updateMultipleDepartment', 0)
|
|
76
|
-
Ctx()(DepartmentParentProbe.prototype, 'updateMultipleDepartment', 1)
|
|
77
|
-
Mutation(() => [Department])(
|
|
78
|
-
DepartmentParentProbe.prototype,
|
|
79
|
-
'updateMultipleDepartment',
|
|
80
|
-
Object.getOwnPropertyDescriptor(DepartmentParentProbe.prototype, 'updateMultipleDepartment')
|
|
81
|
-
)
|
|
82
|
-
Resolver()(DepartmentParentProbe)
|
|
83
|
-
|
|
84
|
-
schema = await buildSchema({ resolvers: [DepartmentParentProbe], validate: false })
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
let ceo: any
|
|
88
|
-
let team1: any
|
|
89
|
-
let team2: any
|
|
90
|
-
|
|
91
|
-
beforeEach(async () => {
|
|
92
|
-
await dataSource.synchronize(true)
|
|
93
|
-
domain = await dataSource.getRepository(shell.Domain).save({ name: 'department-parent', subdomain: 'department-parent' })
|
|
94
|
-
user = await dataSource.getRepository(authBase.User).save({ name: 'tester', email: 'tester@department-parent.test' })
|
|
95
|
-
|
|
96
|
-
/* OA's shape: every department top-level. */
|
|
97
|
-
const repository = dataSource.getRepository(Department)
|
|
98
|
-
ceo = await repository.save({ domain, controlNo: 'CEO', name: 'CEO' })
|
|
99
|
-
team1 = await repository.save({ domain, controlNo: 'T01', name: '1팀' })
|
|
100
|
-
team2 = await repository.save({ domain, controlNo: 'T02', name: '2팀' })
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
afterAll(async () => {
|
|
104
|
-
if (!dataSource) return
|
|
105
|
-
shell.removeDataSource('default')
|
|
106
|
-
shell.removeDataSource('tx')
|
|
107
|
-
await dataSource.destroy()
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
async function save(patches: any[]) {
|
|
111
|
-
return await graphql({
|
|
112
|
-
schema,
|
|
113
|
-
source: SAVE,
|
|
114
|
-
variableValues: { patches },
|
|
115
|
-
contextValue: { state: { domain, user, tx: dataSource.manager } }
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async function parentOf(department: any) {
|
|
120
|
-
return (await dataSource.getRepository(Department).findOneBy({ id: department.id })).parentId ?? null
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
describe("a department's parent is set from the department list", () => {
|
|
124
|
-
it('an existing top-level department moves under another', async () => {
|
|
125
|
-
const result = await save([
|
|
126
|
-
{ id: team1.id, cuFlag: 'M', parent: { id: ceo.id } },
|
|
127
|
-
{ id: team2.id, cuFlag: 'M', parent: { id: ceo.id } }
|
|
128
|
-
])
|
|
129
|
-
|
|
130
|
-
expect(result.errors).toBeUndefined()
|
|
131
|
-
expect(await parentOf(team1)).toBe(ceo.id)
|
|
132
|
-
expect(await parentOf(team2)).toBe(ceo.id)
|
|
133
|
-
expect(await parentOf(ceo)).toBeNull()
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
it('moves from one parent to another, and back to top-level with null', async () => {
|
|
137
|
-
await save([{ id: team2.id, cuFlag: 'M', parent: { id: ceo.id } }])
|
|
138
|
-
|
|
139
|
-
expect((await save([{ id: team2.id, cuFlag: 'M', parent: { id: team1.id } }])).errors).toBeUndefined()
|
|
140
|
-
expect(await parentOf(team2)).toBe(team1.id)
|
|
141
|
-
|
|
142
|
-
expect((await save([{ id: team2.id, cuFlag: 'M', parent: null }])).errors).toBeUndefined()
|
|
143
|
-
expect(await parentOf(team2)).toBeNull()
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('an edit that does not name the parent leaves it where it is', async () => {
|
|
147
|
-
await save([{ id: team1.id, cuFlag: 'M', parent: { id: ceo.id } }])
|
|
148
|
-
|
|
149
|
-
expect((await save([{ id: team1.id, cuFlag: 'M', description: 'first team' }])).errors).toBeUndefined()
|
|
150
|
-
expect(await parentOf(team1)).toBe(ceo.id)
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
it('a new row added under a department is saved there', async () => {
|
|
154
|
-
const result = await save([{ cuFlag: '+', controlNo: 'T01-A', name: '1팀 A조', parent: { id: team1.id } }])
|
|
155
|
-
|
|
156
|
-
expect(result.errors).toBeUndefined()
|
|
157
|
-
const created = await dataSource.getRepository(Department).findOneBy({ controlNo: 'T01-A' })
|
|
158
|
-
expect(created.parentId).toBe(team1.id)
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
it('a department cannot be its own parent', async () => {
|
|
162
|
-
const result = await save([{ id: team1.id, cuFlag: 'M', parent: { id: team1.id } }])
|
|
163
|
-
|
|
164
|
-
expect(result.errors?.[0]?.message).toMatch(/cannot be placed under itself/)
|
|
165
|
-
expect(await parentOf(team1)).toBeNull()
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
it('a department cannot go under one of its own sub-departments', async () => {
|
|
169
|
-
await save([{ id: team1.id, cuFlag: 'M', parent: { id: ceo.id } }])
|
|
170
|
-
await save([{ id: team2.id, cuFlag: 'M', parent: { id: team1.id } }])
|
|
171
|
-
|
|
172
|
-
const result = await save([{ id: ceo.id, cuFlag: 'M', parent: { id: team2.id } }])
|
|
173
|
-
|
|
174
|
-
expect(result.errors?.[0]?.message).toMatch(/cannot be placed under itself/)
|
|
175
|
-
expect(await parentOf(ceo)).toBeNull()
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
it('a parent from another domain is not found', async () => {
|
|
179
|
-
const other = await dataSource.getRepository(shell.Domain).save({ name: 'other', subdomain: 'other' })
|
|
180
|
-
const stranger = await dataSource.getRepository(Department).save({ domain: other, controlNo: 'X', name: 'X' })
|
|
181
|
-
|
|
182
|
-
const result = await save([{ id: team1.id, cuFlag: 'M', parent: { id: stranger.id } }])
|
|
183
|
-
|
|
184
|
-
expect(result.errors?.[0]?.message).toMatch(/parent department not found/)
|
|
185
|
-
expect(await parentOf(team1)).toBeNull()
|
|
186
|
-
})
|
|
187
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { toDepartmentPatch } from '../client/pages/department/department-patch'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The department list's save sends the parent as a reference.
|
|
5
|
-
*
|
|
6
|
-
* The parent cell's selector hands back { id, controlNo, name, description }. DepartmentPatch.parent is an
|
|
7
|
-
* ObjectRef, which has no controlNo, so the whole patch would be refused if the cell's value went as it is.
|
|
8
|
-
*/
|
|
9
|
-
describe('the department list sends a parent as { id } or null', () => {
|
|
10
|
-
const picked = { id: 'd-ceo', controlNo: 'CEO', name: 'CEO', description: 'office' }
|
|
11
|
-
|
|
12
|
-
it('a changed parent cell goes as its id only', () => {
|
|
13
|
-
const patch = toDepartmentPatch({
|
|
14
|
-
id: 'd-t01',
|
|
15
|
-
__dirty__: 'M',
|
|
16
|
-
__dirtyfields__: { parent: { before: null, after: picked } }
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
expect(patch).toEqual({ id: 'd-t01', parent: { id: 'd-ceo' }, cuFlag: 'M' })
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('a cleared parent cell goes as null, which makes the department top-level', () => {
|
|
23
|
-
const patch = toDepartmentPatch({
|
|
24
|
-
id: 'd-t01',
|
|
25
|
-
__dirty__: 'M',
|
|
26
|
-
__dirtyfields__: { parent: { before: picked, after: null } }
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
expect(patch.parent).toBeNull()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('an edit of another cell does not send the parent the row was drawn with', () => {
|
|
33
|
-
const patch = toDepartmentPatch({
|
|
34
|
-
id: 'd-t01',
|
|
35
|
-
parent: { id: 'd-ceo', name: 'CEO' },
|
|
36
|
-
__dirty__: 'M',
|
|
37
|
-
__dirtyfields__: { description: { before: '', after: 'first team' } }
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
expect(patch).toEqual({ id: 'd-t01', description: 'first team', cuFlag: 'M' })
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('a row added with "add child node" sends the parent it was added under', () => {
|
|
44
|
-
const patch = toDepartmentPatch({
|
|
45
|
-
parent: { id: 'd-t01' },
|
|
46
|
-
__dirty__: '+',
|
|
47
|
-
__dirtyfields__: { name: { before: undefined, after: '1팀 A조' } }
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
expect(patch).toEqual({ name: '1팀 A조', parent: { id: 'd-t01' }, cuFlag: '+' })
|
|
51
|
-
})
|
|
52
|
-
})
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A screen's query has to match the schema it is sent to.
|
|
6
|
-
*
|
|
7
|
-
* The employee list reads the departments its rail draws. The screen this was folded in from asked
|
|
8
|
-
* `departmentRoots { ...DepartmentFragment children { … } }` and the fragment asked for a field
|
|
9
|
-
* named `state`. departmentRoots answers with a DepartmentList, and Department has no `state`, so
|
|
10
|
-
* the server refused the whole document with 400 and the rail stayed empty - for as long as nobody
|
|
11
|
-
* opened the console. Type checking cannot see this: a gql`` document is a template literal.
|
|
12
|
-
*
|
|
13
|
-
* These read the server's own Department for the field list, so the check follows the type rather
|
|
14
|
-
* than a copy of it.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const here = (file: string) => readFileSync(path.resolve(__dirname, '..', file), 'utf-8')
|
|
18
|
-
|
|
19
|
-
/** Field names the Department object type actually declares. */
|
|
20
|
-
function departmentFields(): string[] {
|
|
21
|
-
const source = here('server/service/department/department.ts')
|
|
22
|
-
const names: string[] = []
|
|
23
|
-
|
|
24
|
-
for (const match of source.matchAll(/@Field\([^)]*\)[^\n]*\n\s*(?:readonly\s+)?([A-Za-z_]\w*)\??[?!]?\s*[:?]/g)) {
|
|
25
|
-
names.push(match[1])
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return names
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** The field names a fragment body asks for, ignoring nested selections. */
|
|
32
|
-
function fragmentFields(source: string, fragmentName: string): string[] {
|
|
33
|
-
const start = source.indexOf(`fragment ${fragmentName} on `)
|
|
34
|
-
const body = source.slice(start, source.indexOf('`', start))
|
|
35
|
-
const names: string[] = []
|
|
36
|
-
let depth = 0
|
|
37
|
-
|
|
38
|
-
for (const line of body.split('\n').slice(1)) {
|
|
39
|
-
const text = line.trim()
|
|
40
|
-
if (!text) continue
|
|
41
|
-
if (text.includes('}')) depth -= (text.match(/}/g) || []).length
|
|
42
|
-
if (depth === 0) {
|
|
43
|
-
const name = text.match(/^([a-zA-Z_]\w*)/)
|
|
44
|
-
if (name) names.push(name[1])
|
|
45
|
-
}
|
|
46
|
-
if (text.includes('{')) depth += (text.match(/{/g) || []).length
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return names
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
describe('the department query matches the schema', () => {
|
|
53
|
-
const screen = here('client/pages/employee/employee-list-page.ts')
|
|
54
|
-
|
|
55
|
-
it('★ every field the fragment asks for exists on Department', () => {
|
|
56
|
-
const declared = departmentFields()
|
|
57
|
-
expect(declared).toContain('controlNo')
|
|
58
|
-
expect(declared).not.toContain('state')
|
|
59
|
-
|
|
60
|
-
const asked = fragmentFields(screen, 'EmployeeDepartmentFragment')
|
|
61
|
-
expect(asked.length).toBeGreaterThan(3)
|
|
62
|
-
expect(asked.filter(name => !declared.includes(name))).toEqual([])
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('★ the roots come out of the list the query returns', () => {
|
|
66
|
-
/* departmentRoots returns DepartmentList; a fragment spread straight onto it is refused. */
|
|
67
|
-
expect(screen).toMatch(/departmentRoots \{\s*items \{/)
|
|
68
|
-
/*
|
|
69
|
-
* Every root, not the first. An organization can have more than one top level department and
|
|
70
|
-
* the tree draws an array; taking [0] hid the second one with nothing said.
|
|
71
|
-
*/
|
|
72
|
-
expect(screen).toMatch(/departmentsRead\.data\?\.responses\?\.items\b/)
|
|
73
|
-
expect(screen).not.toMatch(/responses\?\.items\?\.\[0\]/)
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
describe('the employee list is the one screen for people', () => {
|
|
78
|
-
/*
|
|
79
|
-
* Two screens drew the same fifteen columns of a person; one of them just had a department tree
|
|
80
|
-
* beside it. Folding them together (architect ruling, 2026-09-18) leaves one screen where the
|
|
81
|
-
* rail narrows the list, and one place for anything that has to be said about a person's row.
|
|
82
|
-
*/
|
|
83
|
-
const screen = here('client/pages/employee/employee-list-page.ts')
|
|
84
|
-
|
|
85
|
-
it('★ the rail narrows the list, and it is the only place a department is chosen', () => {
|
|
86
|
-
expect(screen).toMatch(/<ox-tree/)
|
|
87
|
-
expect(screen).toMatch(/name: 'departmentId', operator: 'eq', value: department\.id/)
|
|
88
|
-
/* A second department field in the filter row would be the same condition twice. */
|
|
89
|
-
expect(screen).toMatch(/name: 'department',[\s\S]{0,400}?filter: false/)
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
it('★ the folded screens are gone, routes and registrations with them', () => {
|
|
93
|
-
/*
|
|
94
|
-
* Two screens were folded into one each: the by-department employee screen into the employee
|
|
95
|
-
* list, and the department tree with its side editor into the department table, which draws the
|
|
96
|
-
* hierarchy in a tree column and shows what each department is (architect ruling 2026-09-18,
|
|
97
|
-
* user 2026-09-18).
|
|
98
|
-
*/
|
|
99
|
-
for (const gone of [
|
|
100
|
-
'client/pages/employee/employees-by-department.ts',
|
|
101
|
-
'client/pages/department/department-tree-page.ts'
|
|
102
|
-
]) {
|
|
103
|
-
expect([gone, existsSync(path.resolve(__dirname, '..', gone))]).toEqual([gone, false])
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
for (const page of ['employees-by-department', 'department-tree']) {
|
|
107
|
-
expect([page, here('client/route.ts').includes(page)]).toEqual([page, false])
|
|
108
|
-
expect([page, here('things-factory.config.js').includes(page)]).toEqual([page, false])
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
describe('the department table is the department screen', () => {
|
|
114
|
-
const screen = here('client/pages/department/department-list-page.ts')
|
|
115
|
-
|
|
116
|
-
it('★ the hierarchy is a column, so the table can hold what each department is', () => {
|
|
117
|
-
expect(screen).toMatch(/type: 'tree',\s*\n\s*name: 'name'/)
|
|
118
|
-
expect(screen).toMatch(/childrenProperty: 'children'/)
|
|
119
|
-
/* the columns beside the hierarchy - what the folded screen could only show one at a time */
|
|
120
|
-
for (const column of ['controlNo', 'description', 'manager', 'active']) {
|
|
121
|
-
expect([column, screen.includes(`name: '${column}'`)]).toEqual([column, true])
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
it('★ the count is the rows it draws, not the roots it fetched', () => {
|
|
126
|
-
/* departmentRoots counts top level departments; this screen draws each one with its subtree. */
|
|
127
|
-
expect(screen).toMatch(/const countTree = \(list: any\[\]\): number =>/)
|
|
128
|
-
expect(screen).toMatch(/total: countTree\(records\)/)
|
|
129
|
-
})
|
|
130
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The department picker's boxes are headed by the department code, and its popup says what is picked.
|
|
6
|
-
*
|
|
7
|
-
* ox-tree-vertical prints `id-property` as the header of every box. Set to the database id, the picker drew
|
|
8
|
-
* a UUID over each department (09-30, OA). Opened from a grid cell or a filter, the popup was titled
|
|
9
|
-
* "select item".
|
|
10
|
-
*/
|
|
11
|
-
const read = (file: string) => readFileSync(path.resolve(__dirname, '..', file), 'utf-8')
|
|
12
|
-
|
|
13
|
-
describe('the department picker', () => {
|
|
14
|
-
it('heads each box with the department code', () => {
|
|
15
|
-
const source = read('client/component/department-selector.ts')
|
|
16
|
-
const tag = source.slice(source.indexOf('<ox-tree-vertical'), source.indexOf('</ox-tree-vertical>'))
|
|
17
|
-
expect(tag).toMatch(/\sid-property="controlNo"/)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it.each(['client/grist-editor/grist-editor-department-object.ts', 'client/filters-form/ox-filter-department-object.ts'])(
|
|
21
|
-
'%s titles the popup as picking a department',
|
|
22
|
-
file => {
|
|
23
|
-
const source = read(file)
|
|
24
|
-
expect(source.includes("i18next.t('title.select department')")).toBe(true)
|
|
25
|
-
expect(source.includes('title.select_item')).toBe(false)
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
it.each(['en', 'ko', 'ja', 'zh', 'ms', 'es'])('the title is translated in %s', lang => {
|
|
30
|
-
expect(JSON.parse(read(`translations/${lang}.json`))['title.select department']).toBeTruthy()
|
|
31
|
-
})
|
|
32
|
-
})
|