Add tests

This commit is contained in:
OpportunityLiu
2020-03-31 18:38:26 +08:00
Unverified
parent a46e0b8b8a
commit b54ee46fac
24 changed files with 1290 additions and 809 deletions
+11 -3
View File
@@ -4,11 +4,19 @@ import * as semver from 'semver';
describe('lsRemote', () => {
it('should return correct records', async () => {
const records = await git.lsRemote();
expect(Object.keys(records).length).not.toBeLessThan(10);
for (const tag in records) {
const ref = records[tag];
expect(records).toHaveProperty('heads');
expect(records).toHaveProperty('tags');
expect(records).toHaveProperty('pull');
expect(Object.keys(records.tags).length).not.toBeLessThan(10);
for (const tag in records.tags) {
const ref = records.tags[tag];
expect(semver.parse(tag)).toBeInstanceOf(semver.SemVer);
expect(ref).toMatch(/^[0-9a-f]{40}$/gi);
}
for (const branch in records.heads) {
const ref = records.heads[branch];
expect(ref).toMatch(/^[0-9a-f]{40}$/gi);
}
}, 100000);
});