test(bazel): Integration test for Sass support (#28297)

Add .sass files to the integration test for bazel-schematics.

Also addressed Alex's comment in
https://github.com/angular/angular/pull/28167/files#r248149866
about the unit tests being too brittle.

PR Close #28297
This commit is contained in:
Keen Yee Liau
2019-01-17 13:21:31 -08:00
committed by Jason Aden
parent bb94434d85
commit c84739dc55
3 changed files with 6 additions and 20 deletions

View File

@ -91,32 +91,17 @@ describe('Bazel-workspace Schematic', () => {
expect(host.files).toContain('/src/BUILD.bazel');
});
it('should download rules_sass in WORKSPACE', () => {
it('should download and load rules_sass in WORKSPACE', () => {
const content = host.readContent('/WORKSPACE');
expect(content).toContain('RULES_SASS_VERSION');
expect(content).toContain('io_bazel_rules_sass');
});
it('should load sass_repositories in WORKSPACE', () => {
const content = host.readContent('/WORKSPACE');
expect(content).toContain(
'load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")');
expect(content).toContain('sass_repositories()');
});
it('should add sass_binary rules in src/BUILD', () => {
const content = host.readContent('/src/BUILD.bazel');
expect(content).toContain('load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")');
expect(content).toMatch(/sass_binary\((.*\n)+\)/);
});
it('should add SASS targets to assets of ng_module in src/BUILD', () => {
const content = host.readContent('/src/BUILD.bazel');
expect(content).toContain(`
assets = glob([
"**/*.css",
"**/*.html",
]) + [":style_" + x for x in glob(["**/*.scss"])],`);
expect(content).toContain('glob(["**/*.scss"])');
});
});
});