From 6f88a2e898305f9f29176dc94d2f5c22dbaf75d7 Mon Sep 17 00:00:00 2001 From: Dominic Sudy Date: Tue, 11 Jun 2024 10:39:09 +0200 Subject: [PATCH] Fixup tests --- test/system-test/sync.stest.ts | 76 ++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/test/system-test/sync.stest.ts b/test/system-test/sync.stest.ts index c2be74b..ad655b9 100644 --- a/test/system-test/sync.stest.ts +++ b/test/system-test/sync.stest.ts @@ -46,19 +46,57 @@ describe('CLI command', () => { const syncOutput = spawnSync(VELOCITAS_PROCESS, ['sync'], { encoding: DEFAULT_BUFFER_ENCODING }); expect(syncOutput.status).to.equal(0); - const resultOne = spawnSync(`./${fileOneDestination}`, { + const resultOne = readFileSync(`./${fileOneDestination}`, { encoding: DEFAULT_BUFFER_ENCODING, }); - expect(resultOne.stdout).to.contain('projectTest'); - expect(resultOne.stdout).to.contain('packageTestOne'); - expect(resultOne.stdout).to.contain(1); + expect(resultOne).to.equal( + `#!/bin/bash +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 - const resultTwo = spawnSync(`./${fileTwoDestination}`, { +echo projectTest +echo packageTestOne +echo 1 +`, + ); + + const resultTwo = readFileSync(`./${fileTwoDestination}`, { encoding: DEFAULT_BUFFER_ENCODING, }); - expect(resultTwo.stdout).to.contain('projectTest'); - expect(resultTwo.stdout).to.contain('packageTestTwo'); - expect(resultTwo.stdout).to.contain(2); + expect(resultTwo).to.equal( + `#!/bin/bash +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +echo projectTest +echo packageTestTwo +echo 2 +`, + ); const resultThree = readFileSync(`./${fileThreeDestination}`, { encoding: DEFAULT_BUFFER_ENCODING, @@ -68,7 +106,27 @@ describe('CLI command', () => { const resultFour = readFileSync(`./${fileFourDestination}`, { encoding: DEFAULT_BUFFER_ENCODING, }); - expect(resultFour).to.equal('projectTest'); + expect(resultFour).to.equal( + `# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +FROM packageTestTwo + +RUN ls -al +`, + ); }); }); });