From babe22ae5f09020693570f103aaeab98dd178bcb Mon Sep 17 00:00:00 2001 From: Avishag Israeli Date: Sun, 22 Aug 2021 18:07:46 +0300 Subject: [PATCH] test: migrate old-snyk-format to jest --- test/jest/unit/old-snyk-format.spec.ts | 18 ++++++++++++++++++ test/old-snyk-format.test.ts | 16 ---------------- 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 test/jest/unit/old-snyk-format.spec.ts delete mode 100644 test/old-snyk-format.test.ts diff --git a/test/jest/unit/old-snyk-format.spec.ts b/test/jest/unit/old-snyk-format.spec.ts new file mode 100644 index 0000000000..550a70d689 --- /dev/null +++ b/test/jest/unit/old-snyk-format.spec.ts @@ -0,0 +1,18 @@ +import * as policy from 'snyk-policy'; +import { loadJson } from '../../utils'; +import * as path from 'path'; + +it('test sensibly bails if gets an old .snyk format', async () => { + const vulns2 = loadJson( + path.resolve(__dirname, '../../fixtures/test-jsbin-vulns-updated.json'), + ); + try { + const config = await policy.load( + path.resolve(__dirname, '../../fixtures/old-snyk-config'), + ); + const res = await config.filter(vulns2); + fail('was expecting an error, got ' + JSON.stringify(res)); + } catch (e) { + expect(e.code).toEqual('OLD_DOTFILE_FORMAT'); + } +}); diff --git a/test/old-snyk-format.test.ts b/test/old-snyk-format.test.ts deleted file mode 100644 index cb1a1e386c..0000000000 --- a/test/old-snyk-format.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as policy from 'snyk-policy'; -import { test } from 'tap'; -import { loadJson } from './utils'; - -test('test sensibly bails if gets an old .snyk format', async (t) => { - try { - const vulns2 = loadJson( - __dirname + '/fixtures/test-jsbin-vulns-updated.json', - ); - const config = await policy.load(__dirname + '/fixtures/old-snyk-config'); - const res = await config.filter(vulns2); - t.fail('was expecting an error, got ' + JSON.stringify(res)); - } catch (e) { - t.equal(e.code, 'OLD_DOTFILE_FORMAT'); - } -});