Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Valid mongoose schema is required to generate mock #6

Open
issam-seghir opened this issue Feb 13, 2024 · 0 comments
Open

Error: Valid mongoose schema is required to generate mock #6

issam-seghir opened this issue Feb 13, 2024 · 0 comments

Comments

@issam-seghir
Copy link

this is my schema :

const userSchema = new Schema(
	{
		firstName: {
			type: String,
			required: [true, "firstName is required"],
			minlength: [3, "firstName must be at least 3 characters , got {VALUE}"],
			maxlength: [50, "firstName must be at most 50 characters , got {VALUE}"],
			alias: "fname",
		},
		lastName: {
			type: String,
			required: true,
			minlength: 3,
			maxlength: 50,
			alias: "lname",
		},
		email: {
			type: String,
			required: true,
			// minlength: 7,
			unique: true,
		},
		password: {
			type: String,
			required: true,
			alias: "pswd",
		},
		picturePath: {
			type: String,
			default: "",
			alias: "picPath",
		},
		coverPath: {
			type: String,
			default: "",
		},
		totalPosts: {
			type: Number,
			default: 0,
		},
		location: String,
		job: String,
		viewedProfile: {
			type: Number,
			default: 1,
		},
		impressions: {
			type: Number,
			default: 1,
		},
		refreshToken: String,
	},
	{
		timestamps: true,
	}
);

module.exports = mongoose.model("User", userSchema);
const { generateMock } = require("schema-faux");
const User = require("@model/User");

const mockUserFaux = generateMock(User);

console.log(mockUserFaux);

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant