use of jenkins.plugins.nodejs.CIBuilderHelper.Verifier in project nodejs-plugin by jenkinsci.
the class NodeJSCommandInterpreterTest method test_creation_of_config.
@Test
public void test_creation_of_config() throws Exception {
Config config = createSetting("my-config-id", "email=foo@acme.com", null);
NodeJSInstallation installation = mockInstaller();
NodeJSCommandInterpreter builder = CIBuilderHelper.createMock("test_creation_of_config", installation, config.id, new Verifier() {
@Override
public void verify(AbstractBuild<?, ?> build, Launcher launcher, TaskListener listener) throws Exception {
EnvVars env = build.getEnvironment(listener);
String var = NodeJSConstants.NPM_USERCONFIG;
String value = env.get(var);
assertTrue("variable " + var + " not set", env.containsKey(var));
assertNotNull("empty value for environment variable " + var, value);
assertTrue("file of variable " + var + " does not exists or is not a file", new File(value).isFile());
}
});
FreeStyleProject job = j.createFreeStyleProject();
job.getBuildersList().add(builder);
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
}
Aggregations