Skip to content

Commit

Permalink
Add Aurelia client options test #5987
Browse files Browse the repository at this point in the history
  • Loading branch information
ksm2 committed Jul 9, 2017
1 parent 0cc74a2 commit d04c727
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.swagger.codegen.options;

import com.google.common.collect.ImmutableMap;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.languages.TypeScriptAureliaClientCodegen;

import java.util.Map;

public class TypeScriptAureliaClientOptionsProvider implements OptionsProvider {
public static final String SORT_PARAMS_VALUE = "false";
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
public static final Boolean SUPPORTS_ES6_VALUE = false;
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
private static final String NMP_NAME = "npmName";
private static final String NMP_VERSION = "1.0.0";
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";


@Override
public String getLanguage() {
return "typescript-aurelia";
}

@Override
public Map<String, String> createOptions() {
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
.put(CodegenConstants.SUPPORTS_ES6, String.valueOf(SUPPORTS_ES6_VALUE))
.put(TypeScriptAureliaClientCodegen.NPM_NAME, NMP_NAME)
.put(TypeScriptAureliaClientCodegen.NPM_VERSION, NMP_VERSION)
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
.build();
}

@Override
public boolean isServer() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.swagger.codegen.typescript.aurelia;

import io.swagger.codegen.AbstractOptionsTest;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.languages.TypeScriptFetchClientCodegen;
import io.swagger.codegen.options.TypeScriptAureliaClientOptionsProvider;
import mockit.Expectations;
import mockit.Tested;

public class TypeScriptAureliaClientOptionsTest extends AbstractOptionsTest {

@Tested
private TypeScriptFetchClientCodegen clientCodegen;

public TypeScriptAureliaClientOptionsTest() {
super(new TypeScriptAureliaClientOptionsProvider());
}

@Override
protected CodegenConfig getCodegenConfig() {
return clientCodegen;
}

@SuppressWarnings("unused")
@Override
protected void setExpectations() {
new Expectations(clientCodegen) {{
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.SORT_PARAMS_VALUE));
times = 1;
clientCodegen.setModelPropertyNaming(TypeScriptAureliaClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE);
times = 1;
clientCodegen.setSupportsES6(TypeScriptAureliaClientOptionsProvider.SUPPORTS_ES6_VALUE);
times = 1;
}};
}
}

0 comments on commit d04c727

Please sign in to comment.