Browse Source

Fix test: AbpServiceProxiesController_Tests.GetAllWithMinify

pull/2493/head
Halil İbrahim Kalkan 6 years ago
parent
commit
58f04d34cc
  1. 9
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs
  2. 4
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs

9
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxyScriptController.cs

@ -32,8 +32,13 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
model.Normalize(); model.Normalize();
var script = _proxyScriptManager.GetScript(model.CreateOptions()); var script = _proxyScriptManager.GetScript(model.CreateOptions());
return Content(_options.MinifyGeneratedScript == true ? _javascriptMinifier.Minify(script) : script,
MimeTypes.Application.Javascript); return Content(
_options.MinifyGeneratedScript == true
? _javascriptMinifier.Minify(script)
: script,
MimeTypes.Application.Javascript
);
} }
} }
} }

4
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Shouldly; using Shouldly;
using Xunit; using Xunit;
@ -16,7 +17,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting
[Fact] [Fact]
public async Task GetAllWithMinify() public async Task GetAllWithMinify()
{ {
GetRequiredService<IOptions<AbpAspNetCoreMvcOptions>>().Value.MinifyGeneratedScript = false;
var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript"); var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript");
GetRequiredService<IOptions<AbpAspNetCoreMvcOptions>>().Value.MinifyGeneratedScript = true;
var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true"); var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true");
script.Length.ShouldBeGreaterThan(0); script.Length.ShouldBeGreaterThan(0);

Loading…
Cancel
Save