chore(board): remove old board tests, update seed + onboarding tests
This commit is contained in:
parent
7707068f36
commit
f3df1945bd
7 changed files with 55 additions and 638 deletions
|
|
@ -5,33 +5,6 @@ import dotenv from 'dotenv'
|
|||
|
||||
dotenv.config()
|
||||
|
||||
const COOPERATIVE_SLUGS = [
|
||||
'governance', 'finance-and-budgeting', 'legal-structures', 'conflict-resolution',
|
||||
'consensus-decision-making', 'revenue-sharing', 'cooperative-bylaws', 'member-onboarding',
|
||||
'democratic-management', 'worker-ownership', 'platform-cooperativism', 'cooperative-marketing',
|
||||
'shared-resources', 'cooperative-funding', 'community-building', 'equity-and-inclusion',
|
||||
'cooperative-tech', 'sustainability', 'collective-bargaining', 'inter-coop-collaboration',
|
||||
]
|
||||
|
||||
const CRAFT_SLUGS = [
|
||||
'game-design', 'programming', 'narrative-design', 'art-and-animation',
|
||||
'audio-and-music', 'production-management', 'qa-and-testing', 'community-management',
|
||||
'marketing-and-comms', 'ux-and-ui-design', 'business-development', 'devops-and-tools',
|
||||
'localization', 'accessibility', 'analytics-and-data', 'education-and-mentoring',
|
||||
]
|
||||
|
||||
const AVATARS = ['disbelieving', 'double-take', 'exasperated', 'mild', 'sweet', 'wtf']
|
||||
const STATES = ['help', 'interested', 'seeking']
|
||||
|
||||
function pick(arr, n) {
|
||||
const shuffled = [...arr].sort(() => Math.random() - 0.5)
|
||||
return shuffled.slice(0, n)
|
||||
}
|
||||
|
||||
function randomState() {
|
||||
return STATES[Math.floor(Math.random() * STATES.length)]
|
||||
}
|
||||
|
||||
const sampleMembers = [
|
||||
{
|
||||
email: 'alex.rivera@pixelcollective.coop',
|
||||
|
|
@ -42,16 +15,7 @@ const sampleMembers = [
|
|||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['game-design', 'production-management', 'business-development'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'help' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'help' },
|
||||
{ tagSlug: 'worker-ownership', state: 'interested' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'help' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'alex.rivera',
|
||||
},
|
||||
board: { slackHandle: 'alex.rivera' },
|
||||
createdAt: new Date('2024-01-15'),
|
||||
lastLogin: new Date('2026-04-10'),
|
||||
},
|
||||
|
|
@ -64,17 +28,7 @@ const sampleMembers = [
|
|||
avatar: 'mild',
|
||||
slackInvited: true,
|
||||
craftTags: ['business-development', 'marketing-and-comms'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'legal-structures', state: 'help' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'help' },
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
{ tagSlug: 'conflict-resolution', state: 'help' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'sam.chen',
|
||||
},
|
||||
board: { slackHandle: 'sam.chen' },
|
||||
createdAt: new Date('2024-02-03'),
|
||||
lastLogin: new Date('2026-04-08'),
|
||||
},
|
||||
|
|
@ -89,16 +43,7 @@ const sampleMembers = [
|
|||
helcimSubscriptionId: 'sub_67890',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'devops-and-tools', 'game-design', 'qa-and-testing'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-tech', state: 'help' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'interested' },
|
||||
{ tagSlug: 'shared-resources', state: 'help' },
|
||||
{ tagSlug: 'democratic-management', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'maria.g',
|
||||
},
|
||||
board: { slackHandle: 'maria.g' },
|
||||
createdAt: new Date('2024-03-10'),
|
||||
lastLogin: new Date('2026-04-12'),
|
||||
},
|
||||
|
|
@ -111,16 +56,7 @@ const sampleMembers = [
|
|||
avatar: 'exasperated',
|
||||
slackInvited: true,
|
||||
craftTags: ['business-development', 'analytics-and-data'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-funding', state: 'help' },
|
||||
{ tagSlug: 'finance-and-budgeting', state: 'help' },
|
||||
{ tagSlug: 'sustainability', state: 'interested' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'david.park',
|
||||
},
|
||||
board: { slackHandle: 'david.park' },
|
||||
createdAt: new Date('2024-04-12'),
|
||||
lastLogin: new Date('2026-04-09'),
|
||||
},
|
||||
|
|
@ -133,15 +69,7 @@ const sampleMembers = [
|
|||
avatar: 'disbelieving',
|
||||
slackInvited: true,
|
||||
craftTags: ['education-and-mentoring', 'community-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-funding', state: 'help' },
|
||||
{ tagSlug: 'community-building', state: 'help' },
|
||||
{ tagSlug: 'member-onboarding', state: 'interested' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'help' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
board: {},
|
||||
createdAt: new Date('2024-05-08'),
|
||||
lastLogin: new Date('2026-04-05'),
|
||||
},
|
||||
|
|
@ -154,15 +82,7 @@ const sampleMembers = [
|
|||
avatar: 'wtf',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'game-design', 'audio-and-music'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'worker-ownership', state: 'seeking' },
|
||||
{ tagSlug: 'governance', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-tech', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'jordan.lee',
|
||||
},
|
||||
board: { slackHandle: 'jordan.lee' },
|
||||
createdAt: new Date('2024-06-20'),
|
||||
lastLogin: new Date('2026-04-07'),
|
||||
},
|
||||
|
|
@ -175,14 +95,7 @@ const sampleMembers = [
|
|||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['art-and-animation', 'ux-and-ui-design', 'accessibility'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
{ tagSlug: 'community-building', state: 'seeking' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
board: {},
|
||||
createdAt: new Date('2024-07-15'),
|
||||
lastLogin: new Date('2026-04-01'),
|
||||
},
|
||||
|
|
@ -196,17 +109,7 @@ const sampleMembers = [
|
|||
helcimCustomerId: 'cust_54321',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'devops-and-tools', 'production-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-tech', state: 'help' },
|
||||
{ tagSlug: 'shared-resources', state: 'help' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'help' },
|
||||
{ tagSlug: 'democratic-management', state: 'interested' },
|
||||
{ tagSlug: 'inter-coop-collaboration', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'casey.w',
|
||||
},
|
||||
board: { slackHandle: 'casey.w' },
|
||||
createdAt: new Date('2024-08-01'),
|
||||
lastLogin: new Date('2026-04-11'),
|
||||
},
|
||||
|
|
@ -219,14 +122,7 @@ const sampleMembers = [
|
|||
avatar: 'double-take',
|
||||
slackInvited: false,
|
||||
craftTags: ['narrative-design', 'localization'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'community-building', state: 'interested' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
{ tagSlug: 'member-onboarding', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
board: {},
|
||||
createdAt: new Date('2024-08-15'),
|
||||
lastLogin: new Date('2026-03-28'),
|
||||
},
|
||||
|
|
@ -241,18 +137,7 @@ const sampleMembers = [
|
|||
helcimSubscriptionId: 'sub_13579',
|
||||
slackInvited: true,
|
||||
craftTags: ['game-design', 'production-management', 'marketing-and-comms', 'business-development'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'help' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'help' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'help' },
|
||||
{ tagSlug: 'worker-ownership', state: 'help' },
|
||||
{ tagSlug: 'collective-bargaining', state: 'interested' },
|
||||
{ tagSlug: 'inter-coop-collaboration', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'morgan.d',
|
||||
},
|
||||
board: { slackHandle: 'morgan.d' },
|
||||
createdAt: new Date('2024-09-01'),
|
||||
lastLogin: new Date('2026-04-13'),
|
||||
},
|
||||
|
|
@ -265,14 +150,7 @@ const sampleMembers = [
|
|||
avatar: 'disbelieving',
|
||||
slackInvited: false,
|
||||
craftTags: ['programming', 'qa-and-testing'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-tech', state: 'seeking' },
|
||||
{ tagSlug: 'worker-ownership', state: 'seeking' },
|
||||
{ tagSlug: 'sustainability', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
board: {},
|
||||
createdAt: new Date('2024-10-10'),
|
||||
lastLogin: new Date('2026-03-20'),
|
||||
},
|
||||
|
|
@ -285,17 +163,7 @@ const sampleMembers = [
|
|||
avatar: 'wtf',
|
||||
slackInvited: true,
|
||||
craftTags: ['community-management', 'education-and-mentoring', 'marketing-and-comms'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-marketing', state: 'help' },
|
||||
{ tagSlug: 'community-building', state: 'help' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'help' },
|
||||
{ tagSlug: 'member-onboarding', state: 'help' },
|
||||
{ tagSlug: 'conflict-resolution', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'phoenix.m',
|
||||
},
|
||||
board: { slackHandle: 'phoenix.m' },
|
||||
createdAt: new Date('2024-11-05'),
|
||||
lastLogin: new Date('2026-04-06'),
|
||||
},
|
||||
|
|
@ -308,16 +176,7 @@ const sampleMembers = [
|
|||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['narrative-design', 'accessibility', 'education-and-mentoring'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
{ tagSlug: 'sustainability', state: 'seeking' },
|
||||
{ tagSlug: 'community-building', state: 'interested' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'sage.a',
|
||||
},
|
||||
board: { slackHandle: 'sage.a' },
|
||||
createdAt: new Date('2024-12-01'),
|
||||
lastLogin: new Date('2026-04-02'),
|
||||
},
|
||||
|
|
@ -330,17 +189,7 @@ const sampleMembers = [
|
|||
avatar: 'mild',
|
||||
slackInvited: true,
|
||||
craftTags: ['game-design', 'art-and-animation', 'audio-and-music'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
{ tagSlug: 'finance-and-budgeting', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'seeking' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'interested' },
|
||||
{ tagSlug: 'democratic-management', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'dakota.w',
|
||||
},
|
||||
board: { slackHandle: 'dakota.w' },
|
||||
createdAt: new Date('2025-01-10'),
|
||||
lastLogin: new Date('2026-04-10'),
|
||||
},
|
||||
|
|
@ -355,17 +204,7 @@ const sampleMembers = [
|
|||
helcimSubscriptionId: 'sub_22222',
|
||||
slackInvited: true,
|
||||
craftTags: ['business-development', 'analytics-and-data', 'production-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'finance-and-budgeting', state: 'help' },
|
||||
{ tagSlug: 'cooperative-funding', state: 'help' },
|
||||
{ tagSlug: 'collective-bargaining', state: 'help' },
|
||||
{ tagSlug: 'sustainability', state: 'help' },
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'charlie.t',
|
||||
},
|
||||
board: { slackHandle: 'charlie.t' },
|
||||
createdAt: new Date('2025-02-14'),
|
||||
lastLogin: new Date('2026-04-12'),
|
||||
},
|
||||
|
|
@ -379,16 +218,7 @@ const sampleMembers = [
|
|||
avatar: 'exasperated',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'game-design', 'devops-and-tools'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'worker-ownership', state: 'help' },
|
||||
{ tagSlug: 'cooperative-tech', state: 'help' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'help' },
|
||||
{ tagSlug: 'shared-resources', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'robin.n',
|
||||
},
|
||||
board: { slackHandle: 'robin.n' },
|
||||
createdAt: new Date('2025-03-01'),
|
||||
lastLogin: new Date('2026-04-13'),
|
||||
},
|
||||
|
|
@ -401,16 +231,7 @@ const sampleMembers = [
|
|||
avatar: 'wtf',
|
||||
slackInvited: true,
|
||||
craftTags: ['art-and-animation', 'community-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'help' },
|
||||
{ tagSlug: 'conflict-resolution', state: 'interested' },
|
||||
{ tagSlug: 'community-building', state: 'help' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'emery.o',
|
||||
},
|
||||
board: { slackHandle: 'emery.o' },
|
||||
createdAt: new Date('2025-03-15'),
|
||||
lastLogin: new Date('2026-04-11'),
|
||||
},
|
||||
|
|
@ -423,17 +244,7 @@ const sampleMembers = [
|
|||
avatar: 'disbelieving',
|
||||
slackInvited: true,
|
||||
craftTags: ['production-management', 'business-development', 'education-and-mentoring'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'help' },
|
||||
{ tagSlug: 'democratic-management', state: 'help' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'interested' },
|
||||
{ tagSlug: 'member-onboarding', state: 'help' },
|
||||
{ tagSlug: 'inter-coop-collaboration', state: 'help' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'quinn.f',
|
||||
},
|
||||
board: { slackHandle: 'quinn.f' },
|
||||
createdAt: new Date('2025-04-01'),
|
||||
lastLogin: new Date('2026-04-14'),
|
||||
},
|
||||
|
|
@ -446,16 +257,7 @@ const sampleMembers = [
|
|||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['ux-and-ui-design', 'accessibility', 'narrative-design'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'platform-cooperativism', state: 'interested' },
|
||||
{ tagSlug: 'cooperative-marketing', state: 'seeking' },
|
||||
{ tagSlug: 'shared-resources', state: 'interested' },
|
||||
{ tagSlug: 'sustainability', state: 'seeking' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
board: {},
|
||||
createdAt: new Date('2025-05-10'),
|
||||
lastLogin: new Date('2026-04-09'),
|
||||
},
|
||||
|
|
@ -468,35 +270,13 @@ const sampleMembers = [
|
|||
avatar: 'mild',
|
||||
slackInvited: true,
|
||||
craftTags: ['audio-and-music', 'localization'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'collective-bargaining', state: 'seeking' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'seeking' },
|
||||
{ tagSlug: 'worker-ownership', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'indigo.r',
|
||||
},
|
||||
board: { slackHandle: 'indigo.r' },
|
||||
createdAt: new Date('2025-06-01'),
|
||||
lastLogin: new Date('2026-04-04'),
|
||||
},
|
||||
]
|
||||
|
||||
// Board topics for the test admin so the logged-in user sees matches
|
||||
const TEST_ADMIN_BOARD = {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
{ tagSlug: 'worker-ownership', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-tech', state: 'interested' },
|
||||
{ tagSlug: 'community-building', state: 'seeking' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-funding', state: 'interested' },
|
||||
{ tagSlug: 'sustainability', state: 'interested' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'test-admin',
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +288,7 @@ async function seedMembers() {
|
|||
await Member.deleteMany({ email: { $ne: 'test-admin@ghostguild.dev' } })
|
||||
console.log('Cleared existing members (kept test admin)')
|
||||
|
||||
// Update test admin with board topics so the Board page shows matches
|
||||
// Update test admin with slack handle + craft tags
|
||||
const adminUpdate = await Member.findOneAndUpdate(
|
||||
{ email: 'test-admin@ghostguild.dev' },
|
||||
{
|
||||
|
|
@ -519,7 +299,7 @@ async function seedMembers() {
|
|||
},
|
||||
)
|
||||
if (adminUpdate) {
|
||||
console.log('Updated test admin with board topics')
|
||||
console.log('Updated test admin with board + craft tags')
|
||||
} else {
|
||||
console.log('Test admin not found — run /api/dev/test-login first to create it')
|
||||
}
|
||||
|
|
@ -539,11 +319,8 @@ async function seedMembers() {
|
|||
console.log('\nBreakdown by circle:')
|
||||
circleBreakdown.forEach((c) => console.log(` ${c._id}: ${c.count}`))
|
||||
|
||||
const withTopics = await Member.countDocuments({ 'board.topics.0': { $exists: true } })
|
||||
console.log(`\nMembers with board topics: ${withTopics}`)
|
||||
|
||||
const withSlack = await Member.countDocuments({ 'board.slackHandle': { $exists: true, $ne: null } })
|
||||
console.log(`Members with slack handles: ${withSlack}`)
|
||||
console.log(`\nMembers with slack handles: ${withSlack}`)
|
||||
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue