Skip to content

Commit

Permalink
test: add tests where arguments are present
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed Sep 1, 2022
1 parent 7978053 commit f5c924a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
18 changes: 15 additions & 3 deletions test/__snapshots__/security.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Vitest Snapshot v1

exports[`security > 42 > cve 1`] = `"CVE-2007-79177"`;
exports[`security > 42 > cve > with from and to date 1`] = `"CVE-2010-79177"`;

exports[`security > 42 > cve > with from date 1`] = `"CVE-2022-79177"`;

exports[`security > 42 > cve > with to date 1`] = `"CVE-2007-79177"`;

exports[`security > 42 > cvss 1`] = `
{
Expand All @@ -12,7 +16,11 @@ exports[`security > 42 > cvss 1`] = `

exports[`security > 42 > cwe 1`] = `"CWE-520"`;

exports[`security > 1211 > cve 1`] = `"CVE-2020-48721"`;
exports[`security > 1211 > cve > with from and to date 1`] = `"CVE-2021-48721"`;

exports[`security > 1211 > cve > with from date 1`] = `"CVE-2022-48721"`;

exports[`security > 1211 > cve > with to date 1`] = `"CVE-2020-48721"`;

exports[`security > 1211 > cvss 1`] = `
{
Expand All @@ -24,7 +32,11 @@ exports[`security > 1211 > cvss 1`] = `

exports[`security > 1211 > cwe 1`] = `"CWE-1289"`;

exports[`security > 1337 > cve 1`] = `"CVE-2005-51225"`;
exports[`security > 1337 > cve > with from and to date 1`] = `"CVE-2007-51225"`;

exports[`security > 1337 > cve > with from date 1`] = `"CVE-2022-51225"`;

exports[`security > 1337 > cve > with to date 1`] = `"CVE-2005-51225"`;

exports[`security > 1337 > cvss 1`] = `
{
Expand Down
12 changes: 9 additions & 3 deletions test/security.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ import { seededTests } from './support/seededRuns';

const NON_SEEDED_BASED_RUN = 5;

const functionNames = ['cve', 'cwe', 'cvss'] as const;

describe('security', () => {
afterEach(() => {
faker.locale = 'en';
});

seededTests(faker, 'security', (t) => t.itEach(...functionNames));
seededTests(faker, 'security', (t) => {
t.describe('cve', (t) =>
t
.it('with from date', { from: '2022-08-16' })
.it('with to date', { to: '2022-08-16' })
.it('with from and to date', { from: '2002-08-16', to: '2022-08-16' })
);
t.itEach('cwe', 'cvss');
});

describe(`random seeded tests for seed ${JSON.stringify(
faker.seed()
Expand Down

0 comments on commit f5c924a

Please sign in to comment.