Reorganize test cases
This commit is contained in:
parent
3a745f2b6e
commit
843f545ceb
271 changed files with 236 additions and 245 deletions
45
ts/test-node/util/serverAlerts_test.ts
Normal file
45
ts/test-node/util/serverAlerts_test.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import {
|
||||
getServerAlertToShow,
|
||||
ServerAlert,
|
||||
} from '../../util/handleServerAlerts';
|
||||
import { DAY, MONTH, WEEK } from '../../util/durations';
|
||||
|
||||
describe('serverAlerts', () => {
|
||||
it('should prefer critical alerts', () => {
|
||||
assert.strictEqual(
|
||||
getServerAlertToShow({
|
||||
[ServerAlert.CRITICAL_IDLE_PRIMARY_DEVICE]: {
|
||||
firstReceivedAt: Date.now(),
|
||||
},
|
||||
[ServerAlert.IDLE_PRIMARY_DEVICE]: { firstReceivedAt: Date.now() },
|
||||
}),
|
||||
ServerAlert.CRITICAL_IDLE_PRIMARY_DEVICE
|
||||
);
|
||||
});
|
||||
it('should not show idle device warning if dismissed < 1 week', () => {
|
||||
assert.strictEqual(
|
||||
getServerAlertToShow({
|
||||
[ServerAlert.IDLE_PRIMARY_DEVICE]: {
|
||||
firstReceivedAt: Date.now() - MONTH,
|
||||
dismissedAt: Date.now() - DAY,
|
||||
},
|
||||
}),
|
||||
null
|
||||
);
|
||||
});
|
||||
it('should show idle device warning if dismissed > 1 week', () => {
|
||||
assert.strictEqual(
|
||||
getServerAlertToShow({
|
||||
[ServerAlert.IDLE_PRIMARY_DEVICE]: {
|
||||
firstReceivedAt: Date.now() - MONTH,
|
||||
dismissedAt: Date.now() - WEEK - 1,
|
||||
},
|
||||
}),
|
||||
ServerAlert.IDLE_PRIMARY_DEVICE
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue