Skip to content

Commit 562d807

Browse files
committed
ok, that's enough, now it's time to actually write the tests
1 parent 5670d3e commit 562d807

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

epicshop/fix.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function relativeToWorkshopRoot(dir) {
4848
}
4949

5050
await updatePkgNames()
51+
await copyTestFiles()
5152

5253
async function updatePkgNames() {
5354
for (const file of appsWithPkgJson) {
@@ -64,6 +65,26 @@ async function updatePkgNames() {
6465
}
6566
}
6667

68+
async function copyTestFiles() {
69+
for (const app of exerciseApps) {
70+
if (app.includes('problem')) {
71+
const solutionApp = app.replace('problem', 'solution')
72+
const testDir = path.join(solutionApp, 'tests')
73+
const destTestDir = path.join(app, 'tests')
74+
75+
if (exists(testDir)) {
76+
// Remove existing test directory in problem app if it exists
77+
if (exists(destTestDir)) {
78+
await fs.promises.rm(destTestDir, { recursive: true, force: true })
79+
}
80+
81+
// Copy the entire test directory from solution to problem
82+
await fs.promises.cp(testDir, destTestDir, { recursive: true })
83+
}
84+
}
85+
}
86+
}
87+
6788
async function writeIfNeeded(filepath, content) {
6889
const oldContent = await fs.promises.readFile(filepath, 'utf8')
6990
if (oldContent !== content) {

0 commit comments

Comments
 (0)