refactor: create fixtures module

Prepare for adding a second radically different fixture by creating a
module to hold the different fixtures. When I only had one fixture it
was ok to have the module be a single file.
This commit is contained in:
YetAnotherMinion 2022-01-08 15:58:32 +00:00 committed by nobody
commit 6790eec12c
Signed by: GrocerPublishAgent
GPG key ID: D460CD54A9E3AB86
5 changed files with 5 additions and 14 deletions

View file

@ -1,5 +1,4 @@
use crate::elm;
use crate::fixture;
use crate::reporting::{CompilerError, InterpreterError, Problem, SetupError, TypeError};
use crate::PortableHash;
use deno_core::futures::StreamExt;
@ -19,6 +18,8 @@ use std::time::Instant;
use tokio;
use tracing::{info_span, Instrument};
mod fixtures;
#[derive(Serialize)]
#[serde(tag = "$")]
pub(crate) enum ElmResult<T, E> {
@ -104,7 +105,7 @@ pub(crate) fn exec(
// step 7 create an Elm fixture file to run our function
let span = info_span!("create Elm fixture files");
let timing_guard = span.enter();
let (gen_module_name, source) = fixture::generate(
let (gen_module_name, source) = fixtures::scripting::generate(
source_checksum,
entrypoint.0.module.clone(),
entrypoint.1.clone(),
@ -194,7 +195,7 @@ pub(crate) fn exec(
final_script = final_script
.replace(
"var $author$project$Astrid$Query$execute = function (query) {\n\treturn $author$project$Astrid$Query$dummyExecute;\n};",
include_str!("../fixture/query.js"),
include_str!("fixtures/sql-client-integration.js"),
)
.replace(
"var $author$project$Astrid$Query$fetch = F3(\n\tfunction (sql, parameters, decoder) {\n\t\treturn $author$project$Astrid$Query$Dummy;\n\t});",