Skip to content

Commit

Permalink
test: shields test #12
Browse files Browse the repository at this point in the history
  • Loading branch information
elcoosp committed Nov 27, 2024
1 parent 532ba54 commit 7143b88
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 0 deletions.
299 changes: 299 additions & 0 deletions core/__snapshots__/shields.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
export const snapshot = {};

snapshot[`shields - ts 1`] = `
[
{
lang: undefined,
linkUrl: "https://codecov.io/github/elcoosp/readma/tree/main",
name: "Codecov",
refName: "codecov",
shieldUrl: "https://img.shields.io/codecov/c/github/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/graphs/contributors",
name: "Contributors",
refName: "contributors",
shieldUrl: "https://img.shields.io/github/contributors/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/network/members",
name: "Forks",
refName: "forks",
shieldUrl: "https://img.shields.io/github/forks/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/stargazers",
name: "Stargazers",
refName: "stargazers",
shieldUrl: "https://img.shields.io/github/stars/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/commits",
name: "Commit activity",
refName: "commit-activity",
shieldUrl: "https://img.shields.io/github/commit-activity/w/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/actions?query=branch%3Amain",
name: "Branch action runs",
refName: "branch-action-runs",
shieldUrl: "https://img.shields.io/github/check-runs/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/blob/master/LICENSE.txt",
name: "License",
refName: "license",
shieldUrl: "https://img.shields.io/github/license/elcoosp/readma.svg?style=for-the-badge",
},
]
`;

snapshot[`shields - rs 1`] = `
[
{
lang: undefined,
linkUrl: "https://crates.io/crates/readma",
name: "Crates MSRV",
refName: "crates-msrv",
shieldUrl: "https://img.shields.io/crates/msrv/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://codecov.io/github/elcoosp/readma/tree/main",
name: "Codecov",
refName: "codecov",
shieldUrl: "https://img.shields.io/codecov/c/github/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/graphs/contributors",
name: "Contributors",
refName: "contributors",
shieldUrl: "https://img.shields.io/github/contributors/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/network/members",
name: "Forks",
refName: "forks",
shieldUrl: "https://img.shields.io/github/forks/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/stargazers",
name: "Stargazers",
refName: "stargazers",
shieldUrl: "https://img.shields.io/github/stars/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/commits",
name: "Commit activity",
refName: "commit-activity",
shieldUrl: "https://img.shields.io/github/commit-activity/w/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/actions?query=branch%3Amain",
name: "Branch action runs",
refName: "branch-action-runs",
shieldUrl: "https://img.shields.io/github/check-runs/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/blob/master/LICENSE.txt",
name: "License",
refName: "license",
shieldUrl: "https://img.shields.io/github/license/elcoosp/readma.svg?style=for-the-badge",
},
]
`;

snapshot[`shields - linkedinUsername 1`] = `
[
{
lang: undefined,
linkUrl: "https://linkedin.com/in/test",
name: "LinkedIn",
refName: "linked-in",
shieldUrl: "https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://codecov.io/github/elcoosp/readma/tree/main",
name: "Codecov",
refName: "codecov",
shieldUrl: "https://img.shields.io/codecov/c/github/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/graphs/contributors",
name: "Contributors",
refName: "contributors",
shieldUrl: "https://img.shields.io/github/contributors/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/network/members",
name: "Forks",
refName: "forks",
shieldUrl: "https://img.shields.io/github/forks/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/stargazers",
name: "Stargazers",
refName: "stargazers",
shieldUrl: "https://img.shields.io/github/stars/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/commits",
name: "Commit activity",
refName: "commit-activity",
shieldUrl: "https://img.shields.io/github/commit-activity/w/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/actions?query=branch%3Amain",
name: "Branch action runs",
refName: "branch-action-runs",
shieldUrl: "https://img.shields.io/github/check-runs/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/blob/master/LICENSE.txt",
name: "License",
refName: "license",
shieldUrl: "https://img.shields.io/github/license/elcoosp/readma.svg?style=for-the-badge",
},
]
`;

snapshot[`shields - packageRegistry 1`] = `
[
{
lang: undefined,
linkUrl: "https://codecov.io/github/elcoosp/readma/tree/main",
name: "Codecov",
refName: "codecov",
shieldUrl: "https://img.shields.io/codecov/c/github/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/graphs/contributors",
name: "Contributors",
refName: "contributors",
shieldUrl: "https://img.shields.io/github/contributors/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/network/members",
name: "Forks",
refName: "forks",
shieldUrl: "https://img.shields.io/github/forks/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/stargazers",
name: "Stargazers",
refName: "stargazers",
shieldUrl: "https://img.shields.io/github/stars/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/commits",
name: "Commit activity",
refName: "commit-activity",
shieldUrl: "https://img.shields.io/github/commit-activity/w/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/actions?query=branch%3Amain",
name: "Branch action runs",
refName: "branch-action-runs",
shieldUrl: "https://img.shields.io/github/check-runs/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/blob/master/LICENSE.txt",
name: "License",
refName: "license",
shieldUrl: "https://img.shields.io/github/license/elcoosp/readma.svg?style=for-the-badge",
},
]
`;

snapshot[`shields - packageRegistry 2`] = `
[
{
lang: undefined,
linkUrl: "https://crates.io/crates/readma",
name: "Crates MSRV",
refName: "crates-msrv",
shieldUrl: "https://img.shields.io/crates/msrv/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://crates.io/crates/readma",
name: "Crates.io version",
refName: "crates-io-version",
shieldUrl: "https://img.shields.io/crates/v/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://codecov.io/github/elcoosp/readma/tree/main",
name: "Codecov",
refName: "codecov",
shieldUrl: "https://img.shields.io/codecov/c/github/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/graphs/contributors",
name: "Contributors",
refName: "contributors",
shieldUrl: "https://img.shields.io/github/contributors/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/network/members",
name: "Forks",
refName: "forks",
shieldUrl: "https://img.shields.io/github/forks/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/stargazers",
name: "Stargazers",
refName: "stargazers",
shieldUrl: "https://img.shields.io/github/stars/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/commits",
name: "Commit activity",
refName: "commit-activity",
shieldUrl: "https://img.shields.io/github/commit-activity/w/elcoosp/readma.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/actions?query=branch%3Amain",
name: "Branch action runs",
refName: "branch-action-runs",
shieldUrl: "https://img.shields.io/github/check-runs/elcoosp/readma/main.svg?style=for-the-badge",
},
{
lang: undefined,
linkUrl: "https://github.com/elcoosp/readma/blob/master/LICENSE.txt",
name: "License",
refName: "license",
shieldUrl: "https://img.shields.io/github/license/elcoosp/readma.svg?style=for-the-badge",
},
]
`;
1 change: 1 addition & 0 deletions core/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"imports": {
"@deno-library/logger": "jsr:@deno-library/logger@^1.1.7",
"@david/dax": "jsr:@david/dax@^0.42.0",
"@std/testing": "jsr:@std/testing@^1.0.5",
"markdown-table": "npm:markdown-table@^3.0.4",
"jiti": "npm:jiti@^2.4.0"
}
Expand Down
40 changes: 40 additions & 0 deletions core/shields.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { assertSnapshot } from '@std/testing/snapshot'
import { shields } from './shields.ts'
const shieldsConfig = {
githubUsername: 'elcoosp',
repoUrl: 'https://github.com/elcoosp/readma',
repoName: 'readma',
badgeStyle: 'for-the-badge',
commitActivityInterval: 'w',
linkedinUsername: undefined,
branch: 'main',
language: 'ts',
vcsName: 'github',
workspaceMember: undefined,
packageRegistry: 'npm',
} as const
Deno.test('shields - ts', async (t) => {
const actual = shields(shieldsConfig)
await assertSnapshot(t, actual)
})

Deno.test('shields - rs', async (t) => {
const actual = shields({ ...shieldsConfig, language: 'rs' })
await assertSnapshot(t, actual)
})

Deno.test('shields - linkedinUsername', async (t) => {
const actual = shields({ ...shieldsConfig, linkedinUsername: 'test' })
await assertSnapshot(t, actual)
})

Deno.test('shields - packageRegistry', async (t) => {
const jsr = shields({ ...shieldsConfig, packageRegistry: 'jsr' })
await assertSnapshot(t, jsr)
const cratesIo = shields({
...shieldsConfig,
packageRegistry: 'crates.io',
language: 'rs',
})
await assertSnapshot(t, cratesIo)
})
Loading

0 comments on commit 7143b88

Please sign in to comment.