• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

u-wave / core / 20854211080

09 Jan 2026 01:57PM UTC coverage: 85.983% (-0.06%) from 86.039%
20854211080

Pull #742

github

web-flow
Merge 0b0371603 into 904cd9b61
Pull Request #742: Add tests for admin configuration endpoints

1004 of 1199 branches covered (83.74%)

Branch coverage included in aggregate %.

8 of 18 new or added lines in 2 files covered. (44.44%)

1 existing line in 1 file now uncovered.

10547 of 12235 relevant lines covered (86.2%)

100.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

34.21
/src/controllers/server.js
1
import { UnknownConfigError } from '../errors/index.js';
1✔
2
import toItemResponse from '../utils/toItemResponse.js';
1✔
3

1✔
4
/**
1✔
5
 * @type {import('../types.js').Controller}
1✔
6
 */
1✔
7
async function getServerTime(req) {
×
8
  return toItemResponse({
×
9
    time: Date.now(),
×
10
  }, { url: req.fullUrl });
×
11
}
×
12

1✔
13
/**
1✔
14
 * @type {import('../types.js').AuthenticatedController}
1✔
15
 */
1✔
16
async function getAllConfig(req) {
×
17
  const { config } = req.uwave;
×
18
  const includeSchema = 'schema' in req.query;
×
19
  const values = await config.getAllConfig();
×
20

×
21
  return toItemResponse(values, {
×
22
    url: req.fullUrl,
×
23
    meta: includeSchema ? { schema: config.getSchema() } : {},
×
24
  });
×
25
}
×
26

1✔
27
/**
1✔
28
 * @type {import('../types.js').AuthenticatedController}
1✔
29
 */
1✔
30
async function getConfig(req) {
×
31
  const { config } = req.uwave;
×
32
  const { key } = req.params;
×
33
  const includeSchema = 'schema' in req.query;
×
34

×
35
  const values = await config.get(key);
×
36
  const combinedSchema = config.getSchema();
×
37
  const schema = combinedSchema.properties[key];
×
38

×
NEW
39
  if (schema === undefined) {
×
NEW
40
    throw new UnknownConfigError({ key });
×
NEW
41
  }
×
NEW
42

×
43
  return toItemResponse(values ?? {}, {
×
44
    url: req.fullUrl,
×
45
    meta: includeSchema ? { schema } : {},
×
46
  });
×
47
}
×
48

1✔
49
/**
1✔
50
 * @type {import('../types.js').AuthenticatedController}
1✔
51
 */
1✔
52
async function updateConfig(req) {
×
53
  const { config } = req.uwave;
×
54
  const { key } = req.params;
×
55
  const values = req.body;
×
56

×
NEW
57
  const combinedSchema = config.getSchema();
×
NEW
58
  const schema = combinedSchema.properties[key];
×
NEW
59
  if (schema === undefined) {
×
NEW
60
    throw new UnknownConfigError({ key });
×
NEW
61
  }
×
NEW
62

×
63
  await config.set(key, values, { user: req.user });
×
64

×
65
  return toItemResponse({}, {
×
66
    url: req.fullUrl,
×
67
  });
×
68
}
×
69

1✔
70
export {
1✔
71
  getServerTime,
1✔
72
  getAllConfig,
1✔
73
  getConfig,
1✔
74
  updateConfig,
1✔
75
};
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc