Repository navigation
Expand file tree
/
Copy pathpricing-tests.js
More file actions
58 lines (51 loc) · 1.47 KB
/
Copy pathpricing-tests.js
File metadata and controls
58 lines (51 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* pricing-tests.js
* Comprehensive Unit and Functional Test Suite for Pricing Calculator & Dynamic UI Pane.
* Modular test runner delegating to tests/js/ modular test suites.
* Runs under Node.js or browser console with ZERO external dependencies.
*
* Strict Repo Compliance:
* - Zero emojis.
* - Zero em-dashes (spaced hyphens ' - ' or plain hyphens '-' used).
*/
const PricingCalculator = typeof require !== 'undefined'
? require('./pricing-calculator.js')
: window.PricingCalculator;
// --- AUTHORITATIVE SYNCHRONIZED PRICING FACTS ---
const B_FLAG_PRICE = 1000;
const P_FLAG_PRICE = 1000;
const B_IND_PRICE = 100;
const B_EXTRA_SEAT = 100;
const B_INCLUDED_SEATS = 10;
// --- END AUTHORITATIVE SYNCHRONIZED PRICING FACTS ---
const constants = {
B_FLAG_PRICE,
P_FLAG_PRICE,
B_IND_PRICE,
B_EXTRA_SEAT,
B_INCLUDED_SEATS
};
function runTestSuite() {
if (typeof require !== 'undefined') {
const { runAllModules } = require('./tests/js/runner.js');
return runAllModules(PricingCalculator, constants);
}
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = {
runTestSuite,
constants
};
}
if (typeof require !== 'undefined' && require.main === module) {
const p = runTestSuite();
if (p && typeof p.then === 'function') {
p.then(res => {
if (res && res.failed > 0) process.exit(1);
});
}
}
if (typeof window !== 'undefined') {
window.runPricingTestSuite = runTestSuite;
window.pricingConstants = constants;
}