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

add some tests #292

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}