-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP add failing tests for issue #32 (but I am failing to do it correc…
…tly at the moment...)
- Loading branch information
1 parent
2d68556
commit 2b05254
Showing
3 changed files
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
view: bad_view { | ||
dimension: foo { | ||
sql: TRUE ;; | ||
html: | ||
{% if linkback_type._parameter_value == "Client" %} | ||
<p>Thank you for logging in!</p> | ||
<p><a href="https://<redacted>/client/{{ client_id._parameter_value | replace:'$','-' }}">Return to dashboard</a></p> | ||
{% endif %} | ||
;; | ||
} | ||
} |
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,47 @@ | ||
const lams = require('../../../index.js') | ||
const mocks = require('../../../lib/mocks.js') | ||
const path= require('path') | ||
const options = {reporting:"no", cwd:__dirname, onParserError:"fail"} | ||
require('../../../lib/expect-to-contain-message'); | ||
const log = x=>console.log(x) | ||
const testProjectName = __dirname.split(path.sep).slice(-1)[0]; | ||
|
||
describe('Projects', () => { | ||
describe(testProjectName, () => { | ||
let {spies, process, console} = mocks() | ||
let messages | ||
beforeAll( async () => { | ||
messages = await lams(options,{process, console}) | ||
log(messages)//.filter(m=>m.rule=="F1")) | ||
}) | ||
it("bad.model should error on rule F1", ()=> { | ||
expect(console.error).not.toHaveBeenCalled(); | ||
expect(process.exit).not.toHaveBeenCalled(); | ||
expect({messages}).toContainMessage({ | ||
rule: "F1", | ||
level: "error", | ||
location: "model:bad/view:bad_view/dimension:foo" | ||
}); | ||
}); | ||
it("ok.model should not error/warn on rule F1", ()=> { | ||
|
||
expect(console.error).not.toHaveBeenCalled(); | ||
expect(process.exit).not.toHaveBeenCalled(); | ||
// expect({messages}).toContainMessage({ | ||
// rule: "F1", | ||
// level: "info", | ||
// location: "model:ok/view:ok_view/dimension:foo" | ||
// }); | ||
expect({messages}).not.toContainMessage({ | ||
rule: "F1", | ||
level: "error", | ||
location: "model:ok/view:ok_view/dimension:foo" | ||
}); | ||
expect({messages}).not.toContainMessage({ | ||
rule: "F1", | ||
level: "warning", | ||
location: "model:ok/view:ok_view/dimension:foo" | ||
}); | ||
}); | ||
}); | ||
}); |
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,11 @@ | ||
view: ok_view { | ||
dimension: foo { | ||
sql: ${actual.cross_view_reference} ;; | ||
html: | ||
{% if linkback_type._parameter_value == "Client" %} | ||
<p>Thank you for logging in!</p> | ||
<p><a href="https://<redacted>/client/{{ client_id._parameter_value | replace:'$','-' }}">Return to dashboard</a></p> | ||
{% endif %} | ||
;; | ||
} | ||
} |