id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rs/pushd:lib/payload.coffee:1:raw_corpus | raw_corpus | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
@ca... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | d69b453eaacc2964d67515ebaecc12bb80927606 | 1,157 | https://github.com/rs/pushd/blob/d69b453eaacc2964d67515ebaecc12bb80927606/lib/payload.coffee | 3 | 52 | ||
rs/pushd:lib/payload.coffee:1:completion | completion | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
@ca... | when 'msg' then @msg.default = value
when 'sound' then @sound = value
when 'incrementBadge' then @incrementBadge = value != 'false'
when 'category' then @category = value
when 'contentAvailable' then @contentAvailable = value != 'false'
els... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | d69b453eaacc2964d67515ebaecc12bb80927606 | 1,157 | https://github.com/rs/pushd/blob/d69b453eaacc2964d67515ebaecc12bb80927606/lib/payload.coffee | 3 | 52 |
rs/pushd:lib/payload.coffee:2:raw_corpus | raw_corpus | return @[type][lang]
# Try with lang only in case of full locale code (en_CA)
else if Payload::locale_format.test(lang) and @[type][lang[0..1]]?
return @[type][lang[0..1]]
else if @[type].default
return @[type].default
compile: ->
# Compile title and msg temp... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | d69b453eaacc2964d67515ebaecc12bb80927606 | 1,157 | https://github.com/rs/pushd/blob/d69b453eaacc2964d67515ebaecc12bb80927606/lib/payload.coffee | 53 | 86 | ||
rs/pushd:lib/payload.coffee:2:completion | completion | return @[type][lang]
# Try with lang only in case of full locale code (en_CA)
else if Payload::locale_format.test(lang) and @[type][lang[0..1]]?
return @[type][lang[0..1]]
else if @[type].default
return @[type].default
compile: ->
# Compile title and msg temp... | variable: (keyPath) ->
if keyPath is 'event.name'
# Special case
if @event?.name
return @event?.name
else
throw new Error("The ${#{keyPath}} does not exist")
[prefix, key] = keyPath.split('.', 2)
if prefix not in ['var', 'data'... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | d69b453eaacc2964d67515ebaecc12bb80927606 | 1,157 | https://github.com/rs/pushd/blob/d69b453eaacc2964d67515ebaecc12bb80927606/lib/payload.coffee | 53 | 86 |
rs/pushd:lib/payload.coffee:1:raw_corpus | raw_corpus | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
@ca... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | e6124dc3cd21fb1a67702e92c169ca1ccc757469 | 1,157 | https://github.com/rs/pushd/blob/e6124dc3cd21fb1a67702e92c169ca1ccc757469/lib/payload.coffee | 3 | 52 | ||
rs/pushd:lib/payload.coffee:1:completion | completion | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
@ca... | when 'msg' then @msg.default = value
when 'sound' then @sound = value
when 'incrementBadge' then @incrementBadge = value != 'false'
when 'category' then @category = value
when 'contentAvalilable' then @contentAvalilable = value != 'false'
e... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | e6124dc3cd21fb1a67702e92c169ca1ccc757469 | 1,157 | https://github.com/rs/pushd/blob/e6124dc3cd21fb1a67702e92c169ca1ccc757469/lib/payload.coffee | 3 | 52 |
rs/pushd:lib/payload.coffee:1:raw_corpus | raw_corpus | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
# ... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 7c8e1880073388a8692c0ac55dc8faf471db1f27 | 1,157 | https://github.com/rs/pushd/blob/7c8e1880073388a8692c0ac55dc8faf471db1f27/lib/payload.coffee | 3 | 52 | ||
rs/pushd:lib/payload.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
... | var Payload,
hasProp = {}.hasOwnProperty;
Payload = (function() {
class Payload {
constructor(data) {
var i, key, len, prefix, ref, subkey, sum, type, value;
if (typeof data !== 'object') {
throw new Error('Invalid payload');
}
this.id = serial++;
this.compiled = false;
... | CoffeeScript | JavaScript | rs/pushd | lib/payload.coffee | MIT | 7c8e1880073388a8692c0ac55dc8faf471db1f27 | 1,157 | https://github.com/rs/pushd/blob/7c8e1880073388a8692c0ac55dc8faf471db1f27/lib/payload.coffee | 3 | 52 |
rs/pushd:lib/payload.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Payload,
hasProp = {}.hasOwnProperty;
Payload = (function() {
class Payload {
constructor(data) {
var i, key, len, prefix, ref, subkey, sum, type, value;
if (typeof data !== 'object') {
throw new Error('Invalid payload');
}
... | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
# ... | JavaScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 7c8e1880073388a8692c0ac55dc8faf471db1f27 | 1,157 | https://github.com/rs/pushd/blob/7c8e1880073388a8692c0ac55dc8faf471db1f27/lib/payload.coffee | 3 | 52 |
rs/pushd:lib/payload.coffee:1:completion | completion | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
@incrementBadge = yes
# ... | when 'incrementBadge' then @incrementBadge = value != 'false'
else
if ([prefix, subkey] = key.split('.', 2)).length is 2
@[prefix][subkey] = value
else
throw new Error("Invalid field: #{key}")
# Detect empty... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 7c8e1880073388a8692c0ac55dc8faf471db1f27 | 1,157 | https://github.com/rs/pushd/blob/7c8e1880073388a8692c0ac55dc8faf471db1f27/lib/payload.coffee | 3 | 52 |
rs/pushd:lib/payload.coffee:2:raw_corpus | raw_corpus | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 7c8e1880073388a8692c0ac55dc8faf471db1f27 | 1,157 | https://github.com/rs/pushd/blob/7c8e1880073388a8692c0ac55dc8faf471db1f27/lib/payload.coffee | 53 | 82 | ||
rs/pushd:lib/payload.coffee:2:completion | completion | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | # Special case
if @event?.name
return @event?.name
else
throw new Error("The ${#{keyPath}} does not exist")
[prefix, key] = keyPath.split('.', 2)
if prefix not in ['var', 'data']
throw new Error("Invalid variable type for ${#{keyPath}}... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 7c8e1880073388a8692c0ac55dc8faf471db1f27 | 1,157 | https://github.com/rs/pushd/blob/7c8e1880073388a8692c0ac55dc8faf471db1f27/lib/payload.coffee | 53 | 82 |
rs/pushd:lib/payload.coffee:1:raw_corpus | raw_corpus | serial = 0
class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
# Read fields
... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | a9304020e2959a2734599b31a9c4d67db2c76b66 | 1,157 | https://github.com/rs/pushd/blob/a9304020e2959a2734599b31a9c4d67db2c76b66/lib/payload.coffee | 1 | 50 | ||
rs/pushd:lib/payload.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
serial = 0
class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@... | var Payload, serial,
hasProp = {}.hasOwnProperty;
serial = 0;
Payload = (function() {
class Payload {
constructor(data) {
var i, key, len, prefix, ref, subkey, sum, type, value;
if (typeof data !== 'object') {
throw new Error('Invalid payload');
}
this.id = serial++;
this... | CoffeeScript | JavaScript | rs/pushd | lib/payload.coffee | MIT | a9304020e2959a2734599b31a9c4d67db2c76b66 | 1,157 | https://github.com/rs/pushd/blob/a9304020e2959a2734599b31a9c4d67db2c76b66/lib/payload.coffee | 1 | 50 |
rs/pushd:lib/payload.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Payload, serial,
hasProp = {}.hasOwnProperty;
serial = 0;
Payload = (function() {
class Payload {
constructor(data) {
var i, key, len, prefix, ref, subkey, sum, type, value;
if (typeof data !== 'object') {
throw new Error('Invalid ... | serial = 0
class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
# Read fields
... | JavaScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | a9304020e2959a2734599b31a9c4d67db2c76b66 | 1,157 | https://github.com/rs/pushd/blob/a9304020e2959a2734599b31a9c4d67db2c76b66/lib/payload.coffee | 1 | 50 |
rs/pushd:lib/payload.coffee:1:completion | completion | serial = 0
class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@id = serial++
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
# Read fields
... | when 'sound' then @sound = value
else
if ([prefix, subkey] = key.split('.', 2)).length is 2
@[prefix][subkey] = value
else
throw new Error("Invalid field: #{key}")
# Detect empty payload
sum = 0
... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | a9304020e2959a2734599b31a9c4d67db2c76b66 | 1,157 | https://github.com/rs/pushd/blob/a9304020e2959a2734599b31a9c4d67db2c76b66/lib/payload.coffee | 1 | 50 |
rs/pushd:lib/payload.coffee:2:raw_corpus | raw_corpus | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 8a1e841313d3b941bbc6ad8eabc58b80c55d3622 | 1,157 | https://github.com/rs/pushd/blob/8a1e841313d3b941bbc6ad8eabc58b80c55d3622/lib/payload.coffee | 51 | 74 | ||
rs/pushd:lib/payload.coffee:2:completion | completion | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | # Extracts variable from payload. The keyPath can be `var.somekey` or `data.somekey`
variable: (keyPath) ->
[prefix, key] = keyPath.split('.', 2)
if prefix not in ['var', 'data']
throw new Error("Invalid variable type for ${#{keyPath}}")
if not @[prefix][key]?
throw n... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 8a1e841313d3b941bbc6ad8eabc58b80c55d3622 | 1,157 | https://github.com/rs/pushd/blob/8a1e841313d3b941bbc6ad8eabc58b80c55d3622/lib/payload.coffee | 51 | 74 |
rs/pushd:lib/payload.coffee:2:raw_corpus | raw_corpus | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 2bafef27e4658d71a27d03307392dd35c6f3bfdd | 1,157 | https://github.com/rs/pushd/blob/2bafef27e4658d71a27d03307392dd35c6f3bfdd/lib/payload.coffee | 51 | 74 | ||
rs/pushd:lib/payload.coffee:2:completion | completion | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | # Extracts variable from payload. The keyPath can be `var.somekey` or `data.somekey`
variable: (keyPath) ->
[prefix, key] = keyPath.split('.', 2)
if prefix not in ['var', 'data']
throw new Error("Invalid variable type ${#{variable}}")
if not @[prefix][key]?
throw new ... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 2bafef27e4658d71a27d03307392dd35c6f3bfdd | 1,157 | https://github.com/rs/pushd/blob/2bafef27e4658d71a27d03307392dd35c6f3bfdd/lib/payload.coffee | 51 | 74 |
rs/pushd:lib/payload.coffee:2:raw_corpus | raw_corpus | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | d798066392af800198abb1da105fdf6ab3d5a0e6 | 1,157 | https://github.com/rs/pushd/blob/d798066392af800198abb1da105fdf6ab3d5a0e6/lib/payload.coffee | 51 | 69 | ||
rs/pushd:lib/payload.coffee:2:completion | completion | else if @[type].default
return @[type].default
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) -> | return tmpl.replace /\$\{(.*?)\}/g, (match, variable) =>
[prefix, key] = variable.split('.', 2)
if prefix not in ['var', 'data']
throw new Error("Invalid variable ${#{variable}}")
if not @[prefix][key]?
throw new Error("The ${#{variable}} does not exis... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | d798066392af800198abb1da105fdf6ab3d5a0e6 | 1,157 | https://github.com/rs/pushd/blob/d798066392af800198abb1da105fdf6ab3d5a0e6/lib/payload.coffee | 51 | 69 |
rs/pushd:lib/payload.coffee:1:raw_corpus | raw_corpus | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
# Read fields
for own key, value of data
... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 1 | 50 | ||
rs/pushd:lib/payload.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
... | var Payload,
hasProp = {}.hasOwnProperty;
Payload = (function() {
class Payload {
constructor(data) {
var i, key, len, prefix, ref, subkey, sum, type, value;
if (typeof data !== 'object') {
throw new Error('Invalid payload');
}
this.compiled = false;
this.title = {};
... | CoffeeScript | JavaScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 1 | 50 |
rs/pushd:lib/payload.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Payload,
hasProp = {}.hasOwnProperty;
Payload = (function() {
class Payload {
constructor(data) {
var i, key, len, prefix, ref, subkey, sum, type, value;
if (typeof data !== 'object') {
throw new Error('Invalid payload');
}
... | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
# Read fields
for own key, value of data
... | JavaScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 1 | 50 |
rs/pushd:lib/payload.coffee:1:completion | completion | class Payload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
constructor: (data) ->
throw new Error('Invalid payload') unless typeof data is 'object'
@compiled = no
@title = {}
@msg = {}
@data = {}
@var = {}
# Read fields
for own key, value of data
... | if ([prefix, subkey] = key.split('.', 2)).length is 2
@[prefix][subkey] = value
else
throw new Error("Invalid field: #{key}")
# Detect empty payload
sum = 0
sum += (key for own key of @[type]).length for type in ['title', 'msg'... | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 1 | 50 |
rs/pushd:lib/payload.coffee:2:raw_corpus | raw_corpus | compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g, (match, variable) =>
[prefix, key] = variable.spli... | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 51 | 66 | ||
rs/pushd:lib/payload.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g, (matc... | var hasProp = {}.hasOwnProperty;
({
compile: function() {
var i, lang, len, msg, ref, ref1, type;
ref = ['title', 'msg'];
for (i = 0, len = ref.length; i < len; i++) {
type = ref[i];
ref1 = this[type];
for (lang in ref1) {
if (!hasProp.call(ref1, lang)) continue;
msg = r... | CoffeeScript | JavaScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 51 | 66 |
rs/pushd:lib/payload.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var hasProp = {}.hasOwnProperty;
({
compile: function() {
var i, lang, len, msg, ref, ref1, type;
ref = ['title', 'msg'];
for (i = 0, len = ref.length; i < len; i++) {
type = ref[i];
ref1 = this[type];
for (lang in ref1) {
i... | compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g, (match, variable) =>
[prefix, key] = variable.spli... | JavaScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 51 | 66 |
rs/pushd:lib/payload.coffee:2:completion | completion | compile: ->
# Compile title and msg templates
@[type][lang] = @compileTemplate(msg) for own lang, msg of @[type] for type in ['title', 'msg']
@compiled = yes
compileTemplate: (tmpl) ->
return tmpl.replace /\$\{(.*?)\}/g, (match, variable) =>
[prefix, key] = variable.spli... | if prefix not in ['var', 'data']
throw new Error("Invalid variable ${#{variable}}")
if not @[prefix][key]?
throw new Error("The ${#{variable}} does not exist")
return @[prefix][key]
exports.Payload = Payload | CoffeeScript | CoffeeScript | rs/pushd | lib/payload.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/payload.coffee | 51 | 66 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:raw_corpus | raw_corpus | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndSt... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 1 | 49 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
... | var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub(),
generateAndStoreTokenInCache: sinon.stub()
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 1 | 49 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub()... | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndSt... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 1 | 49 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:completion | completion | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndSt... | describe 'when request fails', ->
beforeEach ->
@request.yields new Error
@sut.send foo: 'bar', (@error) =>
it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith
url: 'http://google.com'
headers:
'X... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 1 | 49 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:raw_corpus | raw_corpus | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
json: {czar: 'foo'}
headers:
'X-MESHBLU-MESSAGE-TYPE': 'rece... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 51 | 98 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
json: {czar: 'foo'}
... | it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call request with whatever else I want', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
json: {
czar: 'foo'
},
headers: {
'X-MESHBLU-MESSAGE-TYP... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 51 | 98 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call request with whatever else I want', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
json: {
czar: '... | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
json: {czar: 'foo'}
headers:
'X-MESHBLU-MESSAGE-TYPE': 'rece... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 51 | 98 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:completion | completion | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
json: {czar: 'foo'}
headers:
'X-MESHBLU-MESSAGE-TYPE': 'rece... | @sut.send czar: 'foo', (@error) =>
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request and add my auth', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
auth: {bearer: 'dGVzdDpnb2JibGVkZWdvb2s='}
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 51 | 98 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:raw_corpus | raw_corpus | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call generateAndForwardMeshbluCredentials', ->
expect(@sut.generateAndForwardMeshbluCredentials).to.have.been.called
it 'should not override my auth', ->
expect(@request).to.have.been.calledWith
... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 100 | 145 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call generateAndForwardMeshbluCredentials', ->
expect(@sut.generateAndForwardMeshbluCredentials).to.have.been.called
it 'should not override my auth', ->
... | it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call generateAndForwardMeshbluCredentials', function() {
return expect(this.sut.generateAndForwardMeshbluCredentials).to.have.been.called;
});
it('should not override my auth', function() {
return expect(this.request)... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 100 | 145 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call generateAndForwardMeshbluCredentials', function() {
return expect(this.sut.generateAndForwardMeshbluCredentials).to.have.been.called;
});
it('should not overri... | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call generateAndForwardMeshbluCredentials', ->
expect(@sut.generateAndForwardMeshbluCredentials).to.have.been.called
it 'should not override my auth', ->
expect(@request).to.have.been.calledWith
... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 100 | 145 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:completion | completion | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call generateAndForwardMeshbluCredentials', ->
expect(@sut.generateAndForwardMeshbluCredentials).to.have.been.called
it 'should not override my auth', ->
expect(@request).to.have.been.calledWith
... | type: 'received'
@device.generateAndStoreTokenInCache.yields null, 'gobbledegook'
@sut = new MessageWebhook options, @dependencies
@sut.generateAndForwardMeshbluCredentials (@error, @token) =>
it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a toke... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 100 | 145 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:raw_corpus | raw_corpus | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call removeTokenFromCache', ->
expect(@device.removeTokenFromCache).to.have.been.calledWith 'test' | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 147 | 151 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call removeTokenFromCache', ->
expect(@device.removeTokenFromCache).to.have.been.calledWith 'test'
``` | it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call removeTokenFromCache', function() {
return expect(this.device.removeTokenFromCache).to.have.been.calledWith('test');
}); | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 147 | 151 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call removeTokenFromCache', function() {
return expect(this.device.removeTokenFromCache).to.have.been.calledWith('test');
});
``` | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call removeTokenFromCache', ->
expect(@device.removeTokenFromCache).to.have.been.calledWith 'test' | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 147 | 151 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:completion | completion | it 'should get not error', ->
expect(@error).not.to.exist | it 'should call removeTokenFromCache', ->
expect(@device.removeTokenFromCache).to.have.been.calledWith 'test' | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | b4204a682340724dff785a696d94ed2477489dcf | 815 | https://github.com/octoblu/meshblu/blob/b4204a682340724dff785a696d94ed2477489dcf/test/lib/MessageWebhook-spec.coffee | 147 | 151 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:raw_corpus | raw_corpus | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndSt... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 1 | 41 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
... | var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub(),
generateAndStoreTokenInCache: sinon.stub()
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub()... | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndSt... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:completion | completion | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndSt... | @sut = new MessageWebhook options, @dependencies
@sut.send foo: 'bar', (@error) =>
it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'Invalid webhook configuration: type is required'
describe 'when instantiated with a url', ->
beforeEach ->
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:raw_corpus | raw_corpus | it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith
url: 'http://google.com'
headers:
'X-MESHBLU-MESSAGE-TYPE': 'received'
json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
des... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 43 | 88 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith
url: 'http://google.com'
headers:
'X-MESHBLU-MESSAGE-TYPE': 'received'
json: {foo: 'bar'}
it 'should ge... | it('should call request with whatever I want', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://google.com',
headers: {
'X-MESHBLU-MESSAGE-TYPE': 'received'
},
json: {
foo: 'bar'
}
});
});
it('should get error', function() {
return expect(this.error)... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 43 | 88 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should call request with whatever I want', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://google.com',
headers: {
'X-MESHBLU-MESSAGE-TYPE': 'received'
},
json: {
foo: 'bar'
}
});
});
it('shou... | it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith
url: 'http://google.com'
headers:
'X-MESHBLU-MESSAGE-TYPE': 'received'
json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
des... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 43 | 88 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:completion | completion | it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith
url: 'http://google.com'
headers:
'X-MESHBLU-MESSAGE-TYPE': 'received'
json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
des... | it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
json: {czar: 'foo'}
headers:
'X-MESHBLU-MESSAGE-TYPE': 'received'
it 'should not mutate my webhook', ->
expect(@hook).... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 43 | 88 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:raw_corpus | raw_corpus | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request and add my auth', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
auth: {bearer: 'dGVzdDpnb2JibGVkZWdvb2s='}
json: {czar: 'foo'}
headers:
... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 90 | 139 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request and add my auth', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
auth: {bearer: 'dGVzdDpnb2JibGVkZWdvb2s... | it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call request and add my auth', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
auth: {
bearer: 'dGVzdDpnb2JibGVkZWdvb2s='
},
json: {
czar: 'foo'
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 90 | 139 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should call request and add my auth', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
auth: {
bearer: 'dGVzdDpn... | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request and add my auth', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
auth: {bearer: 'dGVzdDpnb2JibGVkZWdvb2s='}
json: {czar: 'foo'}
headers:
... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 90 | 139 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:completion | completion | it 'should get not error', ->
expect(@error).not.to.exist
it 'should call request and add my auth', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
auth: {bearer: 'dGVzdDpnb2JibGVkZWdvb2s='}
json: {czar: 'foo'}
headers:
... | it 'should call generateAndForwardMeshbluCredentials', ->
expect(@sut.generateAndForwardMeshbluCredentials).to.have.been.called
it 'should not override my auth', ->
expect(@request).to.have.been.calledWith
url: 'http://facebook.com'
auth: 'basic'
json: {c... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 90 | 139 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:raw_corpus | raw_corpus | it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://fa... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 141 | 164 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded... | it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should yield a token', function() {
return expect(this.token).to.deep.equal('gobbledegook');
});
describe('->removeToken', function() {
return describe('when using a crazy scheme to get meshblu credentials forwarded', functi... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 141 | 164 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should yield a token', function() {
return expect(this.token).to.deep.equal('gobbledegook');
});
describe('->removeToken', function() {
return describe('when using a cra... | it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://fa... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 141 | 164 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:completion | completion | it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://fa... | uuid: @deviceRecord.uuid
options: @hook
type: 'received'
@sut = new MessageWebhook options, @dependencies
@revokeToken.yields null
@sut.removeToken 'test', (@error) =>
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call removeTokenF... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 51ebbd8763a3a475d787d0f50bda1deb9069a7da | 815 | https://github.com/octoblu/meshblu/blob/51ebbd8763a3a475d787d0f50bda1deb9069a7da/test/lib/MessageWebhook-spec.coffee | 141 | 164 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:raw_corpus | raw_corpus | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sin... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 1 | 41 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
... | var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub(),
generateAndStoreTokenInCache: sinon.stub()
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub()... | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sin... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:completion | completion | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sin... | @sut = new MessageWebhook options, @dependencies
describe 'when request fails', ->
beforeEach ->
@request.yields new Error
@sut.send foo: 'bar', (@error) =>
it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith url: 'http://googl... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:raw_corpus | raw_corpus | it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'HTTP Status: 103'
describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut.send foo: 'bar', (@error) =>... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 43 | 82 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'HTTP Status: 103'
describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'ch... | it('should get error', function() {
expect(this.error).to.exist;
return expect(this.error.message).to.deep.equal('HTTP Status: 103');
});
describe('when request do fails and it mah fault', function() {
beforeEach(function() {
this.request.yields(null, {
statusCode: 429
}, 'chillax broham');
ret... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 43 | 82 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get error', function() {
expect(this.error).to.exist;
return expect(this.error.message).to.deep.equal('HTTP Status: 103');
});
describe('when request do fails and it mah fault', function() {
beforeEach(function() {
this.request.yields(null, {
... | it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'HTTP Status: 103'
describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut.send foo: 'bar', (@error) =>... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 43 | 82 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:completion | completion | it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'HTTP Status: 103'
describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut.send foo: 'bar', (@error) =>... | it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith url: 'http://google.com', json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'HTTP Status: 506'
describe 'when request dont fail... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 43 | 82 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:raw_corpus | raw_corpus | it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}
it 'should not mutate my webhook', ->
expect(@hook).to.deep.equal url: 'http://facebook.com'
describe 'when using a crazy scheme to get mesh... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 84 | 123 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}
it 'should not mutate my webhook', ->
expect(@hook).to.deep.equal url: 'http://facebook.co... | it('should call request with whatever else I want', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
json: {
czar: 'foo'
}
});
});
it('should not mutate my webhook', function() {
return expect(this.hook).to.deep.equal({
url: 'http://facebook.com... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 84 | 123 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should call request with whatever else I want', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
json: {
czar: 'foo'
}
});
});
it('should not mutate my webhook', function() {
return expect(t... | it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}
it 'should not mutate my webhook', ->
expect(@hook).to.deep.equal url: 'http://facebook.com'
describe 'when using a crazy scheme to get mesh... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 84 | 123 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:completion | completion | it 'should call request with whatever else I want', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}
it 'should not mutate my webhook', ->
expect(@hook).to.deep.equal url: 'http://facebook.com'
describe 'when using a crazy scheme to get mesh... | it 'should call request and add my auth', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}, auth: {bearer: 'dGVzdDpnb2JibGVkZWdvb2s='}
describe 'when using a crazy scheme to get meshblu credentials forwarded but I already put in my own auth', ->
before... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 84 | 123 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:raw_corpus | raw_corpus | it 'should not override my auth', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}, auth: 'basic'
describe '->generateAndForwardMeshbluCredentials', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@r... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 125 | 163 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should not override my auth', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}, auth: 'basic'
describe '->generateAndForwardMeshbluCredentials', ->
describe 'when using a crazy scheme to get meshblu ... | it('should not override my auth', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
json: {
czar: 'foo'
},
auth: 'basic'
});
});
describe('->generateAndForwardMeshbluCredentials', function() {
return describe('when using a crazy scheme to get mes... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 125 | 163 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should not override my auth', function() {
return expect(this.request).to.have.been.calledWith({
url: 'http://facebook.com',
json: {
czar: 'foo'
},
auth: 'basic'
});
});
describe('->generateAndForwardMeshbluCredentials', function() {
... | it 'should not override my auth', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}, auth: 'basic'
describe '->generateAndForwardMeshbluCredentials', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@r... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 125 | 163 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:completion | completion | it 'should not override my auth', ->
expect(@request).to.have.been.calledWith url: 'http://facebook.com', json: {czar: 'foo'}, auth: 'basic'
describe '->generateAndForwardMeshbluCredentials', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@r... | it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
@deviceRe... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 398c56b5cc548bb75654e7e9072b88d5417bb18b | 815 | https://github.com/octoblu/meshblu/blob/398c56b5cc548bb75654e7e9072b88d5417bb18b/test/lib/MessageWebhook-spec.coffee | 125 | 163 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:raw_corpus | raw_corpus | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sin... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 1 | 40 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
... | var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub(),
generateAndStoreTokenInCache: sinon.stub()
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
removeTokenFromCache: sinon.stub()... | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sin... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:completion | completion | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
removeTokenFromCache: sinon.stub()
generateAndStoreTokenInCache: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sin... | @sut.send foo: 'bar', (@error) =>
it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith url: 'http://google.com', json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
describe 'when request do not fails, but returns error ... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:raw_corpus | raw_corpus | describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut = new MessageWebhook @deviceRecord.uuid, url: 'http://google.com', @dependencies
@sut.send foo: 'bar', (@error) =>
it 'should call request wit... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 42 | 82 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut = new MessageWebhook @deviceRecord.uuid, url: 'http://google.com', @dependencies
@sut.send foo... | describe('when request do fails and it mah fault', function() {
beforeEach(function() {
this.request.yields(null, {
statusCode: 429
}, 'chillax broham');
this.sut = new MessageWebhook(this.deviceRecord.uuid, {
url: 'http://google.com'
}, this.dependencies);
return this.sut.send({
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 42 | 82 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('when request do fails and it mah fault', function() {
beforeEach(function() {
this.request.yields(null, {
statusCode: 429
}, 'chillax broham');
this.sut = new MessageWebhook(this.deviceRecord.uuid, {
url: 'http://google.com'
... | describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut = new MessageWebhook @deviceRecord.uuid, url: 'http://google.com', @dependencies
@sut.send foo: 'bar', (@error) =>
it 'should call request wit... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 42 | 82 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:2:completion | completion | describe 'when request do fails and it mah fault', ->
beforeEach ->
@request.yields null, {statusCode: 429}, 'chillax broham'
@sut = new MessageWebhook @deviceRecord.uuid, url: 'http://google.com', @dependencies
@sut.send foo: 'bar', (@error) =>
it 'should call request wit... | expect(@request).to.have.been.calledWith url: 'http://google.com', json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
expect(@error.message).to.deep.equal 'HTTP Status: 506'
describe 'when request dont fails', ->
beforeEach ->
@request.yields null,... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 42 | 82 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:raw_corpus | raw_corpus | describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@request.yields null, statusCode: 200, 'nothing wrong'
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
@deviceRecord = uuid: 'test'
@sut = new Messag... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 84 | 124 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@request.yields null, statusCode: 200, 'nothing wrong'
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
... | describe('when using a crazy scheme to get meshblu credentials forwarded', function() {
beforeEach(function() {
this.request.yields(null, {
statusCode: 200
}, 'nothing wrong');
this.hook = {
url: 'http://facebook.com',
generateAndForwardMeshbluCredentials: true
};
this.deviceReco... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 84 | 124 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('when using a crazy scheme to get meshblu credentials forwarded', function() {
beforeEach(function() {
this.request.yields(null, {
statusCode: 200
}, 'nothing wrong');
this.hook = {
url: 'http://facebook.com',
generateAndFor... | describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@request.yields null, statusCode: 200, 'nothing wrong'
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
@deviceRecord = uuid: 'test'
@sut = new Messag... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 84 | 124 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:completion | completion | describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@request.yields null, statusCode: 200, 'nothing wrong'
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
@deviceRecord = uuid: 'test'
@sut = new Messag... | @sut.generateAndForwardMeshbluCredentials = sinon.stub().yields null
@sut.send czar: 'foo', (@error) =>
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call generateAndForwardMeshbluCredentials', ->
expect(@sut.generateAndForwardMeshbluCredentials).to... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 84 | 124 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:raw_corpus | raw_corpus | it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://fa... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 126 | 145 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded... | it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should yield a token', function() {
return expect(this.token).to.deep.equal('gobbledegook');
});
describe('->removeToken', function() {
return describe('when using a crazy scheme to get meshblu credentials forwarded', functi... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 126 | 145 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should get not error', function() {
return expect(this.error).not.to.exist;
});
it('should yield a token', function() {
return expect(this.token).to.deep.equal('gobbledegook');
});
describe('->removeToken', function() {
return describe('when using a cra... | it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://fa... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 126 | 145 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:4:completion | completion | it 'should get not error', ->
expect(@error).not.to.exist
it 'should yield a token', ->
expect(@token).to.deep.equal 'gobbledegook'
describe '->removeToken', ->
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@hook = url: 'http://fa... | @deviceRecord = uuid: 'test'
@sut = new MessageWebhook @deviceRecord.uuid, @hook, @dependencies
@revokeToken.yields null
@sut.removeToken 'test', (@error) =>
it 'should get not error', ->
expect(@error).not.to.exist
it 'should call removeTokenFromCache', ->
expect(@... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 40eb9c175750f451cab2abad242c9b786aa81002 | 815 | https://github.com/octoblu/meshblu/blob/40eb9c175750f451cab2abad242c9b786aa81002/test/lib/MessageWebhook-spec.coffee | 126 | 145 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:raw_corpus | raw_corpus | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
revokeToken: sinon.stub()
storeToken: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sinon.stub()
@revokeToken ... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 91a7e4ed0094294d168de96de0a3f76ed5f21e9b | 815 | https://github.com/octoblu/meshblu/blob/91a7e4ed0094294d168de96de0a3f76ed5f21e9b/test/lib/MessageWebhook-spec.coffee | 1 | 40 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
revokeToken: sinon.stub()
storeToken: sinon.stub()
@request = sinon.stub()
... | var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
revokeToken: sinon.stub(),
storeToken: sinon.stub()
};
this.request = sinon... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 91a7e4ed0094294d168de96de0a3f76ed5f21e9b | 815 | https://github.com/octoblu/meshblu/blob/91a7e4ed0094294d168de96de0a3f76ed5f21e9b/test/lib/MessageWebhook-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MessageWebhook;
MessageWebhook = require('../../lib/MessageWebhook');
describe('MessageWebhook', function() {
beforeEach(function() {
this.deviceRecord = {};
this.device = {
generateToken: sinon.stub(),
revokeToken: sinon.stub(),
s... | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
revokeToken: sinon.stub()
storeToken: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sinon.stub()
@revokeToken ... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 91a7e4ed0094294d168de96de0a3f76ed5f21e9b | 815 | https://github.com/octoblu/meshblu/blob/91a7e4ed0094294d168de96de0a3f76ed5f21e9b/test/lib/MessageWebhook-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:1:completion | completion | MessageWebhook = require '../../lib/MessageWebhook'
describe 'MessageWebhook', ->
beforeEach ->
@deviceRecord = {}
@device =
generateToken: sinon.stub()
revokeToken: sinon.stub()
storeToken: sinon.stub()
@request = sinon.stub()
@generateAndStoreToken = sinon.stub()
@revokeToken ... | @sut.send foo: 'bar', (@error) =>
it 'should call request with whatever I want', ->
expect(@request).to.have.been.calledWith url: 'http://google.com', json: {foo: 'bar'}
it 'should get error', ->
expect(@error).to.exist
describe 'when request do not fails, but returns error ... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 91a7e4ed0094294d168de96de0a3f76ed5f21e9b | 815 | https://github.com/octoblu/meshblu/blob/91a7e4ed0094294d168de96de0a3f76ed5f21e9b/test/lib/MessageWebhook-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:raw_corpus | raw_corpus | describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@request.yields null, statusCode: 200, 'nothing wrong'
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
@deviceRecord = uuid: 'test'
@sut = new Messag... | CoffeeScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 91a7e4ed0094294d168de96de0a3f76ed5f21e9b | 815 | https://github.com/octoblu/meshblu/blob/91a7e4ed0094294d168de96de0a3f76ed5f21e9b/test/lib/MessageWebhook-spec.coffee | 84 | 125 | ||
octoblu/meshblu:test/lib/MessageWebhook-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'when using a crazy scheme to get meshblu credentials forwarded', ->
beforeEach ->
@request.yields null, statusCode: 200, 'nothing wrong'
@hook = url: 'http://facebook.com', generateAndForwardMeshbluCredentials: true
... | describe('when using a crazy scheme to get meshblu credentials forwarded', function() {
beforeEach(function() {
this.request.yields(null, {
statusCode: 200
}, 'nothing wrong');
this.hook = {
url: 'http://facebook.com',
generateAndForwardMeshbluCredentials: true
};
this.deviceReco... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/MessageWebhook-spec.coffee | MIT | 91a7e4ed0094294d168de96de0a3f76ed5f21e9b | 815 | https://github.com/octoblu/meshblu/blob/91a7e4ed0094294d168de96de0a3f76ed5f21e9b/test/lib/MessageWebhook-spec.coffee | 84 | 125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.