Download tasks/format-code-task-000025/tests/test.patch from FineEnvs/MiMo-V2.6-RL-harbor-code: direct link, hf CLI and curl.
- Browser
- Download file 3.35 kB
-
https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000025/tests/test.patch
- Command line
-
hf download hf://datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/tasks/format-code-task-000025/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-000025/tests/test.patch
3.35 kB
| diff --git a/test/types/lean.test.ts b/test/types/lean.test.ts | |
| index b6f9e5380..caa572c29 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, UpdateWriteOpResult } from 'mongoose'; | |
| +import { DeleteResult } from 'mongodb'; | |
| import { expectAssignable, expectError, expectType } from 'tsd'; | |
| function gh10345() { | |
| async function gh13345_3() { | |
| const place = await PlaceModel.findOne().lean().orFail().exec(); | |
| expectAssignable<Place>(place); | |
| } | |
| + | |
| +async function gh13345_lean_updateOne() { | |
| + interface IDBUser { | |
| + name: string; | |
| + email: string; | |
| + } | |
| + const UserModel = model<IDBUser>('GH13345UpdateOne', new Schema<IDBUser>({ name: String, email: String })); | |
| + | |
| + const res = await UserModel.updateOne({}, { name: 'foo' }).lean(); | |
| + expectType<UpdateWriteOpResult>(res); | |
| + | |
| + const resMany = await UserModel.updateMany({}, { name: 'foo' }).lean(); | |
| + expectType<UpdateWriteOpResult>(resMany); | |
| +} | |
| + | |
| +async function gh13345_lean_deleteOne() { | |
| + interface IDBUser { | |
| + name: string; | |
| + } | |
| + const UserModel = model<IDBUser>('GH13345DeleteOne', new Schema<IDBUser>({ name: String })); | |
| + | |
| + const res = await UserModel.deleteOne({}).lean(); | |
| + expectType<DeleteResult>(res); | |
| + | |
| + const resMany = await UserModel.deleteMany({}).lean(); | |
| + expectType<DeleteResult>(resMany); | |
| +} | |
| + | |
| +async function gh13345_lean_count() { | |
| + interface IDBUser { | |
| + name: string; | |
| + } | |
| + const UserModel = model<IDBUser>('GH13345Count', new Schema<IDBUser>({ name: String })); | |
| + | |
| + const cnt = await UserModel.count({}).lean(); | |
| + expectType<number>(cnt); | |
| + | |
| + const cntDocs = await UserModel.countDocuments({}).lean(); | |
| + expectType<number>(cntDocs); | |
| + | |
| + const est = await UserModel.estimatedDocumentCount().lean(); | |
| + expectType<number>(est); | |
| +} | |
| + | |
| +async function gh13345_lean_distinct() { | |
| + interface IDBUser { | |
| + name: string; | |
| + } | |
| + const UserModel = model<IDBUser>('GH13345Distinct', new Schema<IDBUser>({ name: String })); | |
| + | |
| + const values = await UserModel.distinct<string>('name').lean(); | |
| + expectType<string[]>(values); | |
| +} | |
| + | |
| +async function gh13345_lean_findOne_preserved() { | |
| + interface IDBUser { | |
| + name: string; | |
| + email: string; | |
| + } | |
| + const UserModel = model<IDBUser>('GH13345FindOne', new Schema<IDBUser>({ name: String, email: String })); | |
| + | |
| + const doc = await UserModel.findOne({}).lean(); | |
| + if (doc) { | |
| + expectType<string>(doc.name); | |
| + expectType<string>(doc.email); | |
| + } | |
| +} | |
| + | |
| +async function gh13345_lean_find_preserved() { | |
| + interface IDBUser { | |
| + name: string; | |
| + } | |
| + const UserModel = model<IDBUser>('GH13345Find', new Schema<IDBUser>({ name: String })); | |
| + | |
| + const docs = await UserModel.find({}).lean(); | |
| + expectType<string>(docs[0].name); | |
| + expectType<Types.ObjectId>(docs[0]._id); | |
| +} | |
| diff --git a/test_commands.json b/test_commands.json | |
| new file mode 100644 | |
| index 000000000..0f7dbefd0 | |
| --- /dev/null | |
| +++ b/test_commands.json | |
| +{ | |
| + "test_commands": ["npx 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 | |
| +npx tsd | |
| +rc=$(( rc | $? )) | |
| +exit $rc | |