-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from embroider-build/combine-tests
Simplify testing situation to assure import and require works
- Loading branch information
Showing
4 changed files
with
92 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const chai = require("chai"); | ||
const { codeEquality } = require("code-equality-assertions/chai"); | ||
|
||
chai.use(codeEquality); | ||
|
||
const { expect } = chai; | ||
|
||
const { Preprocessor } = require("content-tag"); | ||
|
||
const p = new Preprocessor(); | ||
|
||
describe("cjs/require", function () { | ||
it("can call process", function () { | ||
let output = p.process("<template>Hi</template>"); | ||
|
||
expect(output).to | ||
.equalCode(`import { template } from "@ember/template-compiler"; | ||
export default template(\`Hi\`, { | ||
eval () { | ||
return eval(arguments[0]); | ||
} | ||
});`); | ||
}); | ||
|
||
it("can call parse", function () { | ||
let output = p.parse("<template>Hello!</template>"); | ||
|
||
expect(output).to.eql([ | ||
{ | ||
type: "expression", | ||
tagName: "template", | ||
contents: "Hello!", | ||
range: { | ||
start: 0, | ||
end: 27, | ||
}, | ||
contentRange: { | ||
start: 10, | ||
end: 16, | ||
}, | ||
startRange: { | ||
end: 10, | ||
start: 0, | ||
}, | ||
endRange: { | ||
start: 16, | ||
end: 27, | ||
}, | ||
}, | ||
]); | ||
}); | ||
}); |