tests copy the demo app as git has it: the example's gitignored .storebound/, renders, frames and video of a local checkout stay out of the temp copy (edit.test.ts failed on a local .storebound/, the boot check's store art case opened a local ios69 render instead of its pulled Play shot)
This commit is contained in:
parent
658807b219
commit
1f27bfbeed
2 changed files with 13 additions and 3 deletions
|
|
@ -243,7 +243,8 @@ describe('planEdits: old -> new, the diff per file, the checks', () => {
|
|||
describe('CLI: storebound edit on a copy of the demo app', () => {
|
||||
const copy = (): string => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'sb-edit-'));
|
||||
cpSync(join(ROOT, 'examples', 'demo-app'), dir, { recursive: true });
|
||||
// only the tracked example: the gitignored .storebound/, renders, frames and video of a local checkout stay out
|
||||
cpSync(join(ROOT, 'examples', 'demo-app'), dir, { recursive: true, filter: (src) => !/(^|[\\/])(\.storebound|renders|frames|video)([\\/]|$)/.test(src.slice(join(ROOT, 'examples', 'demo-app').length)) });
|
||||
return dir;
|
||||
};
|
||||
test('--show lists what the editors show', async () => {
|
||||
|
|
|
|||
|
|
@ -862,7 +862,7 @@ async function runEditorCase(browser: Browser, sidecar: Sidecar): Promise<CaseRe
|
|||
const unmocked = new Set<string>();
|
||||
const logged: string[] = [];
|
||||
const dir = mkdtempSync(join(tmpdir(), 'sb-boot-editor-'));
|
||||
cpSync(join(EXAMPLES, 'demo-app'), dir, { recursive: true });
|
||||
copyExample('demo-app', dir);
|
||||
const appstore = join(dir, 'store', 'appstore.md');
|
||||
const before = { md: readFileSync(appstore, 'utf8'), cfg: readFileSync(join(dir, 'storebound.config.ts'), 'utf8') };
|
||||
const fx = loadFixture('empty');
|
||||
|
|
@ -991,6 +991,15 @@ const ART_PULL_DRY = 'add store/renders/en/ios69/ 2 files (01.png .. 02.pn
|
|||
/** A 1x1 PNG as the thumbnail art.thumb answers. */
|
||||
const THUMB = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNgYGAAAAAEAAH2FzhVAAAAAElFTkSuQmCC';
|
||||
|
||||
/** Copies an example as git has it: the example's own .gitignore entries (a local .storebound/, renders, frames) stay
|
||||
* out, so a checkout with generated files behaves like CI's clean one. */
|
||||
function copyExample(name: string, dir: string): void {
|
||||
const src = join(EXAMPLES, name);
|
||||
const ignored = (existsSync(join(src, '.gitignore')) ? readFileSync(join(src, '.gitignore'), 'utf8') : '')
|
||||
.split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#')).map(l => l.replace(/^\/|\/$/g, ''));
|
||||
cpSync(src, dir, { recursive: true, filter: f => { const rel = f.slice(src.length + 1).split('\\').join('/'); return !ignored.some(i => rel === i || rel.startsWith(`${i}/`)); } });
|
||||
}
|
||||
|
||||
/**
|
||||
* The Store art tab of an app folder with pulled art: the live store art (art.live, canned) draws its thumbnails
|
||||
* (art.thumb data: URLs) with same / differs / not pulled per image, "Pull from stores" goes through the confirm dialog
|
||||
|
|
@ -1008,7 +1017,7 @@ async function runLiveArtCase(browser: Browser, sidecar: Sidecar): Promise<CaseR
|
|||
const unmocked = new Set<string>();
|
||||
const logged: string[] = [];
|
||||
const dir = mkdtempSync(join(tmpdir(), 'sb-boot-art-'));
|
||||
cpSync(join(EXAMPLES, 'demo-app'), dir, { recursive: true });
|
||||
copyExample('demo-app', dir);
|
||||
// a pulled Play screenshot in the renders folder (a real PNG, so the gallery and the replace dry run read it)
|
||||
const { encodePng } = await import('../tests/build-fixtures');
|
||||
const shot = encodePng(540, 960, () => [40, 120, 200], { colorType: 2 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue