@casual-simulation/aux-common
Version:
Common library for AUX projects
51 lines • 1.92 kB
JavaScript
/* CasualOS is a set of web-based tools designed to facilitate the creation of real-time, multi-user, context-aware interactive experiences.
*
* Copyright (c) 2019-2025 Casual Simulation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { DateTime } from 'luxon';
import { Rotation, Vector2, Vector3 } from '../math';
export function wait(ms) {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, ms);
});
}
export async function waitAsync(num = 10) {
return new Promise((resolve) => jest.requireActual('timers').setImmediate(resolve));
}
export const customDataTypeCases = [
[
'DateTime',
DateTime.utc(1999, 11, 19, 5, 42, 8),
'📅1999-11-19T05:42:08Z',
],
['Vector2', new Vector2(1, 2), '➡️1,2'],
['Vector3', new Vector3(1, 2, 3), '➡️1,2,3'],
['Rotation', new Rotation(), '🔁0,0,0,1'],
];
export const allDataTypeCases = [
...customDataTypeCases,
['Number', 123, 123],
['true', true, true],
['false', false, false],
['String', 'abc', 'abc'],
['Infinity', Infinity, Infinity],
['-Infinity', -Infinity, -Infinity],
['Object', { abc: 'def' }, { abc: 'def' }],
['Array', [1, 2, 3], [1, 2, 3]],
];
//# sourceMappingURL=TestHelpers.js.map