-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Charlike Mike Reagent
committed
Dec 12, 2014
1 parent
1273d8c
commit 3021a61
Showing
9 changed files
with
104 additions
and
233 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Makefile <https://github.com/tunnckoCore/dotfiles> | ||
# | ||
# Copyright (c) 2014 Charlike Mike Reagent, contributors. | ||
# Released under the MIT license. | ||
# | ||
|
||
JSCS = node_modules/.bin/jscs | ||
MOCHA = node_modules/.bin/mocha | ||
_MOCHA = node_modules/.bin/_mocha | ||
JSHINT = node_modules/.bin/jshint | ||
ISTANBUL = node_modules/.bin/istanbul | ||
COVERALLS = node_modules/.bin/coveralls | ||
|
||
lint: | ||
npm install | ||
${JSHINT} . | ||
${JSCS} . --reporter inline | ||
|
||
test: lint | ||
${MOCHA} | ||
|
||
test-cov: lint | ||
${ISTANBUL} cover ${_MOCHA} | ||
|
||
test-travis: lint | ||
${ISTANBUL} cover ${_MOCHA} --report lcovonly | ||
|
||
coveralls: test-travis | ||
cat ./coverage/lcov.info | ${COVERALLS} | ||
|
||
clean: | ||
rm -rf node_modules coverage | ||
|
||
.PHONY: lint test coveralls clean |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,54 @@ | ||
/** | ||
* youtube-regex <https://github.com/tunnckoCore/youtube-regex> | ||
* | ||
* Copyright (c) 2014 Charlike Mike Reagent, contributors. | ||
* Released under the MIT license. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var youtubeRegex = require('./index') | ||
var read = require('fs').readFileSync; | ||
var youtubeRegex = require('./index'); | ||
var assert = require('assert'); | ||
|
||
var fixture = read('fixture.txt', 'utf-8'); | ||
function test(str) { | ||
return youtubeRegex().test(str); | ||
} | ||
|
||
// contains youtube url address | ||
youtubeRegex().test(fixture); | ||
//=> true | ||
describe('youtube-regex', function() { | ||
it('should work with `watch` links', function(done) { | ||
assert.ok(test('youtube.com/watch?v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/watch?feature=related&v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/watch?v=0EWbonj7f18&feature=related')); | ||
assert.ok(test('http://www.youtube.com/watch?v=0EWbonj7f18')); | ||
assert.ok(test('http://www.youtube.com/watch?feature=related&v=0EWbonj7f18')); | ||
assert.ok(test('http://www.youtube.com/watch?v=0EWbonj7f18&feature=related')); | ||
assert.ok(test('https://www.youtube.com/watch?v=0EWbonj7f18')); | ||
assert.ok(test('https://www.youtube.com/watch?feature=related&v=0EWbonj7f18')); | ||
assert.ok(test('https://www.youtube.com/watch?v=0EWbonj7f18&feature=related')); | ||
assert.ok(test('www.youtube.com/watch?v=0EWbonj7f18')); | ||
assert.ok(test('www.youtube.com/watch?feature=related&v=0EWbonj7f18')); | ||
assert.ok(test('www.youtube.com/watch?v=0EWbonj7f18&feature=related')); | ||
done(); | ||
}); | ||
it('should work with `embed` links', function(done) { | ||
assert.ok(test('youtube.com/embed/watch?v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/embed/watch?feature=related&v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/embed/v/0EWbonj7f18')); | ||
assert.ok(test('youtube.com/embed/v=0EWbonj7f18')); | ||
done(); | ||
}); | ||
it('should work with shortlikns youtu.be/{id}', function(done) { | ||
assert.ok(test('http://youtu.be/0EWbonj7f18')); | ||
assert.ok(test('http://youtu.be/n17B_uFF4cA')); | ||
done(); | ||
}); | ||
it('should work with `attribution_link`s (wtf?)', function(done) { | ||
assert.ok(test('youtube.com/attribution_link?u=/watch?v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/attribution_link?u=/v/0EWbonj7f18')); | ||
assert.ok(test('youtube.com/attribution_link?u=/embed/watch?feature=related&v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/attribution_link?u=/embed/watch?v=0EWbonj7f18')); | ||
assert.ok(test('youtube.com/attribution_link?u=/embed/v/0EWbonj7f18')); | ||
assert.ok(test('youtube.com/attribution_link?u=/embed/v=0EWbonj7f18')); | ||
done(); | ||
}); | ||
}); |