-
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.
Merge pull request #190 from looker-open-source/manifest-features
Manifest features
- Loading branch information
Showing
21 changed files
with
552 additions
and
58 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
68 changes: 68 additions & 0 deletions
68
__tests__/dummy-projects/29-manifest-loading/defaults/index.test.js
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,68 @@ | ||
let {testName, lams, options, mocks} = require('../../../../lib/test-commons.js')(__dirname,{dirnameOffset:-2}) | ||
|
||
options = {...options, manifestDefaults:"./manifest-defaults.yaml"} | ||
|
||
//CONTINUE HERE | ||
|
||
describe('Projects', () => { | ||
describe(testName, () => { | ||
let {spies, process, console} = mocks() | ||
let messages | ||
beforeAll( async () => { | ||
messages = await lams(options,{process, console}); | ||
}) | ||
it("should not error out", ()=> { | ||
expect(console.error).not.toHaveBeenCalled() | ||
}); | ||
it("it should not contain any unexpected parser (P0) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P0", | ||
level: "error" | ||
}); | ||
}); | ||
it("it should not contain any parser syntax (P1) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P1", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("no_override should provide correct aggregate info (1 match, 0 exempt, 1 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "no_override", | ||
level: "info", | ||
description: "Rule no_override summary: 1 matches, 0 matches exempt, and 1 errors" | ||
}); | ||
}); | ||
|
||
it("it should error on no_override", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "no_override", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("it should error on partial_override (due to incomplete rule def)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "partial_override", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
|
||
it("full_override should provide correct aggregate info (1 match, 0 exempt, 0 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "full_override", | ||
level: "info", | ||
description: "Rule full_override summary: 1 matches, 0 matches exempt, and 0 errors" | ||
}); | ||
}); | ||
|
||
it("it should not error on full_override", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "full_override", | ||
level: "error" | ||
}); | ||
}); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
__tests__/dummy-projects/29-manifest-loading/defaults/manifest-defaults.yaml
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,10 @@ | ||
rule: | ||
no_override: | ||
match: "$" | ||
expr_rule: "false" | ||
partial_override: | ||
match: "$" | ||
expr_rule: "false" | ||
full_override: | ||
match: "$" | ||
expr_rule: "false" |
8 changes: 8 additions & 0 deletions
8
__tests__/dummy-projects/29-manifest-loading/defaults/manifest.lkml
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,8 @@ | ||
# LAMS | ||
# rule: partial_override { | ||
# expr_rule: true ;; | ||
# } | ||
# rule: full_override { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
#} |
61 changes: 61 additions & 0 deletions
61
__tests__/dummy-projects/29-manifest-loading/inline-json/index.test.js
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,61 @@ | ||
let {testName, lams, options, mocks} = require('../../../../lib/test-commons.js')(__dirname,{dirnameOffset:-2}) | ||
|
||
options = {...options, manifest:`{"rule":{"bad":{ | ||
"match":"$", | ||
"expr_rule": "false" | ||
}}}`} | ||
|
||
describe('Projects', () => { | ||
describe(testName, () => { | ||
let {spies, process, console} = mocks() | ||
let messages | ||
beforeAll( async () => { | ||
messages = await lams(options,{process, console}); | ||
}) | ||
it("should not error out", ()=> { | ||
expect(console.error).not.toHaveBeenCalled() | ||
}); | ||
it("it should not contain any unexpected parser (P0) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P0", | ||
level: "error" | ||
}); | ||
}); | ||
it("it should not contain any parser syntax (P1) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P1", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("`bad` should provide correct aggregate info (1 match, 0 exempt, 1 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "bad", | ||
level: "info", | ||
description: "Rule bad summary: 1 matches, 0 matches exempt, and 1 errors" | ||
}); | ||
}); | ||
|
||
it("it should error on bad", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "bad", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("`ok` should provide correct aggregate info (1 match, 0 exempt, 0 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "ok", | ||
level: "info", | ||
description: "Rule ok summary: 1 matches, 0 matches exempt, and 0 errors" | ||
}); | ||
}); | ||
|
||
it("it should not error on ok", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "ok", | ||
level: "error" | ||
}); | ||
}); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
__tests__/dummy-projects/29-manifest-loading/inline-json/manifest.lkml
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,9 @@ | ||
# LAMS | ||
# rule: ok { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
# } | ||
# rule: bad { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
#} |
58 changes: 58 additions & 0 deletions
58
__tests__/dummy-projects/29-manifest-loading/lkml-path/index.test.js
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,58 @@ | ||
let {testName, lams, options, mocks} = require('../../../../lib/test-commons.js')(__dirname,{dirnameOffset:-2}) | ||
|
||
options = {...options, manifest:`./manifest.lams-lkml`} | ||
|
||
describe('Projects', () => { | ||
describe(testName, () => { | ||
let {spies, process, console} = mocks() | ||
let messages | ||
beforeAll( async () => { | ||
messages = await lams(options,{process, console}); | ||
}) | ||
it("should not error out", ()=> { | ||
expect(console.error).not.toHaveBeenCalled() | ||
}); | ||
it("it should not contain any unexpected parser (P0) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P0", | ||
level: "error" | ||
}); | ||
}); | ||
it("it should not contain any parser syntax (P1) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P1", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("`bad` should provide correct aggregate info (1 match, 0 exempt, 1 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "bad", | ||
level: "info", | ||
description: "Rule bad summary: 1 matches, 0 matches exempt, and 1 errors" | ||
}); | ||
}); | ||
|
||
it("it should error on bad", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "bad", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("`ok` should provide correct aggregate info (1 match, 0 exempt, 0 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "ok", | ||
level: "info", | ||
description: "Rule ok summary: 1 matches, 0 matches exempt, and 0 errors" | ||
}); | ||
}); | ||
|
||
it("it should not error on ok", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "ok", | ||
level: "error" | ||
}); | ||
}); | ||
}); | ||
}); |
4 changes: 4 additions & 0 deletions
4
__tests__/dummy-projects/29-manifest-loading/lkml-path/manifest.lams-lkml
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,4 @@ | ||
rule: bad { | ||
match: "$" | ||
expr_rule: false;; | ||
} |
9 changes: 9 additions & 0 deletions
9
__tests__/dummy-projects/29-manifest-loading/lkml-path/manifest.lkml
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,9 @@ | ||
# LAMS | ||
# rule: ok { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
# } | ||
# rule: bad { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
#} |
58 changes: 58 additions & 0 deletions
58
__tests__/dummy-projects/29-manifest-loading/yaml-path/index.test.js
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,58 @@ | ||
let {testName, lams, options, mocks} = require('../../../../lib/test-commons.js')(__dirname,{dirnameOffset:-2}) | ||
|
||
options = {...options, manifest:`./lams-manifest.yml`} | ||
|
||
describe('Projects', () => { | ||
describe(testName, () => { | ||
let {spies, process, console} = mocks() | ||
let messages | ||
beforeAll( async () => { | ||
messages = await lams(options,{process, console}); | ||
}) | ||
it("should not error out", ()=> { | ||
expect(console.error).not.toHaveBeenCalled() | ||
}); | ||
it("it should not contain any unexpected parser (P0) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P0", | ||
level: "error" | ||
}); | ||
}); | ||
it("it should not contain any parser syntax (P1) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P1", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("`bad` should provide correct aggregate info (1 match, 0 exempt, 1 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "bad", | ||
level: "info", | ||
description: "Rule bad summary: 1 matches, 0 matches exempt, and 1 errors" | ||
}); | ||
}); | ||
|
||
it("it should error on bad", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "bad", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("`ok` should provide correct aggregate info (1 match, 0 exempt, 0 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "ok", | ||
level: "info", | ||
description: "Rule ok summary: 1 matches, 0 matches exempt, and 0 errors" | ||
}); | ||
}); | ||
|
||
it("it should not error on ok", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "ok", | ||
level: "error" | ||
}); | ||
}); | ||
}); | ||
}); |
4 changes: 4 additions & 0 deletions
4
__tests__/dummy-projects/29-manifest-loading/yaml-path/lams-manifest.yml
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,4 @@ | ||
rule: | ||
bad: | ||
match: "$" | ||
expr_rule: "false" |
9 changes: 9 additions & 0 deletions
9
__tests__/dummy-projects/29-manifest-loading/yaml-path/manifest.lkml
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,9 @@ | ||
# LAMS | ||
# rule: ok { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
# } | ||
# rule: bad { | ||
# match: "$" | ||
# expr_rule: true ;; | ||
#} |
Oops, something went wrong.