'use strict'; /** * Renders the Users page and checks the two-column structure: the groups * manager sits in a 25% rail on the left, the users table in the 75% pane on * the right, and the removed security-tips card no longer appears. */ const assert = require('assert'); const fs = require('fs'); const path = require('path'); const ejs = require('ejs'); const root = path.join(__dirname, '..'); function renderUsersPage() { const en = JSON.parse(fs.readFileSync(path.join(root, 'lang', 'en.json'), 'utf8')); const _ = (key) => { const parts = key.split('.'); let node = en; for (const part of parts) node = node && node[part]; return typeof node === 'string' && node ? node : key; }; const viewPath = path.join(root, 'views', 'users.ejs'); return ejs.render(fs.readFileSync(viewPath, 'utf8'), { _, lang: 'en', appName: 'BetterDesk', appDescription: 'test', cacheVersion: 'test', cspNonce: 'nonce', csrfToken: 'csrf', user: { username: 'admin', role: 'admin' }, branding: {}, translations: {}, availableLanguageList: [], currentPage: 'users', shell: 'ux35', embed: true, hasPermission: () => true }, { filename: viewPath }); } describe('Users page layout', () => { let html; beforeAll(() => { html = renderUsersPage(); }); it('drops the security best-practices card', () => { assert.doesNotMatch(html, /security-tips-card/); assert.doesNotMatch(html, /security_tips_title/); }); it('places the groups manager in the left rail', () => { const sidebar = html.match(/