mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
chore(deps): upgrade all dependencies, toolchains and images (#2825)
This commit is contained in:
1 parent
56e04e7b53
commit
3b552e00ef
510 files changed
+23614
-37473
No files matched your search
@@ -31,14 +31,12 @@ describe('voice noise suppression configuration', () => {
|
||||
expect(second).toEqual(DEFAULT_VOICE_NOISE_SUPPRESSION_CONFIG);
|
||||
});
|
||||
|
||||
test.each([
|
||||
{},
|
||||
{enabled: false},
|
||||
{enabled: undefined},
|
||||
{suppression_strength: 42},
|
||||
])('keeps partial updates free of configuration defaults: %j', (patch) => {
|
||||
expect(VoiceNoiseSuppressionConfigUpdateRequest.parse(patch)).toEqual(patch);
|
||||
});
|
||||
test.each([{}, {enabled: false}, {enabled: undefined}, {suppression_strength: 42}])(
|
||||
'keeps partial updates free of configuration defaults: %j',
|
||||
(patch) => {
|
||||
expect(VoiceNoiseSuppressionConfigUpdateRequest.parse(patch)).toEqual(patch);
|
||||
},
|
||||
);
|
||||
|
||||
test('does not accept a client-provided configuration version', () => {
|
||||
expect(VoiceNoiseSuppressionConfigUpdateRequest.parse({config_version: 12})).toEqual({});
|
||||
@@ -371,23 +369,21 @@ describe('resolveVoiceNoiseSuppressionForCall', () => {
|
||||
{allowUserOverride: true, preference: 'gtcrn', expectedBackend: 'rnnoise', expectedSource: 'canary'},
|
||||
{allowUserOverride: false, preference: 'speex', expectedBackend: 'rnnoise', expectedSource: 'canary'},
|
||||
{allowUserOverride: true, preference: null, expectedBackend: 'rnnoise', expectedSource: 'canary'},
|
||||
] as const)('allow_user_override $allowUserOverride with preference $preference resolves to $expectedSource', ({
|
||||
allowUserOverride,
|
||||
preference,
|
||||
expectedBackend,
|
||||
expectedSource,
|
||||
}) => {
|
||||
const assignment = createAssignment({
|
||||
backend: 'rnnoise',
|
||||
source: 'canary',
|
||||
allow_user_override: allowUserOverride,
|
||||
enabled_backends: ['none', 'standard', 'speex', 'rnnoise'],
|
||||
});
|
||||
expect(resolveVoiceNoiseSuppressionForCall(assignment, null, preference)).toMatchObject({
|
||||
backend: expectedBackend,
|
||||
source: expectedSource,
|
||||
});
|
||||
});
|
||||
] as const)(
|
||||
'allow_user_override $allowUserOverride with preference $preference resolves to $expectedSource',
|
||||
({allowUserOverride, preference, expectedBackend, expectedSource}) => {
|
||||
const assignment = createAssignment({
|
||||
backend: 'rnnoise',
|
||||
source: 'canary',
|
||||
allow_user_override: allowUserOverride,
|
||||
enabled_backends: ['none', 'standard', 'speex', 'rnnoise'],
|
||||
});
|
||||
expect(resolveVoiceNoiseSuppressionForCall(assignment, null, preference)).toMatchObject({
|
||||
backend: expectedBackend,
|
||||
source: expectedSource,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
test('a user override also outranks a guild rule', () => {
|
||||
const assignment = createAssignment({
|
||||
|
||||
@@ -96,20 +96,17 @@ describe('TemplateChannel permission overwrites', () => {
|
||||
expect(channel.permission_overwrites).toEqual([{id: '2', type: expected, allow: '8', deny: '0'}]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'invalid',
|
||||
'NaN',
|
||||
'Infinity',
|
||||
Number.NaN,
|
||||
Number.POSITIVE_INFINITY,
|
||||
])('rejects nonfinite overwrite type %j', (type) => {
|
||||
expect(
|
||||
TemplateChannel.safeParse({
|
||||
id: '1',
|
||||
type: 0,
|
||||
position: 0,
|
||||
permission_overwrites: [{id: '2', type, allow: '8', deny: '0'}],
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
it.each(['invalid', 'NaN', 'Infinity', Number.NaN, Number.POSITIVE_INFINITY])(
|
||||
'rejects nonfinite overwrite type %j',
|
||||
(type) => {
|
||||
expect(
|
||||
TemplateChannel.safeParse({
|
||||
id: '1',
|
||||
type: 0,
|
||||
position: 0,
|
||||
permission_overwrites: [{id: '2', type, allow: '8', deny: '0'}],
|
||||
}).success,
|
||||
).toBe(false);
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -10,17 +10,14 @@ describe('jobs schemas', () => {
|
||||
expect(JobLedgerEntrySchema.shape.status.safeParse('failed').success).toBe(false);
|
||||
});
|
||||
|
||||
test.each([
|
||||
'queued',
|
||||
'running',
|
||||
'succeeded',
|
||||
'cancelled',
|
||||
'deadletter',
|
||||
])('accepts ledger status %s across query, request, and response', (status) => {
|
||||
expect(ListJobsQuery.parse({status}).status).toBe(status);
|
||||
expect(ListJobsRequest.parse({status}).status).toBe(status);
|
||||
expect(JobLedgerEntrySchema.shape.status.parse(status)).toBe(status);
|
||||
});
|
||||
test.each(['queued', 'running', 'succeeded', 'cancelled', 'deadletter'])(
|
||||
'accepts ledger status %s across query, request, and response',
|
||||
(status) => {
|
||||
expect(ListJobsQuery.parse({status}).status).toBe(status);
|
||||
expect(ListJobsRequest.parse({status}).status).toBe(status);
|
||||
expect(JobLedgerEntrySchema.shape.status.parse(status)).toBe(status);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('job pagination cursor', () => {
|
||||
@@ -34,16 +31,15 @@ describe('job pagination cursor', () => {
|
||||
expect(ListJobsQuery.parse(cursor)).toEqual({...cursor, limit: 50, max_lookback_days: 14});
|
||||
});
|
||||
|
||||
test.each([
|
||||
'cursor_bucket_day',
|
||||
'cursor_created_at',
|
||||
'cursor_job_id',
|
||||
] as const)('rejects a cursor missing %s', (field) => {
|
||||
expect(ListJobsQuery.safeParse({...cursor, [field]: undefined})).toMatchObject({
|
||||
success: false,
|
||||
error: {issues: [{path: [field]}]},
|
||||
});
|
||||
});
|
||||
test.each(['cursor_bucket_day', 'cursor_created_at', 'cursor_job_id'] as const)(
|
||||
'rejects a cursor missing %s',
|
||||
(field) => {
|
||||
expect(ListJobsQuery.safeParse({...cursor, [field]: undefined})).toMatchObject({
|
||||
success: false,
|
||||
error: {issues: [{path: [field]}]},
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
test.each([
|
||||
{cursor_bucket_day: '2023-02-29'},
|
||||
|
||||
@@ -18,16 +18,12 @@ describe('MessageNonceRequest', () => {
|
||||
expect(MessageNonceRequest.parse(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
-1,
|
||||
0.5,
|
||||
Number.MAX_SAFE_INTEGER + 1,
|
||||
Number.POSITIVE_INFINITY,
|
||||
'',
|
||||
'a'.repeat(33),
|
||||
])('rejects invalid nonce %j', (input) => {
|
||||
expect(MessageNonceRequest.safeParse(input).success).toBe(false);
|
||||
});
|
||||
it.each([-1, 0.5, Number.MAX_SAFE_INTEGER + 1, Number.POSITIVE_INFINITY, '', 'a'.repeat(33)])(
|
||||
'rejects invalid nonce %j',
|
||||
(input) => {
|
||||
expect(MessageNonceRequest.safeParse(input).success).toBe(false);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('MessageRequestSchema', () => {
|
||||
|
||||
@@ -137,14 +137,12 @@ describe('application redirect policies', () => {
|
||||
])('accepts registered URI %s', (uri) => {
|
||||
expect(ApplicationCreateRequest.parse({name: 'Application', redirect_uris: [uri]}).redirect_uris).toEqual([uri]);
|
||||
});
|
||||
it.each([
|
||||
'http://example.com/callback',
|
||||
'https://',
|
||||
'/relative',
|
||||
'ftp://example.com/callback',
|
||||
])('rejects registered URI %s', (uri) => {
|
||||
expect(ApplicationCreateRequest.safeParse({name: 'Application', redirect_uris: [uri]}).success).toBe(false);
|
||||
});
|
||||
it.each(['http://example.com/callback', 'https://', '/relative', 'ftp://example.com/callback'])(
|
||||
'rejects registered URI %s',
|
||||
(uri) => {
|
||||
expect(ApplicationCreateRequest.safeParse({name: 'Application', redirect_uris: [uri]}).success).toBe(false);
|
||||
},
|
||||
);
|
||||
it('defaults missing create URIs but does not clear missing update URIs', () => {
|
||||
expect(ApplicationCreateRequest.parse({name: 'Application'})).toEqual({name: 'Application', redirect_uris: []});
|
||||
expect(ApplicationUpdateRequest.parse({})).toEqual({});
|
||||
|
||||
@@ -71,13 +71,12 @@ describe.each([
|
||||
{name: 'update body', schema: UpdateVoiceServerRequestBody, required: {}},
|
||||
{name: 'update service request', schema: UpdateVoiceServerRequest, required: {region_id: 'eu', server_id: 'primary'}},
|
||||
])('$name coordinates', ({schema, required}) => {
|
||||
it.each([
|
||||
{},
|
||||
{latitude: 0, longitude: 0},
|
||||
{latitude: null, longitude: null},
|
||||
])('accepts the paired state %j', (coordinates) => {
|
||||
expect(schema.parse({...required, ...coordinates})).toMatchObject(coordinates);
|
||||
});
|
||||
it.each([{}, {latitude: 0, longitude: 0}, {latitude: null, longitude: null}])(
|
||||
'accepts the paired state %j',
|
||||
(coordinates) => {
|
||||
expect(schema.parse({...required, ...coordinates})).toMatchObject(coordinates);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
{latitude: 0},
|
||||
@@ -163,15 +162,13 @@ describe.each([
|
||||
expect(schema.parse({})).toEqual(bulkDeleteDefaults);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'include_dms',
|
||||
'include_dms_closed',
|
||||
'include_group_dms',
|
||||
'include_guilds',
|
||||
] as const)('accepts %s as the only selected context', (field) => {
|
||||
const selection = {...noSelectedContexts, [field]: true};
|
||||
expect(schema.parse(selection)).toEqual({...bulkDeleteDefaults, ...selection});
|
||||
});
|
||||
it.each(['include_dms', 'include_dms_closed', 'include_group_dms', 'include_guilds'] as const)(
|
||||
'accepts %s as the only selected context',
|
||||
(field) => {
|
||||
const selection = {...noSelectedContexts, [field]: true};
|
||||
expect(schema.parse(selection)).toEqual({...bulkDeleteDefaults, ...selection});
|
||||
},
|
||||
);
|
||||
|
||||
it('does not require selected contexts for inaccessible-only scope', () => {
|
||||
const selection = {...noSelectedContexts, scope: 'inaccessible_only'};
|
||||
|
||||
@@ -5,11 +5,12 @@ import {AuditLogActionTypeSchema} from '@fluxer/schema/src/primitives/AuditLogVa
|
||||
import {describe, expect, it} from 'vitest';
|
||||
|
||||
describe('AuditLogActionTypeSchema', () => {
|
||||
it.each(
|
||||
Object.values(AuditLogActionType).filter((value) => typeof value === 'number'),
|
||||
)('accepts registered action %i', (value) => {
|
||||
expect(AuditLogActionTypeSchema.parse(value)).toBe(value);
|
||||
});
|
||||
it.each(Object.values(AuditLogActionType).filter((value) => typeof value === 'number'))(
|
||||
'accepts registered action %i',
|
||||
(value) => {
|
||||
expect(AuditLogActionTypeSchema.parse(value)).toBe(value);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([0, 9, 999, -1, 1.5, '1', 'GUILD_UPDATE', null])('rejects unknown or nonnumeric action %j', (value) => {
|
||||
expect(AuditLogActionTypeSchema.safeParse(value).success).toBe(false);
|
||||
|
||||
@@ -53,21 +53,12 @@ describe('isValidBase64', () => {
|
||||
expect(isValidBase64(input)).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'YQ',
|
||||
'YQ=',
|
||||
'YQ===',
|
||||
'====',
|
||||
'Y=Q=',
|
||||
'YR==',
|
||||
'YWJ=',
|
||||
'YWJ_',
|
||||
'YWJ-',
|
||||
'YW J',
|
||||
'éAAA',
|
||||
])('rejects malformed or noncanonical encoding %j', (input) => {
|
||||
expect(isValidBase64(input)).toBe(false);
|
||||
});
|
||||
it.each(['YQ', 'YQ=', 'YQ===', '====', 'Y=Q=', 'YR==', 'YWJ=', 'YWJ_', 'YWJ-', 'YW J', 'éAAA'])(
|
||||
'rejects malformed or noncanonical encoding %j',
|
||||
(input) => {
|
||||
expect(isValidBase64(input)).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([1, 2, 3, 255, 256])('accepts a byte round trip of length %i', (length) => {
|
||||
const bytes = Buffer.from(Array.from({length}, (_, index) => index % 256));
|
||||
@@ -137,13 +128,13 @@ describe('base64LengthForBytes', () => {
|
||||
expect(base64LengthForBytes(bytes) % 4).toBe(0);
|
||||
});
|
||||
|
||||
it.each([
|
||||
EMOJI_MAX_SIZE,
|
||||
EMOJI_MAX_SIZE + 1,
|
||||
])('accepts %i encoded bytes; decoded-byte limits remain authoritative', (bytes) => {
|
||||
const schema = createBase64StringType(1, base64LengthForBytes(EMOJI_MAX_SIZE));
|
||||
const encoded = Buffer.alloc(bytes, 1).toString('base64');
|
||||
expect(encoded.length).toBe(base64LengthForBytes(EMOJI_MAX_SIZE));
|
||||
expect(schema.parse(encoded)).toBe(encoded);
|
||||
});
|
||||
it.each([EMOJI_MAX_SIZE, EMOJI_MAX_SIZE + 1])(
|
||||
'accepts %i encoded bytes; decoded-byte limits remain authoritative',
|
||||
(bytes) => {
|
||||
const schema = createBase64StringType(1, base64LengthForBytes(EMOJI_MAX_SIZE));
|
||||
const encoded = Buffer.alloc(bytes, 1).toString('base64');
|
||||
expect(encoded.length).toBe(base64LengthForBytes(EMOJI_MAX_SIZE));
|
||||
expect(schema.parse(encoded)).toBe(encoded);
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -50,10 +50,9 @@ it.each([1, 2])('rejects legacy NSFW level %i', (value) => {
|
||||
expect(NSFWLevelSchema.safeParse(value).success).toBe(false);
|
||||
});
|
||||
|
||||
it.each([
|
||||
MessageNotifications.NULL,
|
||||
MessageNotifications.NO_MESSAGES,
|
||||
MessageNotifications.INHERIT,
|
||||
])('rejects channel-only notification setting %i as a guild default', (value) => {
|
||||
expect(DefaultMessageNotificationsSchema.safeParse(value).success).toBe(false);
|
||||
});
|
||||
it.each([MessageNotifications.NULL, MessageNotifications.NO_MESSAGES, MessageNotifications.INHERIT])(
|
||||
'rejects channel-only notification setting %i as a guild default',
|
||||
(value) => {
|
||||
expect(DefaultMessageNotificationsSchema.safeParse(value).success).toBe(false);
|
||||
},
|
||||
);
|
||||
@@ -5,11 +5,12 @@ import {MessageReferenceTypeSchema, MessageTypeSchema} from '@fluxer/schema/src/
|
||||
import {describe, expect, it} from 'vitest';
|
||||
|
||||
describe('MessageTypeSchema', () => {
|
||||
it.each(
|
||||
Object.values(MessageTypes).filter((value) => value !== MessageTypes.CLIENT_SYSTEM),
|
||||
)('accepts wire message type %i', (value) => {
|
||||
expect(MessageTypeSchema.parse(value)).toBe(value);
|
||||
});
|
||||
it.each(Object.values(MessageTypes).filter((value) => value !== MessageTypes.CLIENT_SYSTEM))(
|
||||
'accepts wire message type %i',
|
||||
(value) => {
|
||||
expect(MessageTypeSchema.parse(value)).toBe(value);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([MessageTypes.CLIENT_SYSTEM, 8, -1, 0.5, '0', null])('rejects non-wire message type %j', (value) => {
|
||||
expect(MessageTypeSchema.safeParse(value).success).toBe(false);
|
||||
|
||||
@@ -40,24 +40,15 @@ describe('createQueryIntegerType', () => {
|
||||
expect(schema.parse(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'3.14',
|
||||
'3.0',
|
||||
'42px',
|
||||
'1e2',
|
||||
'0x10',
|
||||
'',
|
||||
' ',
|
||||
'NaN',
|
||||
'Infinity',
|
||||
'-1',
|
||||
'2147483648',
|
||||
])('rejects %j without truncation or coercion', (input) => {
|
||||
expect(schema.safeParse(input)).toMatchObject({
|
||||
success: false,
|
||||
error: {issues: [{message: ValidationErrorCodes.VALUE_MUST_BE_INTEGER_IN_RANGE}]},
|
||||
});
|
||||
});
|
||||
it.each(['3.14', '3.0', '42px', '1e2', '0x10', '', ' ', 'NaN', 'Infinity', '-1', '2147483648'])(
|
||||
'rejects %j without truncation or coercion',
|
||||
(input) => {
|
||||
expect(schema.safeParse(input)).toMatchObject({
|
||||
success: false,
|
||||
error: {issues: [{message: ValidationErrorCodes.VALUE_MUST_BE_INTEGER_IN_RANGE}]},
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it.each(['-5', '5'])('accepts the configured range boundary %s', (input) => {
|
||||
expect(createQueryIntegerType({minValue: -5, maxValue: 5}).parse(input)).toBe(Number(input));
|
||||
|
||||
@@ -64,14 +64,12 @@ describe('Int64Type', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
Number.MAX_SAFE_INTEGER + 1,
|
||||
Number.NaN,
|
||||
Number.POSITIVE_INFINITY,
|
||||
1.5,
|
||||
])('rejects lossy or noninteger numeric input %j', (input) => {
|
||||
expect(Int64Type.safeParse(input).success).toBe(false);
|
||||
});
|
||||
it.each([Number.MAX_SAFE_INTEGER + 1, Number.NaN, Number.POSITIVE_INFINITY, 1.5])(
|
||||
'rejects lossy or noninteger numeric input %j',
|
||||
(input) => {
|
||||
expect(Int64Type.safeParse(input).success).toBe(false);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('Int64StringType', () => {
|
||||
@@ -92,14 +90,12 @@ describe('UnsignedInt64Type', () => {
|
||||
expect(UnsignedInt64Type.parse(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'-1',
|
||||
'+1',
|
||||
'9223372036854775808',
|
||||
'18446744073709551615',
|
||||
])('rejects %s outside unsigned signed-64-bit storage', (input) => {
|
||||
expect(UnsignedInt64Type.safeParse(input).success).toBe(false);
|
||||
});
|
||||
it.each(['-1', '+1', '9223372036854775808', '18446744073709551615'])(
|
||||
'rejects %s outside unsigned signed-64-bit storage',
|
||||
(input) => {
|
||||
expect(UnsignedInt64Type.safeParse(input).success).toBe(false);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('SnowflakeType', () => {
|
||||
|
||||
Reference in new issue
Block a user