Skip to content

Commit

Permalink
Merge pull request #4411 from systeminit/fix(sdf)-Change-the-default-…
Browse files Browse the repository at this point in the history
…schema-variant-code-structure

fix(sdf): Change the default schema variant code structure
  • Loading branch information
stack72 authored Aug 23, 2024
2 parents ef644a2 + 77110ba commit d101949
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/dal/src/schema/variant/authoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ pub enum VariantAuthoringError {
type VariantAuthoringResult<T> = Result<T, VariantAuthoringError>;

const DEFAULT_ASSET_CODE: &str = r#"function main() {
return new AssetBuilder().build()
const asset = new AssetBuilder();
return asset.build();
}"#;

#[derive(Debug, Deserialize, Serialize)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ async fn create_variant(ctx: &mut DalContext) {
);
assert_eq!(Some("main".to_string()), func.handler);
assert_eq!(
Some("function main() {\n return new AssetBuilder().build()\n}".to_string()),
Some(
"function main() {\n const asset = new AssetBuilder();\n return asset.build();\n}"
.to_string()
),
func.code_plaintext().expect("Unable to get code plaintext")
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ async fn save_variant(ctx: &mut DalContext) {
);
assert_eq!(Some("main".to_string()), func.handler);
assert_eq!(
Some("function main() {\n return new AssetBuilder().build()\n}".to_string()),
Some(
"function main() {\n const asset = new AssetBuilder();\n return asset.build();\n}"
.to_string()
),
func.code_plaintext().expect("Unable to get code plaintext")
);

Expand Down

0 comments on commit d101949

Please sign in to comment.