This commit is contained in:
1 parent
172c3a5a0e
commit
922d24cac7
5 files changed
+157
-19
No files matched your search
@@ -10,7 +10,7 @@ const context = vm.createContext({
|
||||
sessionStorage: { getItem() { return null; } },
|
||||
localStorage: { getItem() { return null; } }, URL
|
||||
});
|
||||
vm.runInContext(source.replace(/\}\)\(\);\s*$/, 'globalThis.testPage = { normalizeRemotePost, getPostCompanyLabel, normalizeAuthUser }; })();'), context);
|
||||
vm.runInContext(source.replace(/\}\)\(\);\s*$/, 'globalThis.testPage = { normalizeRemotePost, getPostCompanyLabel, normalizeAuthUser, isPostOwner }; })();'), context);
|
||||
const page = context.testPage;
|
||||
|
||||
test('saved organization has priority over email-domain inference in list and detail', () => {
|
||||
@@ -28,3 +28,17 @@ test('server organization has priority over stale browser custom attributes', ()
|
||||
assert.equal(user.company, '서버 회사');
|
||||
assert.equal(user.department, '서버 부서');
|
||||
});
|
||||
|
||||
test('organization changes affect new author information without changing an existing post snapshot', () => {
|
||||
const post = page.normalizeRemotePost({ id: 'fixture', requester_affiliation: '작성 당시 회사', requester_department: '작성 당시 부서' });
|
||||
const currentUser = page.normalizeAuthUser({ company: '전보 후 회사', department: '전보 후 부서' }, {});
|
||||
assert.equal(currentUser.company, '전보 후 회사');
|
||||
assert.equal(page.getPostCompanyLabel(post, currentUser), '작성 당시 회사');
|
||||
assert.equal(post.department, '작성 당시 부서');
|
||||
});
|
||||
|
||||
test('own-post filtering follows canonical identity even after company and department change', () => {
|
||||
const user = { requesterId: 'fixture-owner', company: '전보 후 회사', department: '전보 후 부서', name: '동명이인' };
|
||||
assert.equal(page.isPostOwner({ requesterId: 'fixture-owner', company: '이전 회사' }, user), true);
|
||||
assert.equal(page.isPostOwner({ requesterId: 'another-owner', author: '동명이인', company: user.company }, user), false);
|
||||
});
|
||||
Reference in new issue
Block a user