freeCodeCamp/curriculum/challenges/arabic/06-information-security-and.../advanced-node-and-express/serialization-of-a-user-obj...

1.8 KiB

id title challengeType videoUrl localeTitle
5895f70cf9fc0f352b528e66 Serialization of a User Object 2

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'getUserInput => $.get(getUserInput("url")+ "/_api/server.js") .then(data => { assert.match(data, /passport.serializeUser/gi, "You should have created your passport.serializeUser function"); assert.match(data, /null, user._id/gi, "There should be a callback in your serializeUser with (null, user._id)"); }, xhr => { throw new Error(xhr.statusText); })'
  - text: ''
    testString: 'getUserInput => $.get(getUserInput("url")+ "/_api/server.js") .then(data => { assert.match(data, /passport.deserializeUser/gi, "You should have created your passport.deserializeUser function"); assert.match(data, /null,( |)null/gi, "There should be a callback in your deserializeUser with (null, null) for now"); }, xhr => { throw new Error(xhr.statusText); })'
  - text: ''
    testString: 'getUserInput => $.get(getUserInput("url")+ "/_api/package.json") .then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, "mongodb", "Your project should list "mongodb" as a dependency"); }, xhr => { throw new Error(xhr.statusText); })'
  - text: ''
    testString: 'getUserInput => $.get(getUserInput("url")+ "/_api/server.js") .then(data => { assert.match(data, /require.*("|")mongodb("|")/gi, "You should have required mongodb"); assert.match(data, /new ObjectID.*id/gi, "Even though the block is commented out, you should use new ObjectID(id) for when we add the database"); }, xhr => { throw new Error(xhr.statusText); })'

Challenge Seed

Solution

// solution required