Skip to content

Commit

Permalink
chore(tests): updated tests to test GUID timestamp strip
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Farrell committed Sep 26, 2022
1 parent 90fe70b commit f7bc62e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/extract-rails-id.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ test('Extract a Rails GUID is of wrong type', () => {

test('Extract a Rails GUID when a string is NOT a Rails GUID', () => {
expect(extractRailsId('The quick brown fox jumps over the lazy dog')).toBe(null);
});

test('Extract a Rails GUID with a timestamp', () => {
expect(extractRailsId('gid://qeepsake-rails/MyModel/12345%2C2022-09-26+13%3A08%3A27+UTC')).toBe('12345%2C2022-09-26+13%3A08%3A27+UTC');
});

test('Extract a Rails GUID and strip the timestamp', () => {
expect(extractRailsId('gid://qeepsake-rails/MyModel/12345%2C2022-09-26+13%3A08%3A27+UTC', true)).toBe('12345');
});

0 comments on commit f7bc62e

Please sign in to comment.