'use strict'; const { describe, it } = require('node:test'); const assert = require('node:assert/strict'); const waitlistService = require('./waitlistService'); const Waitlist = require('./waitlistModel'); describe('Waitlist Service and Schema', () => { it('exports all expected service methods', () => { assert.equal(typeof waitlistService.getAll, 'function'); assert.equal(typeof waitlistService.getOne, 'function'); assert.equal(typeof waitlistService.create, 'function'); assert.equal(typeof waitlistService.update, 'function'); assert.equal(typeof waitlistService.assignToClass, 'function'); assert.equal(typeof waitlistService.revert, 'function'); assert.equal(typeof waitlistService.cancel, 'function'); assert.equal(typeof waitlistService.remove, 'function'); assert.equal(typeof waitlistService.getStats, 'function'); }); it('has valid schema paths in Waitlist model', () => { assert.ok(Waitlist.schema.path('user')); assert.ok(Waitlist.schema.path('course')); assert.ok(Waitlist.schema.path('payment')); assert.ok(Waitlist.schema.path('class')); assert.ok(Waitlist.schema.path('status')); assert.ok(Waitlist.schema.path('isDeleted')); assert.ok(Waitlist.schema.path('deletedAt')); const statusPath = Waitlist.schema.path('status'); assert.deepEqual(statusPath.enumValues, ['waiting', 'enrolled', 'cancelled', 'reverted']); assert.equal(statusPath.defaultValue, 'waiting'); }); });