Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: seven <zilisheng1996@gmail.com>
  • Loading branch information
Blankll committed Dec 13, 2024
1 parent 6b60af4 commit c022f26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
16 changes: 9 additions & 7 deletions src/commands/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ export const template = (
const iac = parseYaml(context);

const { template } = generateStackTemplate(stackName, iac, context);

const output =
options.format === TemplateFormat.JSON
? JSON.stringify(template, null, 2)
: yaml.stringify(template);

logger.info(`\n${output}`);
if (typeof template === 'string') {
logger.info(`\n${template}`);

Check warning on line 16 in src/commands/template.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/template.ts#L16

Added line #L16 was not covered by tests
} else {
const output =
options.format === TemplateFormat.JSON
? JSON.stringify(template, null, 2)
: yaml.stringify(template);
logger.info(`\n${output}`);
}
};
12 changes: 6 additions & 6 deletions tests/fixtures/deployFixture.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DatabaseEnum, ServerlessIac } from '../../src/types';
import { DatabaseEnum, Provider, ServerlessIac } from '../../src/types';
import { cloneDeep, set } from 'lodash';

export const oneFcOneGatewayIac = {
service: 'my-demo-service',
version: '0.0.1',
provider: 'aliyun',
provider: 'aliyun' as Provider,
vars: {
region: 'cn-hangzhou',
account_id: 1234567890,
Expand Down Expand Up @@ -239,7 +239,7 @@ export const referredServiceRos = {
export const minimumIac = {
service: 'my-demo-minimum-service',
version: '0.0.1',
provider: 'aliyun',
provider: 'aliyun' as Provider,

functions: [
{
Expand Down Expand Up @@ -272,7 +272,7 @@ export const minimumRos = {
export const oneFcIac = {
service: 'my-demo-service',
version: '0.0.1',
provider: 'aliyun',
provider: 'aliyun' as Provider,
vars: {
region: 'cn-hangzhou',
account_id: 1234567890,
Expand Down Expand Up @@ -340,7 +340,7 @@ export const oneFcRos = {
export const oneFcIacWithStage = {
service: 'my-demo-service',
version: '0.0.1',
provider: 'aliyun',
provider: 'aliyun' as Provider,
vars: {
region: 'cn-hangzhou',
account_id: 1234567890,
Expand Down Expand Up @@ -751,7 +751,7 @@ export const defaultContext = {
export const esServerlessMinimumIac: ServerlessIac = {
service: 'my-demo-es-serverless-service',
version: '0.0.1',
provider: 'aliyun',
provider: 'aliyun' as Provider as Provider,
databases: [
{
key: 'insight_es_db_test',
Expand Down

0 comments on commit c022f26

Please sign in to comment.