Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
[1.3.0] Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sp00m committed Dec 7, 2017
1 parent e44cae2 commit 4958db5
Showing 1 changed file with 12 additions and 42 deletions.
54 changes: 12 additions & 42 deletions test/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,86 +20,56 @@ describe("gulp-watch-sass", () => {
clean()
})

it("should warn when @import is duplicated", () => {

create("a.scss", ["@import 'b.scss';", "@import 'b.scss';"].join("\n"))
create("b.scss", "div { margin: 0; }")

const testWarning = () => {
new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()
}

it("should warn when @import is duplicated", () => {
create("a.scss", ["@import 'b.scss';", "@import 'b.scss';"].join("\n"))
create("b.scss", "div { margin: 0; }")
testWarning()
})

it("should warn when @import is not found", () => {

create("a.scss", "@import 'b.scss';")

new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()

testWarning()
})

it("should warn when @import is ambiguous (SASS vs partial with extension)", () => {

create("a.scss", "@import 'b.scss';")
create("b.scss", "div { margin: 0; }")
create("_b.scss", "div { margin: 0; }")

new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()

testWarning()
})

it("should warn when @import is ambiguous (SASS vs partial without extension)", () => {

create("a.scss", "@import 'b';")
create("b.scss", "div { margin: 0; }")
create("_b.scss", "div { margin: 0; }")

new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()

testWarning()
})

it("should warn when @import is ambiguous (CSS vs partial without extension)", () => {

create("a.scss", "@import 'b';")
create("b.css", "div { margin: 0; }")
create("_b.scss", "div { margin: 0; }")

new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()

testWarning()
})

it("should warn when @import is ambiguous (CSS vs SASS without extension)", () => {

create("a.scss", "@import 'b';")
create("b.css", "div { margin: 0; }")
create("b.scss", "div { margin: 0; }")

new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()

testWarning()
})

it("should warn when @import is ambiguous (CSS vs SASS vs partial without extension)", () => {

create("a.scss", "@import 'b';")
create("b.css", "div { margin: 0; }")
create("b.scss", "div { margin: 0; }")
create("_b.scss", "div { margin: 0; }")

new ImportTree("**/*.scss", { cwd, warn: console.warn }).build()

console.warn.called.should.be.true()

testWarning()
})

})

0 comments on commit 4958db5

Please sign in to comment.