mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-06 17:45:22 +00:00
[Table sanity check] npm_packages (#5857)
This commit is contained in:
parent
657932cd2c
commit
a81688809a
@ -14,34 +14,26 @@
|
||||
namespace osquery {
|
||||
namespace table_tests {
|
||||
|
||||
class npmPackages : public testing::Test {
|
||||
class NpmPackagesTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
setUpEnvironment();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(npmPackages, test_sanity) {
|
||||
// 1. Query data
|
||||
TEST_F(NpmPackagesTest, test_sanity) {
|
||||
auto const data = execute_query("select * from npm_packages");
|
||||
// 2. Check size before validation
|
||||
// ASSERT_GE(data.size(), 0ul);
|
||||
// ASSERT_EQ(data.size(), 1ul);
|
||||
// ASSERT_EQ(data.size(), 0ul);
|
||||
// 3. Build validation map
|
||||
// See helper.h for avaialbe flags
|
||||
// Or use custom DataCheck object
|
||||
// ValidationMap row_map = {
|
||||
// {"name", NormalType}
|
||||
// {"version", NormalType}
|
||||
// {"description", NormalType}
|
||||
// {"author", NormalType}
|
||||
// {"license", NormalType}
|
||||
// {"path", NormalType}
|
||||
// {"directory", NormalType}
|
||||
//}
|
||||
// 4. Perform validation
|
||||
// validate_rows(data, row_map);
|
||||
|
||||
ValidationMap row_map = {
|
||||
{"name", NonEmptyString},
|
||||
{"version", NonEmptyString},
|
||||
{"description", NormalType},
|
||||
{"author", NormalType},
|
||||
{"license", NormalType},
|
||||
{"path", NonEmptyString},
|
||||
{"directory", NonEmptyString},
|
||||
};
|
||||
validate_rows(data, row_map);
|
||||
}
|
||||
|
||||
} // namespace table_tests
|
||||
|
Loading…
Reference in New Issue
Block a user