Skip to content

Commit

Permalink
chore: add api key auth unit test for index
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomourar committed Mar 27, 2022
1 parent f60f886 commit 2e8bf5d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ private void testInjects(String filename, String extra) {
// Make sure that the middleware file was written and exports the plugin symbol.
assertThat(manifest.getFileString(CodegenUtils.SOURCE_FOLDER + "/middleware/HttpApiKeyAuth/index.ts").get(),
containsString("export const getHttpApiKeyAuthPlugin"));

// Ensure that the middleware was being exported in the index file.
assertThat(manifest.getFileString(CodegenUtils.SOURCE_FOLDER + "/index.ts").get(),
containsString("from \"./middleware/HttpApiKeyAuth\""));
}

private MockManifest generate(String filename)
Expand Down Expand Up @@ -124,5 +128,9 @@ private void testDoesNotInject(String filename) {
// Make sure that the middleware file was not written.
assertThat(manifest.hasFile(CodegenUtils.SOURCE_FOLDER + "/middleware/HttpApiKeyAuth/index.ts"),
is(false));

// Ensure that the middleware was not being exported in the index file.
assertThat(manifest.getFileString(CodegenUtils.SOURCE_FOLDER + "/index.ts").get(),
not(containsString("from \"./middleware/HttpApiKeyAuth\"")));
}
}

0 comments on commit 2e8bf5d

Please sign in to comment.