-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.test.js
57 lines (47 loc) · 1.33 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { mkdtemp, rmdir } from 'fs/promises';
import plugin from './index.js';
import * as underlyingPlugin from '@semantic-release/npm';
let workingDirectory;
beforeAll(async () => {
workingDirectory = await mkdtemp('.');
});
afterAll(async () => {
await rmdir(workingDirectory, { recursive: true });
});
const createPluginConfig = () => ({
registries: { github: {}, public: {} },
npmPublish: false,
});
const createContext = () => ({
logger: console,
env: {},
nextRelease: { version: '1.0' },
cwd: workingDirectory,
});
describe('addChannel', () => {
it('does not crash', async () => {
await plugin.addChannel(createPluginConfig, createContext);
});
});
describe('underlying plugin endpoints', () => {
it('has the expected set of keys', () => {
expect(new Set(Object.keys(underlyingPlugin))).toEqual(
new Set(['addChannel', 'prepare', 'publish', 'verifyConditions']),
);
});
});
describe('prepare', () => {
it('does not crash', async () => {
await plugin.prepare(createPluginConfig, createContext);
});
});
describe('publish', () => {
it('does not crash', async () => {
await plugin.publish(createPluginConfig, createContext);
});
});
describe('verifyConditions', () => {
it('does not crash', async () => {
await plugin.verifyConditions(createPluginConfig, createContext);
});
});