fix: enable added week deletion and preserve learning concepts when cloning courses
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { strict as assert } from 'node:assert'
|
||||
import { test } from 'node:test'
|
||||
import { createRequire } from 'node:module'
|
||||
|
||||
const { moduleProgress, createModuleProgressParser } = createRequire(import.meta.url)('./moduleProgress.ts') as typeof import('./moduleProgress')
|
||||
|
||||
test('progress parser handles split lines and ignores normal command output', () => {
|
||||
const messages: string[] = []
|
||||
const parse = moduleProgress.run((message) => messages.push(message), createModuleProgressParser)
|
||||
parse('ordinary output\nLMS_MODULE_PRO')
|
||||
parse('GRESS:download\nLMS_MODULE_PROGRESS:load\n')
|
||||
assert.deepEqual(messages, ['download', 'load'])
|
||||
})
|
||||
|
||||
test('concurrent operations retain their own progress callbacks', () => {
|
||||
const first: string[] = []
|
||||
const second: string[] = []
|
||||
const a = moduleProgress.run((message) => first.push(message), createModuleProgressParser)
|
||||
const b = moduleProgress.run((message) => second.push(message), createModuleProgressParser)
|
||||
b('LMS_MODULE_PROGRESS:build\n')
|
||||
a('LMS_MODULE_PROGRESS:download\n')
|
||||
assert.deepEqual(first, ['download'])
|
||||
assert.deepEqual(second, ['build'])
|
||||
})
|
||||
|
||||
test('commands outside a module operation do not report progress', () => {
|
||||
assert.doesNotThrow(() => createModuleProgressParser()('LMS_MODULE_PROGRESS:ignored\n'))
|
||||
})
|
||||
Reference in New Issue
Block a user