Skip to content

Commit d788396

Browse files
committed
test: drop tests
These are tests for a impure function which basically just wraps an external library. Not really any domain logic going on, so nothing to test really
1 parent a678e14 commit d788396

File tree

1 file changed

+0
-66
lines changed

1 file changed

+0
-66
lines changed

test/integration/io/registry.test.ts

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import type RegClient from "another-npm-registry-client";
21
import { default as npmSearch, default as search } from "libnpmsearch";
32
import npmFetch from "npm-registry-fetch";
4-
import { DomainName } from "../../../src/domain/domain-name";
53
import { noopLogger } from "../../../src/domain/logging";
64
import {
75
HttpErrorLike,
86
RegistryAuthenticationError,
97
} from "../../../src/io/common-errors";
108
import {
119
getAllRegistryPackumentsUsing,
12-
getRegistryPackumentUsing,
1310
searchRegistryUsing,
1411
} from "../../../src/io/registry";
15-
import { buildPackument } from "../../common/data-packument";
1612
import { someRegistry } from "../../common/data-registry";
17-
import { mockRegClientGetResult } from "./registry-client.mock";
1813

1914
jest.mock("npm-registry-fetch");
2015
jest.mock("libnpmsearch");
@@ -109,65 +104,4 @@ describe("registry io", () => {
109104
expect(actual).toEqual(expected);
110105
});
111106
});
112-
113-
describe("fetch", () => {
114-
const packageA = DomainName.parse("package-a");
115-
116-
function makeDependencies() {
117-
const regClient: jest.Mocked<RegClient.Instance> = {
118-
adduser: jest.fn(),
119-
get: jest.fn(),
120-
};
121-
122-
const fetchRegistryPackument = getRegistryPackumentUsing(
123-
regClient,
124-
noopLogger
125-
);
126-
return { fetchRegistryPackument, regClient } as const;
127-
}
128-
it("should get existing packument", async () => {
129-
// TODO: Use prop test
130-
const packument = buildPackument(packageA);
131-
const { fetchRegistryPackument, regClient } = makeDependencies();
132-
mockRegClientGetResult(regClient, null, packument);
133-
134-
const actual = await fetchRegistryPackument(someRegistry, packageA);
135-
136-
expect(actual).toEqual(packument);
137-
});
138-
139-
it("should not find unknown packument", async () => {
140-
const { fetchRegistryPackument, regClient } = makeDependencies();
141-
mockRegClientGetResult(
142-
regClient,
143-
{
144-
message: "not found",
145-
name: "FakeError",
146-
statusCode: 404,
147-
},
148-
null
149-
);
150-
151-
const actual = await fetchRegistryPackument(someRegistry, packageA);
152-
153-
expect(actual).toBeNull();
154-
});
155-
156-
it("should fail for errors", async () => {
157-
const { fetchRegistryPackument, regClient } = makeDependencies();
158-
mockRegClientGetResult(
159-
regClient,
160-
{
161-
message: "Unauthorized",
162-
name: "FakeError",
163-
statusCode: 401,
164-
},
165-
null
166-
);
167-
168-
await expect(
169-
fetchRegistryPackument(someRegistry, packageA)
170-
).rejects.toBeInstanceOf(Error);
171-
});
172-
});
173107
});

0 commit comments

Comments
 (0)