mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
890b8f7ea3
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50526 This change wants to automate the rotation of the issue triaging squad on Discord. This is taking us a few minutes every week to rotate the oncall. This change can save us some time. The configuration file format is supposed to be like this: ``` { "userMap": { "discord-username1": "discord-id1", "discord-username2": "discord-id2", "discord-username3": "discord-id3", "discord-username4": "discord-id4" }, "schedule": { "date1": ["discord-username1", "discord-username2"], "date2": ["discord-username3", "discord-username4"], } } ``` ## Changelog [Internal] - Automate the issue triage oncall rotation Reviewed By: cortinico Differential Revision: D72569435 fbshipit-source-id: 435c13350cf503e99302775674e78a20e328e68d
84 lines
2.4 KiB
JavaScript
84 lines
2.4 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
const {extractIssueOncalls} = require('../extractIssueOncalls');
|
|
|
|
const userMap = {
|
|
'@g': '1785',
|
|
'@c': '1781',
|
|
'@s': '1272',
|
|
'@d': '1332',
|
|
'@m': '9555',
|
|
'@p': '6097',
|
|
'@f': '7565',
|
|
};
|
|
|
|
const schedule = {
|
|
'2025-04-01': ['@m', '@f'],
|
|
'2025-04-08': ['@g', '@d'],
|
|
};
|
|
|
|
describe('extractIssueOncalls', () => {
|
|
beforeEach(() => {
|
|
jest.clearAllMocks();
|
|
jest.useFakeTimers('modern');
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.useRealTimers();
|
|
});
|
|
it('extracts m and f on 6 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 6));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@m'], userMap['@f']]);
|
|
});
|
|
|
|
it('extracts m and f on 7 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 7));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@m'], userMap['@f']]);
|
|
});
|
|
|
|
it('extracts g and d on 8 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 8));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
|
});
|
|
|
|
it('extracts g and d on 9 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 9));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
|
});
|
|
|
|
it('extracts g and d on 10 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 10));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
|
});
|
|
|
|
it('extracts g and d on 11 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 11));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
|
});
|
|
|
|
it('extracts g and d on 12 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 12));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
|
});
|
|
|
|
it('extracts g and d on 13 of April', () => {
|
|
jest.setSystemTime(new Date(2025, 3, 13));
|
|
const oncalls = extractIssueOncalls(schedule, userMap);
|
|
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
|
});
|
|
});
|