Skip to content

Commit

Permalink
test: milestone.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Mar 20, 2024
1 parent 45a902c commit 396c94b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/unit/milestone.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { describe, expect, beforeEach, test } from 'vitest';

import { Milestone } from '../../src/milestone';

describe('Metadata Class', () => {
let milestone: Milestone;

beforeEach(() => {
milestone = new Milestone({
html_url: '',
number: 1,
title: 'v255',
description: 'description',
state: 'open',
});
});

test('can be instantiated', () => {
expect(milestone).toBeDefined();
expect(milestone).toBeInstanceOf(Milestone);
expect(milestone.regex).toBeInstanceOf(RegExp);
expect(milestone.regex.toString()).toBe('/^v255\\S*$/');
});

test('isCompliant()', () => {
expect(milestone.isCompliant('v255-rc1')).toBe(true);
expect(milestone.isCompliant('v255')).toBe(true);

expect(milestone.isCompliant('v256-rc1')).toBe(false);
expect(milestone.isCompliant('bla-bla')).toBe(false);
});
});

0 comments on commit 396c94b

Please sign in to comment.