Skip to content

Commit

Permalink
fix(tests): order snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel committed Aug 21, 2023
1 parent 53a4158 commit 8723b90
Show file tree
Hide file tree
Showing 14 changed files with 798 additions and 73 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.test.js
*.test.d.ts
*.test.d.ts.map
src/
tests/
*.tgz
Expand All @@ -10,3 +9,6 @@ TODO.todo
.env
coverage/
action/
__snapshots__/
__fixtures__/
*.ts.map
1 change: 1 addition & 0 deletions src/rules/hosting/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ register({
{ type: 'golang', name: 'github.com/aws/aws-sdk-go-v2' },
{ type: 'rust', name: /^aws-sdk/, example: 'aws-sdk-e2' },
{ type: 'ruby', name: /^aws-sdk/, example: 'aws-sdk-e2' },
{ type: 'docker', name: 'amazon/aws-cli' },
],
});
15 changes: 15 additions & 0 deletions src/rules/spec/deno/__snapshots__/lockfile.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,18 @@ exports[`deno > should match everything 1`] = `
"sqlite",
]
`;

exports[`deno > should match everything 2`] = `
[
[
"deno",
"https://deno.land/x/postgres@v0.17.0/mod.ts",
"60cb4ec8bd335bf241ef785ccec51e809d576ff8e8d29da43d2273b69ce2a6ff",
],
[
"deno",
"https://deno.land/x/sqlite3@1.3.5/lib/shim.ts",
"60cb4ec8bd335bf241ef785ccec51e809d576ff8e8d29da43d2273b69ce2a6ff",
],
]
`;
7 changes: 4 additions & 3 deletions src/rules/spec/deno/lockfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ describe('deno', () => {
},
}),
});
expect(
Array.from(flatten(res, { merge: true }).techs).sort()
).toMatchSnapshot();

const merged = flatten(res, { merge: true });
expect(Array.from(merged.techs).sort()).toMatchSnapshot();
expect(Array.from(merged.dependencies).sort()).toMatchSnapshot();
});
});
145 changes: 145 additions & 0 deletions src/rules/spec/docker/__snapshots__/component.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,148 @@ exports[`docker > should match everything 1`] = `
"zookeeper",
]
`;

exports[`docker > should match everything 2`] = `
[
[
"docker",
"adobe/s3mock",
"0.0.0",
],
[
"docker",
"amazon/aws-cli",
"0.0.0",
],
[
"docker",
"amazon/dynamodb-local",
"0.0.0",
],
[
"docker",
"caddy",
"0.0.0",
],
[
"docker",
"cassandra",
"0.0.0",
],
[
"docker",
"couchbase",
"0.0.0",
],
[
"docker",
"cypress",
"0.0.0",
],
[
"docker",
"denoland/deno",
"0.0.0",
],
[
"docker",
"elasticsearch",
"0.0.0",
],
[
"docker",
"httpd",
"0.0.0",
],
[
"docker",
"influxdb",
"0.0.0",
],
[
"docker",
"jenkins-docker",
"0.0.0",
],
[
"docker",
"kibana",
"0.0.0",
],
[
"docker",
"mariadb",
"0.0.0",
],
[
"docker",
"memcached",
"0.0.0",
],
[
"docker",
"mongo",
"0.0.0",
],
[
"docker",
"mysql",
"0.0.0",
],
[
"docker",
"neo4j",
"0.0.0",
],
[
"docker",
"nginx",
"0.0.0",
],
[
"docker",
"nodejs",
"0.0.0",
],
[
"docker",
"percona",
"0.0.0",
],
[
"docker",
"postgres",
"0.0.0",
],
[
"docker",
"rabbitmq",
"0.0.0",
],
[
"docker",
"redis",
"0.0.0",
],
[
"docker",
"ruby",
"0.0.0",
],
[
"docker",
"strapi",
"0.0.0",
],
[
"docker",
"vault",
"0.0.0",
],
[
"docker",
"zookeeper",
"0.0.0",
],
]
`;
6 changes: 3 additions & 3 deletions src/rules/spec/docker/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ describe('docker', () => {
}),
});

expect(
Array.from(flatten(res, { merge: true }).techs).sort()
).toMatchSnapshot();
const merged = flatten(res, { merge: true });
expect(Array.from(merged.techs).sort()).toMatchSnapshot();
expect(Array.from(merged.dependencies).sort()).toMatchSnapshot();
});

it.each([
Expand Down
4 changes: 2 additions & 2 deletions src/rules/spec/golang/__snapshots__/lockfile.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`golang (lockfile) > should match everything 1`] = `
Set {
[
"aws",
"golang",
}
]
`;

exports[`golang (lockfile) > should match everything 2`] = `
Expand Down
2 changes: 1 addition & 1 deletion src/rules/spec/golang/lockfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
});

const merged = flatten(res, { merge: true });
expect(merged.techs).toMatchSnapshot();
expect(Array.from(merged.techs).sort()).toMatchSnapshot();
expect(Array.from(merged.dependencies).sort()).toMatchSnapshot();
});
});
Loading

0 comments on commit 8723b90

Please sign in to comment.