Download tasks/format-code-task-000026/tests/test.patch from FineEnvs/MiMo-V2.6-RL-harbor-code: direct link, hf CLI and curl.
- Browser
- Download file 5.15 kB
-
https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000026/tests/test.patch
- Command line
-
hf download hf://datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/tasks/format-code-task-000026/tests/test.patch
-
curl -L -o test.patch https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000026/tests/test.patch
5.15 kB
| diff --git a/test/types/lean.test.ts b/test/types/lean.test.ts | |
| index 745999d3a..05f34d96f 100644 | |
| --- a/test/types/lean.test.ts | |
| +++ b/test/types/lean.test.ts | |
| -import { Schema, model, Types, InferSchemaType, FlattenMaps } from 'mongoose'; | |
| +import { Schema, model, Types, InferSchemaType, FlattenMaps, Require_id } from 'mongoose'; | |
| import { expectAssignable, expectError, expectType } from 'tsd'; | |
| function gh10345() { | |
| async function gh13382() { | |
| const res = await Test.updateOne({}, { name: 'bar' }).lean(); | |
| expectAssignable<{ matchedCount: number, modifiedCount: number }>(res); | |
| } | |
| + | |
| +async function gh13702_findById_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findById('id', undefined, { lean: true }); | |
| + const b = await UserModel.findById('id').lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| + | |
| + const a2 = await UserModel.findById('id', null, { lean: true }); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a2); | |
| +} | |
| + | |
| +async function gh13702_findById_no_lean_preserves_hydrated() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findById('id'); | |
| + if (a) { | |
| + | |
| + expectAssignable<Function>(a.save); | |
| + } | |
| +} | |
| + | |
| +async function gh13702_findOne_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findOne({}, undefined, { lean: true }); | |
| + const b = await UserModel.findOne({}).lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| + | |
| +async function gh13702_find_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.find({}, undefined, { lean: true }); | |
| + const b = await UserModel.find({}).lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<Array<FlattenMaps<User> & { _id: Types.ObjectId }>>(a); | |
| +} | |
| + | |
| +async function gh13702_findOneAndDelete_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findOneAndDelete({}, { lean: true }); | |
| + const b = await UserModel.findOneAndDelete({}).lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| + | |
| +async function gh13702_findOneAndUpdate_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findOneAndUpdate({}, { name: 'x' }, { lean: true }); | |
| + const b = await UserModel.findOneAndUpdate({}, { name: 'x' }).lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| + | |
| +async function gh13702_findOneAndReplace_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findOneAndReplace({}, { name: 'x' }, { lean: true }); | |
| + const b = await UserModel.findOneAndReplace({}, { name: 'x' }).lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| + | |
| +async function gh13702_findByIdAndDelete_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findByIdAndDelete('id', { lean: true }); | |
| + const b = await UserModel.findByIdAndDelete('id').lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| + | |
| +async function gh13702_findByIdAndRemove_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findByIdAndRemove('id', { lean: true }); | |
| + const b = await UserModel.findByIdAndRemove('id').lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| + | |
| +async function gh13702_findByIdAndUpdate_lean_option() { | |
| + interface User { name: string; } | |
| + const UserModel = model<User>('User', new Schema({ name: String })); | |
| + | |
| + const a = await UserModel.findByIdAndUpdate('id', { name: 'x' }, { lean: true }); | |
| + const b = await UserModel.findByIdAndUpdate('id', { name: 'x' }).lean(); | |
| + expectType<typeof b>(a); | |
| + expectType<(FlattenMaps<User> & { _id: Types.ObjectId }) | null>(a); | |
| +} | |
| diff --git a/test_commands.json b/test_commands.json | |
| new file mode 100644 | |
| index 000000000..8fcadc25d | |
| --- /dev/null | |
| +++ b/test_commands.json | |
| +{ | |
| + "test_commands": ["./node_modules/.bin/tsd"] | |
| +} | |
| diff --git a/mimo_test_command.sh b/mimo_test_command.sh | |
| new file mode 100755 | |
| --- /dev/null | |
| +++ b/mimo_test_command.sh | |
| +#!/usr/bin/env bash | |
| + | |
| +set -uo pipefail | |
| +cd /testbed | |
| +rc=0 | |
| +./node_modules/.bin/tsd | |
| +rc=$(( rc | $? )) | |
| +exit $rc | |