19 lines
907 B
Python
19 lines
907 B
Python
|
|
from pathlib import Path
|
||
|
|
from scripts.install_into_art_design_pro import install
|
||
|
|
|
||
|
|
|
||
|
|
def test_art_route_registration_backup_and_idempotency(tmp_path):
|
||
|
|
fake=tmp_path/'official';routes=fake/'src/router/routes/asyncRoutes.ts'
|
||
|
|
routes.parent.mkdir(parents=True);routes.write_text('export const asyncRoutes: any[] = []\n')
|
||
|
|
(fake/'package.json').write_text('{"name":"art-test"}')
|
||
|
|
install(fake,dry_run=True)
|
||
|
|
assert routes.read_text()=='export const asyncRoutes: any[] = []\n'
|
||
|
|
install(fake,dry_run=False)
|
||
|
|
updated=routes.read_text()
|
||
|
|
assert updated.count('// SITEFORGE_FACTORY_V8_REGISTERED')==1
|
||
|
|
assert 'SiteForgeV8Production' in updated
|
||
|
|
assert (fake/'src/views/siteforge/V8Production.vue').is_file()
|
||
|
|
install(fake,dry_run=False)
|
||
|
|
assert routes.read_text().count('// SITEFORGE_FACTORY_V8_REGISTERED')==1
|
||
|
|
assert (routes.parent/'asyncRoutes.ts.siteforge-backup').exists()
|