-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathspec.js
67 lines (58 loc) · 1.42 KB
/
spec.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
58
59
60
61
62
63
64
65
66
const jsnpm = require('.');
describe('jsnpm', async() => {
describe('exists', async() => {
const { exists } = jsnpm;
it('Should find if a package exists', async() =>
expect(
await exists('jsnpm'),
).to.be.true,
);
it('Should find that a package does not exists', async() =>
expect(
await exists('ljaslkjasdnkldjas-09u2398u23uhe'),
).to.be.false,
);
it('Should find if a tag exists', async() =>
expect(
await exists('jsnpm', 'latest'),
).to.be.true,
);
it('Should find that a tag does not exists', async() =>
expect(
await exists('jsnpm', 'ljaslkjasdnkldjas'),
).to.be.false,
);
});
describe('latest', async() => {
const { latest } = jsnpm;
it('Should retrieve the latest version', async() => {
expect(
await latest('@(._.)/oooooo'),
).to.equal('3.3.3');
}).timeout(10000);
});
describe('publish', async() => {
const { publish } = jsnpm;
it('Should throw error when trying to publish', async() => {
try {
await publish();
assert(false);
} catch (error) {
expect(error.message).to.include('This package has been marked as private');
}
}).timeout(10000);
});
describe('versions', async() => {
const { versions } = jsnpm;
it('Should retrieve the latest version', async() => {
expect(
await versions('@(._.)/oooooo'),
).to.deep.equal([
'0.0.0',
'1.1.1',
'2.2.2',
'3.3.3',
]);
}).timeout(10000);
});
});