mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: convert c-sharp exam tests to Playwright (#54946)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
const path = require('path');
|
||||
const debug = require('debug');
|
||||
const { MongoClient } = require('mongodb');
|
||||
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
const { MongoClient, ObjectId } = require('mongodb');
|
||||
const {
|
||||
demoUser,
|
||||
blankUser,
|
||||
publicUser,
|
||||
fullyCertifiedUser
|
||||
fullyCertifiedUser,
|
||||
userIds
|
||||
} = require('./user-data');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
@@ -104,13 +106,6 @@ const client = new MongoClient(MONGOHQ_URL, { useNewUrlParser: true });
|
||||
const db = client.db('freecodecamp');
|
||||
const user = db.collection('user');
|
||||
|
||||
const userIds = [
|
||||
new ObjectId('5fa2db00a25c1c1fa49ce067'),
|
||||
new ObjectId('5bd30e0f1caf6ac3ddddddb5'),
|
||||
new ObjectId('5bd30e0f1caf6ac3ddddddb9'),
|
||||
new ObjectId('663b839b24a8b29f57728b13')
|
||||
];
|
||||
|
||||
const dropUserTokens = async function () {
|
||||
await db.collection('UserToken').deleteMany({
|
||||
userId: {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
const path = require('path');
|
||||
const debug = require('debug');
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
const { MongoClient, ObjectId } = require('mongodb');
|
||||
|
||||
const { userIds } = require('./user-data');
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const allowedArgs = ['delete-only'];
|
||||
@@ -81,11 +83,7 @@ const run = async () => {
|
||||
const db = client.db('freecodecamp');
|
||||
const survey = db.collection('Survey');
|
||||
|
||||
await survey.deleteMany({
|
||||
_id: {
|
||||
$in: surveyIds
|
||||
}
|
||||
});
|
||||
await survey.deleteMany({ userId: { $in: userIds } });
|
||||
log('Survey info deleted');
|
||||
|
||||
if (!args.includes('delete-only')) {
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
/* eslint-disable max-len */
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const blankUserId = new ObjectId('5bd30e0f1caf6ac3ddddddb9');
|
||||
const publicUserId = new ObjectId('663b839b24a8b29f57728b13');
|
||||
const demoUserId = new ObjectId('5bd30e0f1caf6ac3ddddddb5');
|
||||
const fullyCertifiedUserId = new ObjectId('5fa2db00a25c1c1fa49ce067');
|
||||
|
||||
const userIds = [blankUserId, publicUserId, demoUserId, fullyCertifiedUserId];
|
||||
|
||||
module.exports = {
|
||||
blankUser: {
|
||||
_id: new ObjectId('5bd30e0f1caf6ac3ddddddb9'),
|
||||
_id: blankUserId,
|
||||
email: 'bar@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
@@ -64,7 +71,7 @@ module.exports = {
|
||||
unsubscribeId: 'ecJxUi7OM49f24hTpauP8'
|
||||
},
|
||||
publicUser: {
|
||||
_id: new ObjectId('663b839b24a8b29f57728b13'),
|
||||
_id: publicUserId,
|
||||
email: 'bar@bars.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
@@ -125,7 +132,7 @@ module.exports = {
|
||||
unsubscribeId: 'ecJxUi7OM49f24hTpauP8'
|
||||
},
|
||||
demoUser: {
|
||||
_id: new ObjectId('5bd30e0f1caf6ac3ddddddb5'),
|
||||
_id: demoUserId,
|
||||
email: 'foo@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
@@ -187,9 +194,8 @@ module.exports = {
|
||||
externalId: '',
|
||||
unsubscribeId: 'ecJxUi7OM49f24hTpauP8'
|
||||
},
|
||||
|
||||
fullyCertifiedUser: {
|
||||
_id: new ObjectId('5fa2db00a25c1c1fa49ce067'),
|
||||
_id: fullyCertifiedUserId,
|
||||
email: 'foo@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
@@ -12253,5 +12259,6 @@ module.exports = {
|
||||
emailVerifyTTL: null,
|
||||
externalId: '',
|
||||
unsubscribeId: 'tBX8stC5jiustPBteF2mV'
|
||||
}
|
||||
},
|
||||
userIds
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user