Skip to content

Commit 2f31c3a

Browse files
authored
Merge pull request #7863 from gioboa/test/improve-cli-tests
test: improve mergeIntegrationDir tests 🍰
2 parents 8229a89 + 54215ef commit 2f31c3a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/qwik/src/cli/add/update-files.unit.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,18 @@ describe('mergeIntegrationDir', () => {
114114

115115
expect(actualResults).toEqual(expectedResults);
116116

117-
const actualGlobalCssContent = fakeFileUpdates.files.find(
118-
(f) => f.path === `destDir/subDestDir/apps/subpackage/src/global.css`
119-
)?.content;
120-
121-
expect(actualGlobalCssContent).toBe('p{color: red}\n\n/* CSS */\n');
117+
const tests = {
118+
'destDir/subDestDir/apps/subpackage/fake.ts': 'fake file',
119+
'destDir/subDestDir/should-stay-in-root.ts': 'fake file',
120+
'destDir/subDestDir/package.json': '{"name": "fake"}',
121+
'destDir/subDestDir/should-stay/should-also-stay.ts': 'fake file',
122+
'destDir/subDestDir/apps/subpackage/.vscode/settings.json':
123+
'{ \n // Comment Foo\n "css.lint.unknownAtRules": "ignore",\n "name": "John Doe",\n "age": 42\n }\n',
124+
'destDir/subDestDir/apps/subpackage/src/global.css': 'p{color: red}\n\n/* CSS */\n',
125+
};
126+
for (const [fileName, content] of Object.entries(tests)) {
127+
const file = fakeFileUpdates.files.find((f) => f.path === fileName);
128+
expect(file?.content.toString()).toBe(content);
129+
}
122130
});
123131
});

0 commit comments

Comments
 (0)