Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
test: test kv-namespace config
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuc committed Jul 3, 2019
1 parent d7fbd78 commit 939860d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/commands/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pub mod wranglerjs;

use crate::settings::project::{Project, ProjectType};
use crate::{commands, install};
use std::env;
use std::path::PathBuf;
use std::process::Command;

Expand Down
22 changes: 22 additions & 0 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,28 @@ fn it_builds_with_webpack_wast() {
cleanup(fixture);
}

#[test]
fn it_builds_with_kv_metadata_webpack() {
let fixture = "kv_metadata_webpack";
create_temporary_copy(fixture);

settings! {fixture, r#"
type = "webpack"
[[kv-namespaces]]
binding = "bind"
id = "id"
"#};

build(fixture);
assert!(fixture_out_path(fixture).join("metadata.json").exists());

let metadata = fs::read_to_string(fixture_out_path(fixture).join("metadata.json"))
.expect("could not read metadata");
assert_eq!(metadata, r#"{"body_part":"script","bindings":[{"type":"kv_namespace","name":"bind","namespace_id":"id"}]}"#);
cleanup(fixture);
}

fn cleanup(fixture: &str) {
let path = fixture_path(fixture);
assert!(path.exists(), format!("{:?} does not exist", path));
Expand Down
1 change: 1 addition & 0 deletions tests/kv_metadata_webpack/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
3 changes: 3 additions & 0 deletions tests/kv_metadata_webpack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"main": "./index.js"
}

0 comments on commit 939860d

Please sign in to comment.