Skip to content

Commit

Permalink
test: use toMatch instead of snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Dec 29, 2024
1 parent 2928a5d commit d93a22e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 93 deletions.
90 changes: 0 additions & 90 deletions lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -100,93 +100,3 @@ exports[`modules/manager/mix/artifacts returns updated mix.lock 1`] = `
},
]
`;

exports[`modules/manager/mix/artifacts returns updated mix.lock in subdir 1`] = `
[
{
"cmd": "docker ps --filter name=renovate_sidecar -aq",
"options": {
"encoding": "utf-8",
},
},
{
"cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo/subdir" ghcr.io/containerbase/sidecar bash -l -c "install-tool erlang 25.0.0.0 && install-tool elixir 1.13.4 && mix deps.update plug"",
"options": {
"cwd": "/tmp/github/some/repo/subdir",
"encoding": "utf-8",
"env": {
"CONTAINERBASE_CACHE_DIR": "/tmp/cache/containerbase",
"HOME": "/home/user",
"HTTPS_PROXY": "https://example.com",
"HTTP_PROXY": "http://example.com",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US",
"NO_PROXY": "localhost",
"PATH": "/tmp/path",
},
"maxBuffer": 10485760,
"timeout": 900000,
},
},
]
`;

exports[`modules/manager/mix/artifacts returns updated mix.lock in umbrella project 1`] = `
[
{
"cmd": "docker ps --filter name=renovate_sidecar -aq",
"options": {
"encoding": "utf-8",
},
},
{
"cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo/apps/foo" ghcr.io/containerbase/sidecar bash -l -c "install-tool erlang 25.0.0.0 && install-tool elixir 1.13.4 && mix deps.update plug"",
"options": {
"cwd": "/tmp/github/some/repo/apps/foo",
"encoding": "utf-8",
"env": {
"CONTAINERBASE_CACHE_DIR": "/tmp/cache/containerbase",
"HOME": "/home/user",
"HTTPS_PROXY": "https://example.com",
"HTTP_PROXY": "http://example.com",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US",
"NO_PROXY": "localhost",
"PATH": "/tmp/path",
},
"maxBuffer": 10485760,
"timeout": 900000,
},
},
]
`;

exports[`modules/manager/mix/artifacts supports lockFileMaintenance 1`] = `
[
{
"cmd": "docker ps --filter name=renovate_sidecar -aq",
"options": {
"encoding": "utf-8",
},
},
{
"cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" ghcr.io/containerbase/sidecar bash -l -c "install-tool erlang 25.0.0.0 && install-tool elixir 1.13.4 && mix deps.get"",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
"env": {
"CONTAINERBASE_CACHE_DIR": "/tmp/cache/containerbase",
"HOME": "/home/user",
"HTTPS_PROXY": "https://example.com",
"HTTP_PROXY": "http://example.com",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US",
"NO_PROXY": "localhost",
"PATH": "/tmp/path",
},
"maxBuffer": 10485760,
"timeout": 900000,
},
},
]
`;
11 changes: 8 additions & 3 deletions lib/modules/manager/mix/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ describe('modules/manager/mix/artifacts', () => {
},
},
]);
expect(execSnapshots).toMatchSnapshot();
expect(execSnapshots[1]?.cmd).toMatch('mix deps.update plug');
expect(execSnapshots[1]?.options?.cwd).toBe('/tmp/github/some/repo/subdir');
});

it('returns updated mix.lock in umbrella project', async () => {
Expand Down Expand Up @@ -360,7 +361,10 @@ describe('modules/manager/mix/artifacts', () => {
},
},
]);
expect(execSnapshots).toMatchSnapshot();
expect(execSnapshots[1]?.cmd).toMatch('mix deps.update plug');
expect(execSnapshots[1]?.options?.cwd).toBe(
'/tmp/github/some/repo/apps/foo',
);
});

it('supports lockFileMaintenance', async () => {
Expand Down Expand Up @@ -398,7 +402,8 @@ describe('modules/manager/mix/artifacts', () => {
},
},
]);
expect(execSnapshots).toMatchSnapshot();
expect(execSnapshots[1]?.cmd).toMatch('mix deps.get');
expect(execSnapshots[1]?.options?.cwd).toBe('/tmp/github/some/repo');
});

it('lockFileMaintenance returns null if unchanged', async () => {
Expand Down

0 comments on commit d93a22e

Please sign in to comment.