diff --git a/src/common/techs.ts b/src/common/techs.ts index c2caea0a..5b3fbfa7 100644 --- a/src/common/techs.ts +++ b/src/common/techs.ts @@ -17,6 +17,8 @@ export const list: TechItem[] = [ { key: 'cassandra', name: 'Cassandra', type: 'db' }, { key: 'circleci', name: 'CircleCi', type: 'ci' }, { key: 'cirrusci', name: 'CirrusCi', type: 'ci' }, + { key: 'couchbase', name: 'Couchbase', type: 'db' }, + { key: 'cloudflare', name: 'Cloudflare', type: 'hosting' }, { key: 'codesandboxci', name: 'CodesandboxCI', type: 'ci' }, { key: 'couchbase', name: 'Couchbase', type: 'db' }, { key: 'cplusplus', name: 'C++', type: 'language' }, diff --git a/src/rules/__snapshots__/ci.test.ts.snap b/src/rules/__snapshots__/ci.test.ts.snap new file mode 100644 index 00000000..24e553f2 --- /dev/null +++ b/src/rules/__snapshots__/ci.test.ts.snap @@ -0,0 +1,23 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`ci > should match everything 1`] = ` +[ + "appveyor", + "azure.ci", + "browserstack", + "circleci", + "cirrusci", + "codesandboxci", + "cypressci", + "dependabot", + "github.actions", + "gitlabci", + "javascript", + "jenkins", + "relativeci", + "renovate", + "styleci", + "teamcity", + "travisci", +] +`; diff --git a/src/rules/__snapshots__/hosting.test.ts.snap b/src/rules/__snapshots__/hosting.test.ts.snap new file mode 100644 index 00000000..0377ad1d --- /dev/null +++ b/src/rules/__snapshots__/hosting.test.ts.snap @@ -0,0 +1,14 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`hosting > should match everything with files 1`] = ` +[ + "expodev", + "flyio", + "github.pages", + "heroku", + "netlify", + "platformsh", + "render", + "vercel", +] +`; diff --git a/src/rules/ci.test.ts b/src/rules/ci.test.ts index 03b5d509..8fc89275 100644 --- a/src/rules/ci.test.ts +++ b/src/rules/ci.test.ts @@ -7,21 +7,21 @@ import { FakeProvider } from '../provider/fake.js'; import { rawList } from '../rules.js'; import './index.js'; -const paths: string[] = []; -for (const item of rawList) { - if ( - item.type !== 'file' || - listIndexed[item.ref.tech].type !== 'ci' || - !item.ref.files - ) { - continue; - } - - paths.push('example' in item.ref ? item.ref.example : item.ref.files[0]); -} - describe('ci', () => { it('should match everything', async () => { + const paths: string[] = []; + for (const item of rawList) { + if ( + item.type !== 'file' || + listIndexed[item.ref.tech].type !== 'ci' || + !item.ref.files + ) { + continue; + } + + paths.push('example' in item.ref ? item.ref.example : item.ref.files[0]); + } + const res = await analyser({ provider: new FakeProvider({ paths: { @@ -30,26 +30,7 @@ describe('ci', () => { files: {}, }), }); - const match: AllowedKeys[] = [ - 'appveyor', - 'azure.ci', - 'browserstack', - 'circleci', - 'cirrusci', - 'codesandboxci', - 'cypressci', - 'dependabot', - 'github.actions', - 'gitlabci', - 'javascript', - 'jenkins', - 'relativeci', - 'renovate', - 'styleci', - 'teamcity', - 'travisci', - ]; - expect(res.toJson('').techs).toStrictEqual(match); + expect(res.toJson('').techs).toMatchSnapshot(); }); it('enforce that we match .github', async () => { diff --git a/src/rules/hosting.test.ts b/src/rules/hosting.test.ts index 86864a28..1bf1d44e 100644 --- a/src/rules/hosting.test.ts +++ b/src/rules/hosting.test.ts @@ -2,26 +2,25 @@ import { describe, expect, it } from 'vitest'; import { analyser } from '../analyser/index.js'; import { listIndexed } from '../common/techs.js'; -import type { AllowedKeys } from '../index.js'; import { FakeProvider } from '../provider/fake.js'; import { rawList } from '../rules.js'; import './index.js'; -const paths: string[] = []; -for (const item of rawList) { - if ( - item.type !== 'file' || - listIndexed[item.ref.tech].type !== 'hosting' || - !item.ref.files - ) { - continue; - } - - paths.push('example' in item.ref ? item.ref.example : item.ref.files[0]); -} - describe('hosting', () => { it('should match everything with files', async () => { + const paths: string[] = []; + for (const item of rawList) { + if ( + item.type !== 'file' || + listIndexed[item.ref.tech].type !== 'hosting' || + !item.ref.files + ) { + continue; + } + + paths.push('example' in item.ref ? item.ref.example : item.ref.files[0]); + } + const res = await analyser({ provider: new FakeProvider({ paths: { @@ -30,16 +29,6 @@ describe('hosting', () => { files: {}, }), }); - const match: AllowedKeys[] = [ - 'expodev', - 'flyio', - 'github.pages', - 'heroku', - 'netlify', - 'platformsh', - 'render', - 'vercel', - ]; - expect(res.toJson('').techs).toStrictEqual(match); + expect(res.toJson('').techs).toMatchSnapshot(); }); }); diff --git a/src/rules/hosting/cloudflare.ts b/src/rules/hosting/cloudflare.ts new file mode 100644 index 00000000..fac1358e --- /dev/null +++ b/src/rules/hosting/cloudflare.ts @@ -0,0 +1,8 @@ +import { register } from '../../rules.js'; + +register({ + tech: 'cloudflare', + dependencies: [ + { type: 'terraform', name: 'registry.terraform.io/cloudflare/cloudflare' }, + ], +}); diff --git a/src/rules/spec/docker/__snapshots__/dependencies.test.ts.snap b/src/rules/spec/docker/__snapshots__/dependencies.test.ts.snap index b76bdb94..e18efdfd 100644 --- a/src/rules/spec/docker/__snapshots__/dependencies.test.ts.snap +++ b/src/rules/spec/docker/__snapshots__/dependencies.test.ts.snap @@ -2,12 +2,13 @@ exports[`docker > should match everything 1`] = ` [ + "aws", + "aws.dynamodb", "caddy", "cassandra", "couchbase", "cypressci", "docker", - "dynamodb", "elasticsearch", "httpd", "influxdb", diff --git a/src/rules/spec/nodejs/__snapshots__/dependencies.test.ts.snap b/src/rules/spec/nodejs/__snapshots__/dependencies.test.ts.snap index a4bf938a..6a92e0f4 100644 --- a/src/rules/spec/nodejs/__snapshots__/dependencies.test.ts.snap +++ b/src/rules/spec/nodejs/__snapshots__/dependencies.test.ts.snap @@ -6,12 +6,12 @@ exports[`npm > should match everything 1`] = ` "angular", "auth0", "aws", + "aws.dynamodb", "bootstrap", "browserstack", "couchbase", "cypressci", "datadog", - "dynamodb", "elasticsearch", "esbuild", "eslint", diff --git a/src/types/techs.ts b/src/types/techs.ts index 090d8c6f..b61659ea 100644 --- a/src/types/techs.ts +++ b/src/types/techs.ts @@ -27,6 +27,7 @@ export type AllowedKeys = | 'cassandra' | 'circleci' | 'cirrusci' + | 'cloudflare' | 'codesandboxci' | 'couchbase' | 'cplusplus'