entities listlengths 1 8.61k | max_stars_repo_path stringlengths 7 172 | max_stars_repo_name stringlengths 5 89 | max_stars_count int64 0 82k | content stringlengths 14 1.05M | id stringlengths 2 6 | new_content stringlengths 15 1.05M | modified bool 1 class | references stringlengths 29 1.05M |
|---|---|---|---|---|---|---|---|---|
[
{
"context": "s Info\n redis_host: process.env.REDIS_HOST || '127.0.0.1'\n redis_port: +process.env.REDIS_PORT || 6379\n",
"end": 508,
"score": 0.9997134804725647,
"start": 499,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "db: +process.env.REDIS_DB || 2\n redis... | config/default.coffee | SizzlingStats/sizzlingstats.com | 9 | port = +process.env.PORT || 8001
module.exports =
cfg:
port: port
address: process.env.ADDRESS || 'http://localhost:' + port
socket_io_address: process.env.SOCKET_IO_ADDRESS || 'http://localhost'
socket_io_port: process.env.SOCKET_IO_PORT || port
mongo_url: process.env.MONGO_URL || 'mongodb://localhost/sizzlingstats'
elasticsearch_url: process.env.ELASTICSEARCH_URL || 'http://localhost:9200/sizzlingstats'
# Redis Info
redis_host: process.env.REDIS_HOST || '127.0.0.1'
redis_port: +process.env.REDIS_PORT || 6379
redis_db: +process.env.REDIS_DB || 2
redis_password: process.env.REDIS_PASSWORD
session_prefix: (process.env.SESSION_PREFIX) || 'ss_sess'
# Stats Sessions are valid for only 1 hour since last update
stats_session_timeout: 1*60*60*1000
# Check for stat-sessions to expire every 20 minutes
session_expiry_interval: 20
# How long to wait before refreshing steam API info for a player - 1 week
# (country, avatar url, steam profile name)
player_metadata_cache_length: 7*24*60*60*1000
s3_stv_bucket: 'sizzlingstv'
s3_stv_key: 'tests/'
# 3*60*60 == 3 hours (unit is in seconds)
s3_upload_url_expires: 3*60*60
devScripts: [
# order matters here
'lib/jquery/jquery-2.1.1.js'
'lib/angular/angular.js'
'lib/angular/angular-route.js'
]
| 35718 | port = +process.env.PORT || 8001
module.exports =
cfg:
port: port
address: process.env.ADDRESS || 'http://localhost:' + port
socket_io_address: process.env.SOCKET_IO_ADDRESS || 'http://localhost'
socket_io_port: process.env.SOCKET_IO_PORT || port
mongo_url: process.env.MONGO_URL || 'mongodb://localhost/sizzlingstats'
elasticsearch_url: process.env.ELASTICSEARCH_URL || 'http://localhost:9200/sizzlingstats'
# Redis Info
redis_host: process.env.REDIS_HOST || '127.0.0.1'
redis_port: +process.env.REDIS_PORT || 6379
redis_db: +process.env.REDIS_DB || 2
redis_password: <PASSWORD>
session_prefix: (process.env.SESSION_PREFIX) || 'ss_sess'
# Stats Sessions are valid for only 1 hour since last update
stats_session_timeout: 1*60*60*1000
# Check for stat-sessions to expire every 20 minutes
session_expiry_interval: 20
# How long to wait before refreshing steam API info for a player - 1 week
# (country, avatar url, steam profile name)
player_metadata_cache_length: 7*24*60*60*1000
s3_stv_bucket: 'sizzlingstv'
s3_stv_key: 'tests/'
# 3*60*60 == 3 hours (unit is in seconds)
s3_upload_url_expires: 3*60*60
devScripts: [
# order matters here
'lib/jquery/jquery-2.1.1.js'
'lib/angular/angular.js'
'lib/angular/angular-route.js'
]
| true | port = +process.env.PORT || 8001
module.exports =
cfg:
port: port
address: process.env.ADDRESS || 'http://localhost:' + port
socket_io_address: process.env.SOCKET_IO_ADDRESS || 'http://localhost'
socket_io_port: process.env.SOCKET_IO_PORT || port
mongo_url: process.env.MONGO_URL || 'mongodb://localhost/sizzlingstats'
elasticsearch_url: process.env.ELASTICSEARCH_URL || 'http://localhost:9200/sizzlingstats'
# Redis Info
redis_host: process.env.REDIS_HOST || '127.0.0.1'
redis_port: +process.env.REDIS_PORT || 6379
redis_db: +process.env.REDIS_DB || 2
redis_password: PI:PASSWORD:<PASSWORD>END_PI
session_prefix: (process.env.SESSION_PREFIX) || 'ss_sess'
# Stats Sessions are valid for only 1 hour since last update
stats_session_timeout: 1*60*60*1000
# Check for stat-sessions to expire every 20 minutes
session_expiry_interval: 20
# How long to wait before refreshing steam API info for a player - 1 week
# (country, avatar url, steam profile name)
player_metadata_cache_length: 7*24*60*60*1000
s3_stv_bucket: 'sizzlingstv'
s3_stv_key: 'tests/'
# 3*60*60 == 3 hours (unit is in seconds)
s3_upload_url_expires: 3*60*60
devScripts: [
# order matters here
'lib/jquery/jquery-2.1.1.js'
'lib/angular/angular.js'
'lib/angular/angular-route.js'
]
|
[
{
"context": " @$scope.playlists = [\n {\n title: 'Reggae'\n id: 1\n }\n {\n title: 'Ch",
"end": 136,
"score": 0.9997519850730896,
"start": 130,
"tag": "NAME",
"value": "Reggae"
},
{
"context": "ae'\n id: 1\n }\n {\n titl... | www/coffee/controllers/playlists.controller.coffee | yoophi/ionic-coffee-sidebar | 0 | class PlaylistsCtrl extends BaseController
@inject '$scope'
initialize: ->
@$scope.playlists = [
{
title: 'Reggae'
id: 1
}
{
title: 'Chill'
id: 2
}
{
title: 'Dubstep'
id: 3
}
{
title: 'Indie'
id: 4
}
{
title: 'Rap'
id: 5
}
{
title: 'Cowbell'
id: 6
}
]
return
angular.module 'starter.controllers'
.controller 'PlaylistsCtrl', PlaylistsCtrl
| 26843 | class PlaylistsCtrl extends BaseController
@inject '$scope'
initialize: ->
@$scope.playlists = [
{
title: '<NAME>'
id: 1
}
{
title: '<NAME>'
id: 2
}
{
title: '<NAME>'
id: 3
}
{
title: '<NAME>'
id: 4
}
{
title: '<NAME>'
id: 5
}
{
title: '<NAME>'
id: 6
}
]
return
angular.module 'starter.controllers'
.controller 'PlaylistsCtrl', PlaylistsCtrl
| true | class PlaylistsCtrl extends BaseController
@inject '$scope'
initialize: ->
@$scope.playlists = [
{
title: 'PI:NAME:<NAME>END_PI'
id: 1
}
{
title: 'PI:NAME:<NAME>END_PI'
id: 2
}
{
title: 'PI:NAME:<NAME>END_PI'
id: 3
}
{
title: 'PI:NAME:<NAME>END_PI'
id: 4
}
{
title: 'PI:NAME:<NAME>END_PI'
id: 5
}
{
title: 'PI:NAME:<NAME>END_PI'
id: 6
}
]
return
angular.module 'starter.controllers'
.controller 'PlaylistsCtrl', PlaylistsCtrl
|
[
{
"context": "appingsValue = opts.mappings[kkey]\n key = kkey.trim();\n \n swaggerFiles = (if optsMappingsValue ",
"end": 547,
"score": 0.6559970378875732,
"start": 543,
"tag": "KEY",
"value": "trim"
}
] | .gulp/regeneration.iced | Azure/autorest.nodejs | 6 |
###############################################
# LEGACY
# Instead: have bunch of configuration files sitting in a well-known spot, discover them, feed them to AutoRest, done.
path = require("path");
repositoryLocalRoot = path.dirname(__dirname);
regenExpected = (opts,done) ->
outputDir = if !!opts.outputBaseDir then "#{opts.outputBaseDir}/#{opts.outputDir}" else opts.outputDir
keys = Object.getOwnPropertyNames(opts.mappings)
instances = keys.length
for kkey in keys
optsMappingsValue = opts.mappings[kkey]
key = kkey.trim();
swaggerFiles = (if optsMappingsValue instanceof Array then optsMappingsValue[0] else optsMappingsValue).split(";")
args = [
"--#{opts.language}",
"--clear-output-folder",
"--output-folder=#{outputDir}/#{key}",
"--license-header=#{if !!opts.header then opts.header else 'MICROSOFT_MIT_NO_VERSION'}",
"--enable-xml"
]
for swaggerFile in swaggerFiles
args.push("--input-file=#{if !!opts.inputBaseDir then "#{opts.inputBaseDir}/#{swaggerFile}" else swaggerFile}")
if (opts.addCredentials)
args.push("--#{opts.language}.add-credentials=true")
if (opts.azureArm)
args.push("--#{opts.language}.azure-arm=true")
if (opts.fluent)
args.push("--#{opts.language}.fluent=true")
if (opts.syncMethods)
args.push("--#{opts.language}.sync-methods=#{opts.syncMethods}")
if (opts.flatteningThreshold)
args.push("--#{opts.language}.payload-flattening-threshold=#{opts.flatteningThreshold}")
if (opts.generatePackageJson?)
args.push("--#{opts.language}.generate-package-json=#{opts.generatePackageJson}")
if (opts.generateReadmeMd?)
args.push("--#{opts.language}.generate-readme-md=#{opts.generateReadmeMd}")
if (opts.generateLicenseTxt?)
args.push("--#{opts.language}.generate-license-txt=#{opts.generateLicenseTxt}")
if (opts.sourceCodeFolderPath?)
args.push("--#{opts.language}.source-code-folder-path=\'#{opts.sourceCodeFolderPath}\'")
if (opts.packageName)
args.push("--#{opts.language}.package-name=#{opts.packageName}")
if (opts.packageVersion)
args.push("--#{opts.language}.package-version=#{opts.packageVersion}")
if (!!opts.nsPrefix)
if (optsMappingsValue instanceof Array && optsMappingsValue[1] != undefined)
args.push("--#{opts.language}.namespace=#{optsMappingsValue[1]}")
else
args.push("--#{opts.language}.namespace=#{[opts.nsPrefix, key.replace(/\/|\./, '')].join('.')}")
if (opts['override-info.version'])
args.push("--override-info.version=#{opts['override-info.version']}")
if (opts['override-info.title'])
args.push("--override-info.title=#{opts['override-info.title']}")
if (opts['override-info.description'])
args.push("--override-info.description=#{opts['override-info.description']}")
args.push("--use=#{repositoryLocalRoot}")
autorest args,() =>
instances--
return done() if instances is 0
defaultMappings = {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
'AcceptanceTests/BodyArray': 'body-array.json',
'AcceptanceTests/BodyBoolean': 'body-boolean.json',
'AcceptanceTests/BodyByte': 'body-byte.json',
'AcceptanceTests/BodyComplex': 'body-complex.json',
'AcceptanceTests/BodyDate': 'body-date.json',
'AcceptanceTests/BodyDateTime': 'body-datetime.json',
'AcceptanceTests/BodyDateTimeRfc1123': 'body-datetime-rfc1123.json',
'AcceptanceTests/BodyDuration': 'body-duration.json',
'AcceptanceTests/BodyDictionary': 'body-dictionary.json',
'AcceptanceTests/BodyFile': 'body-file.json',
'AcceptanceTests/BodyFormData': 'body-formdata.json',
'AcceptanceTests/BodyInteger': 'body-integer.json',
'AcceptanceTests/BodyNumber': 'body-number.json',
'AcceptanceTests/BodyString': 'body-string.json',
'AcceptanceTests/Header': 'header.json',
'AcceptanceTests/Http': 'httpInfrastructure.json',
'AcceptanceTests/Report': 'report.json',
'AcceptanceTests/RequiredOptional': 'required-optional.json',
'AcceptanceTests/Url': 'url.json',
'AcceptanceTests/Validation': 'validation.json',
'AcceptanceTests/CustomBaseUri': 'custom-baseUrl.json',
'AcceptanceTests/CustomBaseUriMoreOptions': 'custom-baseUrl-more-options.json',
'AcceptanceTests/ModelFlattening': 'model-flattening.json',
'AcceptanceTests/UrlMultiCollectionFormat' : 'url-multi-collectionFormat.json',
'AcceptanceTests/ExtensibleEnums': 'extensible-enums-swagger.json'
'AcceptanceTests/AdditionalProperties': 'additionalProperties.json'
}
defaultAzureMappings = {
'AcceptanceTests/Lro': 'lro.json',
'AcceptanceTests/Paging': 'paging.json',
'AcceptanceTests/AzureReport': 'azure-report.json',
'AcceptanceTests/AzureParameterGrouping': 'azure-parameter-grouping.json',
'AcceptanceTests/AzureResource': 'azure-resource.json',
'AcceptanceTests/Head': 'head.json',
'AcceptanceTests/HeadExceptions': 'head-exceptions.json',
'AcceptanceTests/SubscriptionIdApiVersion': 'subscriptionId-apiVersion.json',
'AcceptanceTests/AzureSpecials': 'azure-special-properties.json',
'AcceptanceTests/CustomBaseUri': 'custom-baseUrl.json'
}
compositeMappings = {
'AcceptanceTests/CompositeBoolIntClient': 'body-boolean.json;body-integer.json'
}
azureCompositeMappings = {
'AcceptanceTests/AzureCompositeModelClient': 'complex-model.json;body-complex.json'
}
nodeAzureMappings = {
'AcceptanceTests/StorageManagementClient': 'storage.json'
}
nodeMappings = {
'AcceptanceTests/ComplexModelClient': 'complex-model.json'
}
swaggerDir = "node_modules/@microsoft.azure/autorest.testserver/swagger"
task 'regenerate-nodecomposite', '', (done) ->
regenExpected {
'outputBaseDir': 'test/vanilla',
'inputBaseDir': swaggerDir,
'mappings': compositeMappings,
'modeler': 'CompositeSwagger',
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'override-info.title': "Composite Bool Int",
'override-info.description': "Composite Swagger Client that represents merging body boolean and body integer swagger clients",
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-nodeazurecomposite', '', (done) ->
regenExpected {
'outputBaseDir': 'test/azure',
'inputBaseDir': swaggerDir,
'mappings': azureCompositeMappings,
'modeler': 'CompositeSwagger',
'outputDir': 'Expected',
'language': 'nodejs',
'azureArm': true,
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'override-info.version': "1.0.0",
'override-info.title': "Azure Composite Model",
'override-info.description': "Composite Swagger Client that represents merging body complex and complex model swagger clients",
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-nodeazure', '', ['regenerate-nodeazurecomposite'], (done) ->
for p of defaultAzureMappings
nodeAzureMappings[p] = defaultAzureMappings[p]
regenExpected {
'outputBaseDir': 'test/azure',
'inputBaseDir': swaggerDir,
'mappings': nodeAzureMappings,
'outputDir': 'Expected',
'language': 'nodejs',
'azureArm': true,
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-node', '', ['regenerate-nodecomposite'], (done) ->
for p of defaultMappings
nodeMappings[p] = defaultMappings[p]
regenExpected {
'outputBaseDir': 'test/vanilla',
'inputBaseDir': swaggerDir,
'mappings': nodeMappings,
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
regenerateNodeOptionsDependencies = [
'regenerate-node-generatepackagejson-vanilla-false',
'regenerate-node-generatepackagejson-azure-false',
'regenerate-node-generatereadmemd-vanilla-true',
'regenerate-node-generatereadmemd-azure-true',
'regenerate-node-generatelicense-vanilla-true'
'regenerate-node-generatelicense-vanilla-false',
'regenerate-node-sourcecodefolderpath-vanilla-sources',
'regenerate-node-sourcecodefolderpath-azure-sources'
]
task 'regenerate-node-options', '', regenerateNodeOptionsDependencies, (done) ->
done();
task 'regenerate-node-generatepackagejson-vanilla-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatepackagejson-vanilla-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.2.3'
},done
return null
task 'regenerate-node-generatepackagejson-azure-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatepackagejson-azure-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatereadmemd-vanilla-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatereadmemd-vanilla-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateReadmeMd': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.2.3'
},done
return null
task 'regenerate-node-generatereadmemd-azure-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatereadmemd-azure-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateReadmeMd': true,
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatelicense-vanilla-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatelicense-vanilla-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateLicenseTxt': false,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatelicense-vanilla-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatelicense-vanilla-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateLicenseTxt': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-sourcecodefolderpath-vanilla-sources', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/sourcecodefolderpath-vanilla-sources',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview',
'sourceCodeFolderPath': 'sources'
},done
return null
task 'regenerate-node-sourcecodefolderpath-azure-sources', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/sourcecodefolderpath-azure-sources',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview',
'sourceCodeFolderPath': 'sources'
},done
return null
task 'regenerate', "regenerate expected code for tests", ['regenerate-node', 'regenerate-nodeazure', 'regenerate-node-options'], (done) ->
done();
| 52926 |
###############################################
# LEGACY
# Instead: have bunch of configuration files sitting in a well-known spot, discover them, feed them to AutoRest, done.
path = require("path");
repositoryLocalRoot = path.dirname(__dirname);
regenExpected = (opts,done) ->
outputDir = if !!opts.outputBaseDir then "#{opts.outputBaseDir}/#{opts.outputDir}" else opts.outputDir
keys = Object.getOwnPropertyNames(opts.mappings)
instances = keys.length
for kkey in keys
optsMappingsValue = opts.mappings[kkey]
key = kkey.<KEY>();
swaggerFiles = (if optsMappingsValue instanceof Array then optsMappingsValue[0] else optsMappingsValue).split(";")
args = [
"--#{opts.language}",
"--clear-output-folder",
"--output-folder=#{outputDir}/#{key}",
"--license-header=#{if !!opts.header then opts.header else 'MICROSOFT_MIT_NO_VERSION'}",
"--enable-xml"
]
for swaggerFile in swaggerFiles
args.push("--input-file=#{if !!opts.inputBaseDir then "#{opts.inputBaseDir}/#{swaggerFile}" else swaggerFile}")
if (opts.addCredentials)
args.push("--#{opts.language}.add-credentials=true")
if (opts.azureArm)
args.push("--#{opts.language}.azure-arm=true")
if (opts.fluent)
args.push("--#{opts.language}.fluent=true")
if (opts.syncMethods)
args.push("--#{opts.language}.sync-methods=#{opts.syncMethods}")
if (opts.flatteningThreshold)
args.push("--#{opts.language}.payload-flattening-threshold=#{opts.flatteningThreshold}")
if (opts.generatePackageJson?)
args.push("--#{opts.language}.generate-package-json=#{opts.generatePackageJson}")
if (opts.generateReadmeMd?)
args.push("--#{opts.language}.generate-readme-md=#{opts.generateReadmeMd}")
if (opts.generateLicenseTxt?)
args.push("--#{opts.language}.generate-license-txt=#{opts.generateLicenseTxt}")
if (opts.sourceCodeFolderPath?)
args.push("--#{opts.language}.source-code-folder-path=\'#{opts.sourceCodeFolderPath}\'")
if (opts.packageName)
args.push("--#{opts.language}.package-name=#{opts.packageName}")
if (opts.packageVersion)
args.push("--#{opts.language}.package-version=#{opts.packageVersion}")
if (!!opts.nsPrefix)
if (optsMappingsValue instanceof Array && optsMappingsValue[1] != undefined)
args.push("--#{opts.language}.namespace=#{optsMappingsValue[1]}")
else
args.push("--#{opts.language}.namespace=#{[opts.nsPrefix, key.replace(/\/|\./, '')].join('.')}")
if (opts['override-info.version'])
args.push("--override-info.version=#{opts['override-info.version']}")
if (opts['override-info.title'])
args.push("--override-info.title=#{opts['override-info.title']}")
if (opts['override-info.description'])
args.push("--override-info.description=#{opts['override-info.description']}")
args.push("--use=#{repositoryLocalRoot}")
autorest args,() =>
instances--
return done() if instances is 0
defaultMappings = {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
'AcceptanceTests/BodyArray': 'body-array.json',
'AcceptanceTests/BodyBoolean': 'body-boolean.json',
'AcceptanceTests/BodyByte': 'body-byte.json',
'AcceptanceTests/BodyComplex': 'body-complex.json',
'AcceptanceTests/BodyDate': 'body-date.json',
'AcceptanceTests/BodyDateTime': 'body-datetime.json',
'AcceptanceTests/BodyDateTimeRfc1123': 'body-datetime-rfc1123.json',
'AcceptanceTests/BodyDuration': 'body-duration.json',
'AcceptanceTests/BodyDictionary': 'body-dictionary.json',
'AcceptanceTests/BodyFile': 'body-file.json',
'AcceptanceTests/BodyFormData': 'body-formdata.json',
'AcceptanceTests/BodyInteger': 'body-integer.json',
'AcceptanceTests/BodyNumber': 'body-number.json',
'AcceptanceTests/BodyString': 'body-string.json',
'AcceptanceTests/Header': 'header.json',
'AcceptanceTests/Http': 'httpInfrastructure.json',
'AcceptanceTests/Report': 'report.json',
'AcceptanceTests/RequiredOptional': 'required-optional.json',
'AcceptanceTests/Url': 'url.json',
'AcceptanceTests/Validation': 'validation.json',
'AcceptanceTests/CustomBaseUri': 'custom-baseUrl.json',
'AcceptanceTests/CustomBaseUriMoreOptions': 'custom-baseUrl-more-options.json',
'AcceptanceTests/ModelFlattening': 'model-flattening.json',
'AcceptanceTests/UrlMultiCollectionFormat' : 'url-multi-collectionFormat.json',
'AcceptanceTests/ExtensibleEnums': 'extensible-enums-swagger.json'
'AcceptanceTests/AdditionalProperties': 'additionalProperties.json'
}
defaultAzureMappings = {
'AcceptanceTests/Lro': 'lro.json',
'AcceptanceTests/Paging': 'paging.json',
'AcceptanceTests/AzureReport': 'azure-report.json',
'AcceptanceTests/AzureParameterGrouping': 'azure-parameter-grouping.json',
'AcceptanceTests/AzureResource': 'azure-resource.json',
'AcceptanceTests/Head': 'head.json',
'AcceptanceTests/HeadExceptions': 'head-exceptions.json',
'AcceptanceTests/SubscriptionIdApiVersion': 'subscriptionId-apiVersion.json',
'AcceptanceTests/AzureSpecials': 'azure-special-properties.json',
'AcceptanceTests/CustomBaseUri': 'custom-baseUrl.json'
}
compositeMappings = {
'AcceptanceTests/CompositeBoolIntClient': 'body-boolean.json;body-integer.json'
}
azureCompositeMappings = {
'AcceptanceTests/AzureCompositeModelClient': 'complex-model.json;body-complex.json'
}
nodeAzureMappings = {
'AcceptanceTests/StorageManagementClient': 'storage.json'
}
nodeMappings = {
'AcceptanceTests/ComplexModelClient': 'complex-model.json'
}
swaggerDir = "node_modules/@microsoft.azure/autorest.testserver/swagger"
task 'regenerate-nodecomposite', '', (done) ->
regenExpected {
'outputBaseDir': 'test/vanilla',
'inputBaseDir': swaggerDir,
'mappings': compositeMappings,
'modeler': 'CompositeSwagger',
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'override-info.title': "Composite Bool Int",
'override-info.description': "Composite Swagger Client that represents merging body boolean and body integer swagger clients",
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-nodeazurecomposite', '', (done) ->
regenExpected {
'outputBaseDir': 'test/azure',
'inputBaseDir': swaggerDir,
'mappings': azureCompositeMappings,
'modeler': 'CompositeSwagger',
'outputDir': 'Expected',
'language': 'nodejs',
'azureArm': true,
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'override-info.version': "1.0.0",
'override-info.title': "Azure Composite Model",
'override-info.description': "Composite Swagger Client that represents merging body complex and complex model swagger clients",
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-nodeazure', '', ['regenerate-nodeazurecomposite'], (done) ->
for p of defaultAzureMappings
nodeAzureMappings[p] = defaultAzureMappings[p]
regenExpected {
'outputBaseDir': 'test/azure',
'inputBaseDir': swaggerDir,
'mappings': nodeAzureMappings,
'outputDir': 'Expected',
'language': 'nodejs',
'azureArm': true,
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-node', '', ['regenerate-nodecomposite'], (done) ->
for p of defaultMappings
nodeMappings[p] = defaultMappings[p]
regenExpected {
'outputBaseDir': 'test/vanilla',
'inputBaseDir': swaggerDir,
'mappings': nodeMappings,
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
regenerateNodeOptionsDependencies = [
'regenerate-node-generatepackagejson-vanilla-false',
'regenerate-node-generatepackagejson-azure-false',
'regenerate-node-generatereadmemd-vanilla-true',
'regenerate-node-generatereadmemd-azure-true',
'regenerate-node-generatelicense-vanilla-true'
'regenerate-node-generatelicense-vanilla-false',
'regenerate-node-sourcecodefolderpath-vanilla-sources',
'regenerate-node-sourcecodefolderpath-azure-sources'
]
task 'regenerate-node-options', '', regenerateNodeOptionsDependencies, (done) ->
done();
task 'regenerate-node-generatepackagejson-vanilla-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatepackagejson-vanilla-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.2.3'
},done
return null
task 'regenerate-node-generatepackagejson-azure-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatepackagejson-azure-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatereadmemd-vanilla-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatereadmemd-vanilla-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateReadmeMd': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.2.3'
},done
return null
task 'regenerate-node-generatereadmemd-azure-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatereadmemd-azure-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateReadmeMd': true,
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatelicense-vanilla-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatelicense-vanilla-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateLicenseTxt': false,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatelicense-vanilla-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatelicense-vanilla-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateLicenseTxt': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-sourcecodefolderpath-vanilla-sources', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/sourcecodefolderpath-vanilla-sources',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview',
'sourceCodeFolderPath': 'sources'
},done
return null
task 'regenerate-node-sourcecodefolderpath-azure-sources', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/sourcecodefolderpath-azure-sources',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview',
'sourceCodeFolderPath': 'sources'
},done
return null
task 'regenerate', "regenerate expected code for tests", ['regenerate-node', 'regenerate-nodeazure', 'regenerate-node-options'], (done) ->
done();
| true |
###############################################
# LEGACY
# Instead: have bunch of configuration files sitting in a well-known spot, discover them, feed them to AutoRest, done.
path = require("path");
repositoryLocalRoot = path.dirname(__dirname);
regenExpected = (opts,done) ->
outputDir = if !!opts.outputBaseDir then "#{opts.outputBaseDir}/#{opts.outputDir}" else opts.outputDir
keys = Object.getOwnPropertyNames(opts.mappings)
instances = keys.length
for kkey in keys
optsMappingsValue = opts.mappings[kkey]
key = kkey.PI:KEY:<KEY>END_PI();
swaggerFiles = (if optsMappingsValue instanceof Array then optsMappingsValue[0] else optsMappingsValue).split(";")
args = [
"--#{opts.language}",
"--clear-output-folder",
"--output-folder=#{outputDir}/#{key}",
"--license-header=#{if !!opts.header then opts.header else 'MICROSOFT_MIT_NO_VERSION'}",
"--enable-xml"
]
for swaggerFile in swaggerFiles
args.push("--input-file=#{if !!opts.inputBaseDir then "#{opts.inputBaseDir}/#{swaggerFile}" else swaggerFile}")
if (opts.addCredentials)
args.push("--#{opts.language}.add-credentials=true")
if (opts.azureArm)
args.push("--#{opts.language}.azure-arm=true")
if (opts.fluent)
args.push("--#{opts.language}.fluent=true")
if (opts.syncMethods)
args.push("--#{opts.language}.sync-methods=#{opts.syncMethods}")
if (opts.flatteningThreshold)
args.push("--#{opts.language}.payload-flattening-threshold=#{opts.flatteningThreshold}")
if (opts.generatePackageJson?)
args.push("--#{opts.language}.generate-package-json=#{opts.generatePackageJson}")
if (opts.generateReadmeMd?)
args.push("--#{opts.language}.generate-readme-md=#{opts.generateReadmeMd}")
if (opts.generateLicenseTxt?)
args.push("--#{opts.language}.generate-license-txt=#{opts.generateLicenseTxt}")
if (opts.sourceCodeFolderPath?)
args.push("--#{opts.language}.source-code-folder-path=\'#{opts.sourceCodeFolderPath}\'")
if (opts.packageName)
args.push("--#{opts.language}.package-name=#{opts.packageName}")
if (opts.packageVersion)
args.push("--#{opts.language}.package-version=#{opts.packageVersion}")
if (!!opts.nsPrefix)
if (optsMappingsValue instanceof Array && optsMappingsValue[1] != undefined)
args.push("--#{opts.language}.namespace=#{optsMappingsValue[1]}")
else
args.push("--#{opts.language}.namespace=#{[opts.nsPrefix, key.replace(/\/|\./, '')].join('.')}")
if (opts['override-info.version'])
args.push("--override-info.version=#{opts['override-info.version']}")
if (opts['override-info.title'])
args.push("--override-info.title=#{opts['override-info.title']}")
if (opts['override-info.description'])
args.push("--override-info.description=#{opts['override-info.description']}")
args.push("--use=#{repositoryLocalRoot}")
autorest args,() =>
instances--
return done() if instances is 0
defaultMappings = {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
'AcceptanceTests/BodyArray': 'body-array.json',
'AcceptanceTests/BodyBoolean': 'body-boolean.json',
'AcceptanceTests/BodyByte': 'body-byte.json',
'AcceptanceTests/BodyComplex': 'body-complex.json',
'AcceptanceTests/BodyDate': 'body-date.json',
'AcceptanceTests/BodyDateTime': 'body-datetime.json',
'AcceptanceTests/BodyDateTimeRfc1123': 'body-datetime-rfc1123.json',
'AcceptanceTests/BodyDuration': 'body-duration.json',
'AcceptanceTests/BodyDictionary': 'body-dictionary.json',
'AcceptanceTests/BodyFile': 'body-file.json',
'AcceptanceTests/BodyFormData': 'body-formdata.json',
'AcceptanceTests/BodyInteger': 'body-integer.json',
'AcceptanceTests/BodyNumber': 'body-number.json',
'AcceptanceTests/BodyString': 'body-string.json',
'AcceptanceTests/Header': 'header.json',
'AcceptanceTests/Http': 'httpInfrastructure.json',
'AcceptanceTests/Report': 'report.json',
'AcceptanceTests/RequiredOptional': 'required-optional.json',
'AcceptanceTests/Url': 'url.json',
'AcceptanceTests/Validation': 'validation.json',
'AcceptanceTests/CustomBaseUri': 'custom-baseUrl.json',
'AcceptanceTests/CustomBaseUriMoreOptions': 'custom-baseUrl-more-options.json',
'AcceptanceTests/ModelFlattening': 'model-flattening.json',
'AcceptanceTests/UrlMultiCollectionFormat' : 'url-multi-collectionFormat.json',
'AcceptanceTests/ExtensibleEnums': 'extensible-enums-swagger.json'
'AcceptanceTests/AdditionalProperties': 'additionalProperties.json'
}
defaultAzureMappings = {
'AcceptanceTests/Lro': 'lro.json',
'AcceptanceTests/Paging': 'paging.json',
'AcceptanceTests/AzureReport': 'azure-report.json',
'AcceptanceTests/AzureParameterGrouping': 'azure-parameter-grouping.json',
'AcceptanceTests/AzureResource': 'azure-resource.json',
'AcceptanceTests/Head': 'head.json',
'AcceptanceTests/HeadExceptions': 'head-exceptions.json',
'AcceptanceTests/SubscriptionIdApiVersion': 'subscriptionId-apiVersion.json',
'AcceptanceTests/AzureSpecials': 'azure-special-properties.json',
'AcceptanceTests/CustomBaseUri': 'custom-baseUrl.json'
}
compositeMappings = {
'AcceptanceTests/CompositeBoolIntClient': 'body-boolean.json;body-integer.json'
}
azureCompositeMappings = {
'AcceptanceTests/AzureCompositeModelClient': 'complex-model.json;body-complex.json'
}
nodeAzureMappings = {
'AcceptanceTests/StorageManagementClient': 'storage.json'
}
nodeMappings = {
'AcceptanceTests/ComplexModelClient': 'complex-model.json'
}
swaggerDir = "node_modules/@microsoft.azure/autorest.testserver/swagger"
task 'regenerate-nodecomposite', '', (done) ->
regenExpected {
'outputBaseDir': 'test/vanilla',
'inputBaseDir': swaggerDir,
'mappings': compositeMappings,
'modeler': 'CompositeSwagger',
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'override-info.title': "Composite Bool Int",
'override-info.description': "Composite Swagger Client that represents merging body boolean and body integer swagger clients",
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-nodeazurecomposite', '', (done) ->
regenExpected {
'outputBaseDir': 'test/azure',
'inputBaseDir': swaggerDir,
'mappings': azureCompositeMappings,
'modeler': 'CompositeSwagger',
'outputDir': 'Expected',
'language': 'nodejs',
'azureArm': true,
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'override-info.version': "1.0.0",
'override-info.title': "Azure Composite Model",
'override-info.description': "Composite Swagger Client that represents merging body complex and complex model swagger clients",
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-nodeazure', '', ['regenerate-nodeazurecomposite'], (done) ->
for p of defaultAzureMappings
nodeAzureMappings[p] = defaultAzureMappings[p]
regenExpected {
'outputBaseDir': 'test/azure',
'inputBaseDir': swaggerDir,
'mappings': nodeAzureMappings,
'outputDir': 'Expected',
'language': 'nodejs',
'azureArm': true,
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
task 'regenerate-node', '', ['regenerate-nodecomposite'], (done) ->
for p of defaultMappings
nodeMappings[p] = defaultMappings[p]
regenExpected {
'outputBaseDir': 'test/vanilla',
'inputBaseDir': swaggerDir,
'mappings': nodeMappings,
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'generateReadmeMd': false,
'generateLicenseTxt': false,
'sourceCodeFolderPath': ''
},done
return null
regenerateNodeOptionsDependencies = [
'regenerate-node-generatepackagejson-vanilla-false',
'regenerate-node-generatepackagejson-azure-false',
'regenerate-node-generatereadmemd-vanilla-true',
'regenerate-node-generatereadmemd-azure-true',
'regenerate-node-generatelicense-vanilla-true'
'regenerate-node-generatelicense-vanilla-false',
'regenerate-node-sourcecodefolderpath-vanilla-sources',
'regenerate-node-sourcecodefolderpath-azure-sources'
]
task 'regenerate-node-options', '', regenerateNodeOptionsDependencies, (done) ->
done();
task 'regenerate-node-generatepackagejson-vanilla-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatepackagejson-vanilla-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.2.3'
},done
return null
task 'regenerate-node-generatepackagejson-azure-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatepackagejson-azure-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generatePackageJson': false,
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatereadmemd-vanilla-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatereadmemd-vanilla-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateReadmeMd': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.2.3'
},done
return null
task 'regenerate-node-generatereadmemd-azure-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatereadmemd-azure-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateReadmeMd': true,
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatelicense-vanilla-false', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatelicense-vanilla-false',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateLicenseTxt': false,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-generatelicense-vanilla-true', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/generatelicense-vanilla-true',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'generateLicenseTxt': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview'
},done
return null
task 'regenerate-node-sourcecodefolderpath-vanilla-sources', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/sourcecodefolderpath-vanilla-sources',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview',
'sourceCodeFolderPath': 'sources'
},done
return null
task 'regenerate-node-sourcecodefolderpath-azure-sources', '', [], (done) ->
regenExpected {
'outputBaseDir': 'test/options/sourcecodefolderpath-azure-sources',
'inputBaseDir': swaggerDir,
'mappings': {
'AcceptanceTests/ParameterFlattening': 'parameter-flattening.json',
},
'outputDir': 'Expected',
'language': 'nodejs',
'nsPrefix': 'Fixtures',
'flatteningThreshold': '1',
'azureArm': true,
'packageName': 'azure-arm-parameterflattening',
'packageVersion': '1.0.0-preview',
'sourceCodeFolderPath': 'sources'
},done
return null
task 'regenerate', "regenerate expected code for tests", ['regenerate-node', 'regenerate-nodeazure', 'regenerate-node-options'], (done) ->
done();
|
[
{
"context": " knex(@toModel.metadata.tableName)\n .select(@returning)\n .leftJoin(@through, \"#{@toModel",
"end": 2152,
"score": 0.8078191876411438,
"start": 2152,
"tag": "USERNAME",
"value": ""
},
{
"context": "ame)\n .select(@returning)\n .leftJoin(@thr... | src/fields/manyToMany.coffee | BlackBalloon/hapi-simple-orm | 2 | 'use strict'
_ = require 'underscore'
knexConf = require process.cwd() + '/knexfile'
knex = require('knex')(knexConf[process.env.NODE_ENV])
Joi = require 'joi'
class ManyToMany
@acceptedParameters: [
'schema'
'toModel'
'through'
'throughFields'
'returning'
'name'
'abstract'
]
constructor: (@attributes...) ->
@attributes = _.reduce @attributes, (memo, value) ->
return value
_.each @attributes, (val, key) =>
if key not in @constructor.acceptedParameters
throw new TypeError "Key '#{key}' is not accepted in field #{@attributes.name}!"
# default Joi validation schema for M2M relation is array of positive integers
if not(_.has @attributes, 'schema')
_.extend @attributes, { schema: Joi.array(Joi.number().integer().positive()) }
# we add the abstract attribute to the relation, because it is not directly saved
# in current model's database table
@attributes['abstract'] = true
# This class creates access to related attributes from many-to-many
# relationship. It adds instance attributes to every model,
# after initialization, the instance can access it's related attributes
# via '.attribute-name.method' e.g. '.permissions.all()'
# where method is one of this class's methods
class ManyToManyManager
# constructor of this class takes two parameters:
# @param [Object] obj instance of Model to assign related attributes to
# @param [String] name name of the attributes e.g. 'parameters'
constructor: (@obj, @name, field) ->
@toModel = require field.attributes.toModel
@thisModel = @obj.constructor.metadata
@through = field.attributes.through
@throughFields = field.attributes.throughFields
@returning = _.map field.attributes.returning, (val) =>
"#{@toModel.metadata.tableName}.#{@obj.attributes[val].getDbField(val)} AS #{val}"
# returns all related objects
# @param [Boolean] toObject defines if returned elements should be translated to Model instances
all: ({ toObject } = {}) =>
knex(@toModel.metadata.tableName)
.select(@returning)
.leftJoin(@through, "#{@toModel.metadata.tableName}.#{@toModel.metadata.primaryKey}", "#{@through}.#{@throughFields[1]}")
.where("#{@through}.#{@throughFields[0]}", @obj[@obj.constructor.metadata.primaryKey])
.andWhere("#{@toModel.metadata.tableName}.is_deleted", false)
.then (result) =>
if toObject?
relatedObjects = []
_.each result, (val) =>
relatedObjects.push new @toModel val
return relatedObjects
return result
.catch (error) =>
if @obj.constructor.metadata.errorLogger?
@obj.constructor.metadata.errorLogger.error error
throw error
# returns specified related object
# @param [Number] id ID of related object to return
# @param [Boolean] toObject defines if returned element should be translated to Model instance
get: ({ id, toObject } = {}) =>
knex(@toModel.metadata.tableName)
.select(@returning)
.where("#{@toModel.metadata.primaryKey}", id)
.andWhere('is_deleted', false)
.then (result) =>
if toObject? and result.length is 1
return new @toModel result[0]
return result[0]
.catch (error) =>
if @obj.constructor.metadata.errorLogger?
@obj.constructor.metadata.errorLogger.error error
throw error
# adds specified objects to set of related objects
# @param [Array] id Array of IDs of objects to be added
add: (id...) =>
if not id?
throw new Error "IDs of related objects are required"
# _.flatten is used in case array of IDs is passed
id = _.flatten id
# here we check if the model's instance to which we will save related objects
# is already saved in the database - has 'primaryKey' value
if not @obj[@obj.constructor.metadata.primaryKey]?
throw new Error "First you need to save the instance in order to assign related objects to it!"
# we use transaction in this case because multiple rows are
# being affected at once
knex.transaction (transaction) =>
knex(@toModel.metadata.tableName)
.count('id')
.whereIn('id', id)
.andWhere('is_deleted', false)
.transacting(transaction)
.then (result) =>
# here we check if all passed related IDs exist in the database
# if any of them does not exist, we return 404 error
if parseInt(result[0].count) isnt id.length
errorObj = {}
errorObj[@name] = "Specified related object does not exist!"
errorObj['statusCode'] = 404
throw errorObj
else
# we find all already existing related objects in order to omit situation
# in which we will add the same relation twice
knex(@through)
.select(@throughFields[1])
.where(@throughFields[0], @obj[@obj.constructor.metadata.primaryKey])
.transacting(transaction)
.then (result) =>
insertValues = []
_.each id, (val) =>
# we select the related objects only if they do not already exist in the M2M relation
# e.g. if category has permissions 1,2 and we want to add permissions 2,3
# it ensures that only the value 3 will be added to the relation (2 already exists)
if val not in _.pluck result, @throughFields[1]
obj = {}
obj[@throughFields[0]] = @obj[@obj.constructor.metadata.primaryKey]
obj[@throughFields[1]] = val
insertValues.push obj
if insertValues.length > 0
return knex(@through)
.insert(insertValues, @throughFields[1])
.transacting(transaction)
else
return []
.then(transaction.commit)
.catch(transaction.rollback)
.then (rows) ->
return rows
.catch (error) =>
# we omit the error with 'statusCode' thrown inside the transaction
# it will be used in the request response
# we only log errors coming directly from the Knex
if @obj.constructor.metadata.errorLogger? and not error.statusCode?
@obj.constructor.metadata.errorLogger.error error
throw error
# clears all curent related objects and defines new set of them
# @param [Array] id Array of IDs of objects to be set
set: (id...) =>
if not id?
throw new Error "IDs of related objects are required!"
# here we check if the model's instance to which we will save related objects
# is already saved in the database - has 'primaryKey' value
if not @obj[@obj.constructor.metadata.primaryKey]?
throw new Error "First you need to save the instance in order to assign related objects to it!"
id = _.flatten id
insertValues = _.map id, (val) =>
obj = {}
obj[@throughFields[0]] = @obj[@obj.constructor.metadata.primaryKey]
obj[@throughFields[1]] = val
obj
knex.transaction (transaction) =>
# here we check if passed array of IDs exist in 'toModel' table
# if the count length is equal to number of elements in passed array
# then all passed IDs exist in 'toModel' table
# otherwise we throw error with message
knex(@toModel.metadata.tableName)
.count('id')
.whereIn('id', id)
.andWhere('is_deleted', false)
.then (result) =>
if parseInt(result[0].count) isnt id.length
errorObj = {}
errorObj[@name] = "Specified related object does not exist!"
errorObj['statusCode'] = 404
throw errorObj
else
return knex(@through)
.where(@throughFields[0], @obj[@obj.constructor.metadata.primaryKey])
.del()
.transacting(transaction)
.then (result) =>
return knex(@through)
.insert(insertValues, @throughFields[1])
.transacting(transaction)
.then(transaction.commit)
.catch(transaction.rollback)
.then (rows) ->
return rows
.catch (error) =>
# we omit the error with 'statusCode' thrown inside the transaction
# it will be used in the request response
# we only log errors coming directly from the Knex
if @obj.constructor.metadata.errorLogger? and not error.statusCode?
@obj.constructor.metadata.errorLogger.error error
throw error
@getManyToManyManager: ->
return ManyToManyManager
module.exports = ManyToMany
| 203300 | 'use strict'
_ = require 'underscore'
knexConf = require process.cwd() + '/knexfile'
knex = require('knex')(knexConf[process.env.NODE_ENV])
Joi = require 'joi'
class ManyToMany
@acceptedParameters: [
'schema'
'toModel'
'through'
'throughFields'
'returning'
'name'
'abstract'
]
constructor: (@attributes...) ->
@attributes = _.reduce @attributes, (memo, value) ->
return value
_.each @attributes, (val, key) =>
if key not in @constructor.acceptedParameters
throw new TypeError "Key '#{key}' is not accepted in field #{@attributes.name}!"
# default Joi validation schema for M2M relation is array of positive integers
if not(_.has @attributes, 'schema')
_.extend @attributes, { schema: Joi.array(Joi.number().integer().positive()) }
# we add the abstract attribute to the relation, because it is not directly saved
# in current model's database table
@attributes['abstract'] = true
# This class creates access to related attributes from many-to-many
# relationship. It adds instance attributes to every model,
# after initialization, the instance can access it's related attributes
# via '.attribute-name.method' e.g. '.permissions.all()'
# where method is one of this class's methods
class ManyToManyManager
# constructor of this class takes two parameters:
# @param [Object] obj instance of Model to assign related attributes to
# @param [String] name name of the attributes e.g. 'parameters'
constructor: (@obj, @name, field) ->
@toModel = require field.attributes.toModel
@thisModel = @obj.constructor.metadata
@through = field.attributes.through
@throughFields = field.attributes.throughFields
@returning = _.map field.attributes.returning, (val) =>
"#{@toModel.metadata.tableName}.#{@obj.attributes[val].getDbField(val)} AS #{val}"
# returns all related objects
# @param [Boolean] toObject defines if returned elements should be translated to Model instances
all: ({ toObject } = {}) =>
knex(@toModel.metadata.tableName)
.select(@returning)
.leftJoin(@through, "#{@toModel.metadata.tableName}.#{@toModel.metadata.primaryKey}", "#{@through}.#{@throughFields[1]}")
.where("#{@through}.#{@throughFields[0]}", @obj[@obj.constructor.metadata.primaryKey])
.andWhere("#{@toModel.metadata.tableName}.is_deleted", false)
.then (result) =>
if toObject?
relatedObjects = []
_.each result, (val) =>
relatedObjects.push new @toModel val
return relatedObjects
return result
.catch (error) =>
if @obj.constructor.metadata.errorLogger?
@obj.constructor.metadata.errorLogger.error error
throw error
# returns specified related object
# @param [Number] id ID of related object to return
# @param [Boolean] toObject defines if returned element should be translated to Model instance
get: ({ id, toObject } = {}) =>
knex(@toModel.metadata.tableName)
.select(@returning)
.where("#{@toModel.metadata.primaryKey}", id)
.andWhere('is_deleted', false)
.then (result) =>
if toObject? and result.length is 1
return new @toModel result[0]
return result[0]
.catch (error) =>
if @obj.constructor.metadata.errorLogger?
@obj.constructor.metadata.errorLogger.error error
throw error
# adds specified objects to set of related objects
# @param [Array] id Array of IDs of objects to be added
add: (id...) =>
if not id?
throw new Error "IDs of related objects are required"
# _.flatten is used in case array of IDs is passed
id = _.flatten id
# here we check if the model's instance to which we will save related objects
# is already saved in the database - has 'primaryKey' value
if not @obj[@obj.constructor.metadata.primaryKey]?
throw new Error "First you need to save the instance in order to assign related objects to it!"
# we use transaction in this case because multiple rows are
# being affected at once
knex.transaction (transaction) =>
knex(@toModel.metadata.tableName)
.count('id')
.whereIn('id', id)
.andWhere('is_deleted', false)
.transacting(transaction)
.then (result) =>
# here we check if all passed related IDs exist in the database
# if any of them does not exist, we return 404 error
if parseInt(result[0].count) isnt id.length
errorObj = {}
errorObj[@name] = "Specified related object does not exist!"
errorObj['statusCode'] = 404
throw errorObj
else
# we find all already existing related objects in order to omit situation
# in which we will add the same relation twice
knex(@through)
.select(@throughFields[1])
.where(@throughFields[0], @obj[@<EMAIL>])
.transacting(transaction)
.then (result) =>
insertValues = []
_.each id, (val) =>
# we select the related objects only if they do not already exist in the M2M relation
# e.g. if category has permissions 1,2 and we want to add permissions 2,3
# it ensures that only the value 3 will be added to the relation (2 already exists)
if val not in _.pluck result, @throughFields[1]
obj = {}
obj[@throughFields[0]] = @obj[@obj<EMAIL>.constructor.<EMAIL>.primaryKey]
obj[@throughFields[1]] = val
insertValues.push obj
if insertValues.length > 0
return knex(@through)
.insert(insertValues, @throughFields[1])
.transacting(transaction)
else
return []
.then(transaction.commit)
.catch(transaction.rollback)
.then (rows) ->
return rows
.catch (error) =>
# we omit the error with 'statusCode' thrown inside the transaction
# it will be used in the request response
# we only log errors coming directly from the Knex
if @obj.constructor.metadata.errorLogger? and not error.statusCode?
@obj.constructor.metadata.errorLogger.error error
throw error
# clears all curent related objects and defines new set of them
# @param [Array] id Array of IDs of objects to be set
set: (id...) =>
if not id?
throw new Error "IDs of related objects are required!"
# here we check if the model's instance to which we will save related objects
# is already saved in the database - has 'primaryKey' value
if not @obj[@obj<EMAIL>.constructor.metadata.primaryKey]?
throw new Error "First you need to save the instance in order to assign related objects to it!"
id = _.flatten id
insertValues = _.map id, (val) =>
obj = {}
obj[@throughFields[0]] = @obj[@<EMAIL>.primaryKey]
obj[@throughFields[1]] = val
obj
knex.transaction (transaction) =>
# here we check if passed array of IDs exist in 'toModel' table
# if the count length is equal to number of elements in passed array
# then all passed IDs exist in 'toModel' table
# otherwise we throw error with message
knex(@toModel.metadata.tableName)
.count('id')
.whereIn('id', id)
.andWhere('is_deleted', false)
.then (result) =>
if parseInt(result[0].count) isnt id.length
errorObj = {}
errorObj[@name] = "Specified related object does not exist!"
errorObj['statusCode'] = 404
throw errorObj
else
return knex(@through)
.where(@throughFields[0], @obj[@obj.constructor.metadata.primaryKey])
.del()
.transacting(transaction)
.then (result) =>
return knex(@through)
.insert(insertValues, @throughFields[1])
.transacting(transaction)
.then(transaction.commit)
.catch(transaction.rollback)
.then (rows) ->
return rows
.catch (error) =>
# we omit the error with 'statusCode' thrown inside the transaction
# it will be used in the request response
# we only log errors coming directly from the Knex
if @obj.constructor.metadata.errorLogger? and not error.statusCode?
@obj.constructor.metadata.errorLogger.error error
throw error
@getManyToManyManager: ->
return ManyToManyManager
module.exports = ManyToMany
| true | 'use strict'
_ = require 'underscore'
knexConf = require process.cwd() + '/knexfile'
knex = require('knex')(knexConf[process.env.NODE_ENV])
Joi = require 'joi'
class ManyToMany
@acceptedParameters: [
'schema'
'toModel'
'through'
'throughFields'
'returning'
'name'
'abstract'
]
constructor: (@attributes...) ->
@attributes = _.reduce @attributes, (memo, value) ->
return value
_.each @attributes, (val, key) =>
if key not in @constructor.acceptedParameters
throw new TypeError "Key '#{key}' is not accepted in field #{@attributes.name}!"
# default Joi validation schema for M2M relation is array of positive integers
if not(_.has @attributes, 'schema')
_.extend @attributes, { schema: Joi.array(Joi.number().integer().positive()) }
# we add the abstract attribute to the relation, because it is not directly saved
# in current model's database table
@attributes['abstract'] = true
# This class creates access to related attributes from many-to-many
# relationship. It adds instance attributes to every model,
# after initialization, the instance can access it's related attributes
# via '.attribute-name.method' e.g. '.permissions.all()'
# where method is one of this class's methods
class ManyToManyManager
# constructor of this class takes two parameters:
# @param [Object] obj instance of Model to assign related attributes to
# @param [String] name name of the attributes e.g. 'parameters'
constructor: (@obj, @name, field) ->
@toModel = require field.attributes.toModel
@thisModel = @obj.constructor.metadata
@through = field.attributes.through
@throughFields = field.attributes.throughFields
@returning = _.map field.attributes.returning, (val) =>
"#{@toModel.metadata.tableName}.#{@obj.attributes[val].getDbField(val)} AS #{val}"
# returns all related objects
# @param [Boolean] toObject defines if returned elements should be translated to Model instances
all: ({ toObject } = {}) =>
knex(@toModel.metadata.tableName)
.select(@returning)
.leftJoin(@through, "#{@toModel.metadata.tableName}.#{@toModel.metadata.primaryKey}", "#{@through}.#{@throughFields[1]}")
.where("#{@through}.#{@throughFields[0]}", @obj[@obj.constructor.metadata.primaryKey])
.andWhere("#{@toModel.metadata.tableName}.is_deleted", false)
.then (result) =>
if toObject?
relatedObjects = []
_.each result, (val) =>
relatedObjects.push new @toModel val
return relatedObjects
return result
.catch (error) =>
if @obj.constructor.metadata.errorLogger?
@obj.constructor.metadata.errorLogger.error error
throw error
# returns specified related object
# @param [Number] id ID of related object to return
# @param [Boolean] toObject defines if returned element should be translated to Model instance
get: ({ id, toObject } = {}) =>
knex(@toModel.metadata.tableName)
.select(@returning)
.where("#{@toModel.metadata.primaryKey}", id)
.andWhere('is_deleted', false)
.then (result) =>
if toObject? and result.length is 1
return new @toModel result[0]
return result[0]
.catch (error) =>
if @obj.constructor.metadata.errorLogger?
@obj.constructor.metadata.errorLogger.error error
throw error
# adds specified objects to set of related objects
# @param [Array] id Array of IDs of objects to be added
add: (id...) =>
if not id?
throw new Error "IDs of related objects are required"
# _.flatten is used in case array of IDs is passed
id = _.flatten id
# here we check if the model's instance to which we will save related objects
# is already saved in the database - has 'primaryKey' value
if not @obj[@obj.constructor.metadata.primaryKey]?
throw new Error "First you need to save the instance in order to assign related objects to it!"
# we use transaction in this case because multiple rows are
# being affected at once
knex.transaction (transaction) =>
knex(@toModel.metadata.tableName)
.count('id')
.whereIn('id', id)
.andWhere('is_deleted', false)
.transacting(transaction)
.then (result) =>
# here we check if all passed related IDs exist in the database
# if any of them does not exist, we return 404 error
if parseInt(result[0].count) isnt id.length
errorObj = {}
errorObj[@name] = "Specified related object does not exist!"
errorObj['statusCode'] = 404
throw errorObj
else
# we find all already existing related objects in order to omit situation
# in which we will add the same relation twice
knex(@through)
.select(@throughFields[1])
.where(@throughFields[0], @obj[@PI:EMAIL:<EMAIL>END_PI])
.transacting(transaction)
.then (result) =>
insertValues = []
_.each id, (val) =>
# we select the related objects only if they do not already exist in the M2M relation
# e.g. if category has permissions 1,2 and we want to add permissions 2,3
# it ensures that only the value 3 will be added to the relation (2 already exists)
if val not in _.pluck result, @throughFields[1]
obj = {}
obj[@throughFields[0]] = @obj[@objPI:EMAIL:<EMAIL>END_PI.constructor.PI:EMAIL:<EMAIL>END_PI.primaryKey]
obj[@throughFields[1]] = val
insertValues.push obj
if insertValues.length > 0
return knex(@through)
.insert(insertValues, @throughFields[1])
.transacting(transaction)
else
return []
.then(transaction.commit)
.catch(transaction.rollback)
.then (rows) ->
return rows
.catch (error) =>
# we omit the error with 'statusCode' thrown inside the transaction
# it will be used in the request response
# we only log errors coming directly from the Knex
if @obj.constructor.metadata.errorLogger? and not error.statusCode?
@obj.constructor.metadata.errorLogger.error error
throw error
# clears all curent related objects and defines new set of them
# @param [Array] id Array of IDs of objects to be set
set: (id...) =>
if not id?
throw new Error "IDs of related objects are required!"
# here we check if the model's instance to which we will save related objects
# is already saved in the database - has 'primaryKey' value
if not @obj[@objPI:EMAIL:<EMAIL>END_PI.constructor.metadata.primaryKey]?
throw new Error "First you need to save the instance in order to assign related objects to it!"
id = _.flatten id
insertValues = _.map id, (val) =>
obj = {}
obj[@throughFields[0]] = @obj[@PI:EMAIL:<EMAIL>END_PI.primaryKey]
obj[@throughFields[1]] = val
obj
knex.transaction (transaction) =>
# here we check if passed array of IDs exist in 'toModel' table
# if the count length is equal to number of elements in passed array
# then all passed IDs exist in 'toModel' table
# otherwise we throw error with message
knex(@toModel.metadata.tableName)
.count('id')
.whereIn('id', id)
.andWhere('is_deleted', false)
.then (result) =>
if parseInt(result[0].count) isnt id.length
errorObj = {}
errorObj[@name] = "Specified related object does not exist!"
errorObj['statusCode'] = 404
throw errorObj
else
return knex(@through)
.where(@throughFields[0], @obj[@obj.constructor.metadata.primaryKey])
.del()
.transacting(transaction)
.then (result) =>
return knex(@through)
.insert(insertValues, @throughFields[1])
.transacting(transaction)
.then(transaction.commit)
.catch(transaction.rollback)
.then (rows) ->
return rows
.catch (error) =>
# we omit the error with 'statusCode' thrown inside the transaction
# it will be used in the request response
# we only log errors coming directly from the Knex
if @obj.constructor.metadata.errorLogger? and not error.statusCode?
@obj.constructor.metadata.errorLogger.error error
throw error
@getManyToManyManager: ->
return ManyToManyManager
module.exports = ManyToMany
|
[
{
"context": "ient_time:new Date() # form-hidden\n admin_alias:'fengfeng2' # form-hidden\n #(optional)\n #media:'/path/to/m",
"end": 249,
"score": 0.9991310238838196,
"start": 240,
"tag": "USERNAME",
"value": "fengfeng2"
},
{
"context": "nt'\nagent = request.agent()\nagent\n .pos... | share/superagent.auth.admin.coffee | android1and1/tickets | 0 | # post one article
# 2019-9-30
data = {
urge:0
resolved:0
title:'a very very very patient post'
category:'problem'
visits:20
ticket:'a post,from cmd,\nfrom superagent app'
client_time:new Date() # form-hidden
admin_alias:'fengfeng2' # form-hidden
#(optional)
#media:'/path/to/media'
}
request = require 'superagent'
agent = request.agent()
agent
.post 'http://192.168.5.2:3003/admin/login'
# 注意,如果是www-url-encoded(非AJAX),要设置如下一行所做的。因为默认传输格式是form/multipart
.type 'form'
#.get 'http://127.0.0.1:3003/admin/login'
.send {'alias':'fengfeng2'}
.send {'password':'1234567'}
.end (err,resp)->
if not err
agent.post 'http://192.168.5.2:3003/admin/create-new-ticket'
.send data
.end (err,resp)->
if err
console.error err.message
else
console.log resp.text
| 173737 | # post one article
# 2019-9-30
data = {
urge:0
resolved:0
title:'a very very very patient post'
category:'problem'
visits:20
ticket:'a post,from cmd,\nfrom superagent app'
client_time:new Date() # form-hidden
admin_alias:'fengfeng2' # form-hidden
#(optional)
#media:'/path/to/media'
}
request = require 'superagent'
agent = request.agent()
agent
.post 'http://192.168.5.2:3003/admin/login'
# 注意,如果是www-url-encoded(非AJAX),要设置如下一行所做的。因为默认传输格式是form/multipart
.type 'form'
#.get 'http://127.0.0.1:3003/admin/login'
.send {'alias':'fengfeng2'}
.send {'password':'<PASSWORD>'}
.end (err,resp)->
if not err
agent.post 'http://192.168.5.2:3003/admin/create-new-ticket'
.send data
.end (err,resp)->
if err
console.error err.message
else
console.log resp.text
| true | # post one article
# 2019-9-30
data = {
urge:0
resolved:0
title:'a very very very patient post'
category:'problem'
visits:20
ticket:'a post,from cmd,\nfrom superagent app'
client_time:new Date() # form-hidden
admin_alias:'fengfeng2' # form-hidden
#(optional)
#media:'/path/to/media'
}
request = require 'superagent'
agent = request.agent()
agent
.post 'http://192.168.5.2:3003/admin/login'
# 注意,如果是www-url-encoded(非AJAX),要设置如下一行所做的。因为默认传输格式是form/multipart
.type 'form'
#.get 'http://127.0.0.1:3003/admin/login'
.send {'alias':'fengfeng2'}
.send {'password':'PI:PASSWORD:<PASSWORD>END_PI'}
.end (err,resp)->
if not err
agent.post 'http://192.168.5.2:3003/admin/create-new-ticket'
.send data
.end (err,resp)->
if err
console.error err.message
else
console.log resp.text
|
[
{
"context": "efined\n# * in FIPS 180-1\n# * Version 2.2 Copyright Paul Johnston 2000 - 2009.\n# * Other contributors: Greg Holt, A",
"end": 140,
"score": 0.9998701214790344,
"start": 127,
"tag": "NAME",
"value": "Paul Johnston"
},
{
"context": "Paul Johnston 2000 - 2009.\n# * Other ... | coffee/tools/sha1.coffee | qreeves/oauth-js | 403 |
#
# * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
# * in FIPS 180-1
# * Version 2.2 Copyright Paul Johnston 2000 - 2009.
# * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
# * Distributed under the BSD License
# * See http://pajhome.org.uk/crypt/md5 for details.
#
#
# * Configurable variables. You may need to tweak these to be compatible with
# * the server-side, but the defaults work in most cases.
#
hexcase = 0 # hex output format. 0 - lowercase; 1 - uppercase
b64pad = "" # base-64 pad character. "=" for strict RFC compliance
#
# * These are the functions you'll usually want to call
# * They take string arguments and return either hex or base-64 encoded strings
#
### istanbul ignore next ###
module.exports =
hex_sha1: (s) ->
@rstr2hex @rstr_sha1(@str2rstr_utf8(s))
b64_sha1: (s) ->
@rstr2b64 @rstr_sha1(@str2rstr_utf8(s))
any_sha1: (s, e) ->
@rstr2any @rstr_sha1(@str2rstr_utf8(s)), e
hex_hmac_sha1: (k, d) ->
@rstr2hex @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d))
b64_hmac_sha1: (k, d) ->
@rstr2b64 @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d))
any_hmac_sha1: (k, d, e) ->
@rstr2any @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d)), e
#
# * Perform a simple self-test to see if the VM is working
#
sha1_vm_test: ->
thishex_sha1("abc").toLowerCase() is "a9993e364706816aba3e25717850c26c9cd0d89d"
#
# * Calculate the SHA1 of a raw string
#
rstr_sha1: (s) ->
@binb2rstr @binb_sha1(@rstr2binb(s), s.length * 8)
#
# * Calculate the HMAC-SHA1 of a key and some data (raw strings)
#
rstr_hmac_sha1: (key, data) ->
bkey = @rstr2binb(key)
bkey = @binb_sha1(bkey, key.length * 8) if bkey.length > 16
ipad = Array(16)
opad = Array(16)
i = 0
while i < 16
ipad[i] = bkey[i] ^ 0x36363636
opad[i] = bkey[i] ^ 0x5C5C5C5C
i++
hash = @binb_sha1(ipad.concat(@rstr2binb(data)), 512 + data.length * 8)
@binb2rstr @binb_sha1(opad.concat(hash), 512 + 160)
#
# * Convert a raw string to a hex string
#
rstr2hex: (input) ->
try
hexcase
catch e
hexcase = 0
hex_tab = (if hexcase then "0123456789ABCDEF" else "0123456789abcdef")
output = ""
x = undefined
i = 0
while i < input.length
x = input.charCodeAt(i)
output += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F)
i++
output
#
# * Convert a raw string to a base-64 string
#
rstr2b64: (input) ->
try
b64pad
catch e
b64pad = ""
tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
output = ""
len = input.length
i = 0
while i < len
triplet = (input.charCodeAt(i) << 16) | ((if i + 1 < len then input.charCodeAt(i + 1) << 8 else 0)) | ((if i + 2 < len then input.charCodeAt(i + 2) else 0))
j = 0
while j < 4
if i * 8 + j * 6 > input.length * 8
output += b64pad
else
output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F)
j++
i += 3
output
#
# * Convert a raw string to an arbitrary string encoding
#
rstr2any: (input, encoding) ->
divisor = encoding.length
remainders = Array()
i = undefined
q = undefined
x = undefined
quotient = undefined
# Convert to an array of 16-bit big-endian values, forming the dividend
dividend = Array(Math.ceil(input.length / 2))
i = 0
while i < dividend.length
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1)
i++
#
# * Repeatedly perform a long division. The binary array forms the dividend,
# * the length of the encoding is the divisor. Once computed, the quotient
# * forms the dividend for the next step. We stop when the dividend is zero.
# * All remainders are stored for later use.
#
while dividend.length > 0
quotient = Array()
x = 0
i = 0
while i < dividend.length
x = (x << 16) + dividend[i]
q = Math.floor(x / divisor)
x -= q * divisor
quotient[quotient.length] = q if quotient.length > 0 or q > 0
i++
remainders[remainders.length] = x
dividend = quotient
# Convert the remainders to the output string
output = ""
i = remainders.length - 1
while i >= 0
output += encoding.charAt(remainders[i])
i--
# Append leading zero equivalents
full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)))
i = output.length
while i < full_length
output = encoding[0] + output
i++
output
#
# * Encode a string as utf-8.
# * For efficiency, this assumes the input is valid utf-16.
#
str2rstr_utf8: (input) ->
output = ""
i = -1
x = undefined
y = undefined
while ++i < input.length
# Decode utf-16 surrogate pairs
x = input.charCodeAt(i)
y = (if i + 1 < input.length then input.charCodeAt(i + 1) else 0)
if 0xD800 <= x and x <= 0xDBFF and 0xDC00 <= y and y <= 0xDFFF
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF)
i++
# Encode output as utf-8
if x <= 0x7F
output += String.fromCharCode(x)
else if x <= 0x7FF
output += String.fromCharCode(0xC0 | ((x >>> 6) & 0x1F), 0x80 | (x & 0x3F))
else if x <= 0xFFFF
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F))
else output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), 0x80 | ((x >>> 12) & 0x3F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F)) if x <= 0x1FFFFF
output
#
# * Encode a string as utf-16
#
str2rstr_utf16le: (input) ->
output = ""
i = 0
while i < input.length
output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF)
i++
output
str2rstr_utf16be: (input) ->
output = ""
i = 0
while i < input.length
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF)
i++
output
#
# * Convert a raw string to an array of big-endian words
# * Characters >255 have their high-byte silently ignored.
#
rstr2binb: (input) ->
output = Array(input.length >> 2)
i = 0
while i < output.length
output[i] = 0
i++
i = 0
while i < input.length * 8
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32)
i += 8
output
#
# * Convert an array of big-endian words to a string
#
binb2rstr: (input) ->
output = ""
i = 0
while i < input.length * 32
output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF)
i += 8
output
#
# * Calculate the SHA-1 of an array of big-endian words, and a bit length
#
binb_sha1: (x, len) ->
# append padding
x[len >> 5] |= 0x80 << (24 - len % 32)
x[((len + 64 >> 9) << 4) + 15] = len
w = Array(80)
a = 1732584193
b = -271733879
c = -1732584194
d = 271733878
e = -1009589776
i = 0
while i < x.length
olda = a
oldb = b
oldc = c
oldd = d
olde = e
j = 0
while j < 80
if j < 16
w[j] = x[i + j]
else
w[j] = @bit_rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)
t = @safe_add(@safe_add(@bit_rol(a, 5), @sha1_ft(j, b, c, d)), @safe_add(@safe_add(e, w[j]), @sha1_kt(j)))
e = d
d = c
c = @bit_rol(b, 30)
b = a
a = t
j++
a = @safe_add(a, olda)
b = @safe_add(b, oldb)
c = @safe_add(c, oldc)
d = @safe_add(d, oldd)
e = @safe_add(e, olde)
i += 16
Array a, b, c, d, e
#
# * Perform the appropriate triplet combination function for the current
# * iteration
#
sha1_ft: (t, b, c, d) ->
return (b & c) | ((~b) & d) if t < 20
return b ^ c ^ d if t < 40
return (b & c) | (b & d) | (c & d) if t < 60
b ^ c ^ d
#
# * Determine the appropriate additive constant for the current iteration
#
sha1_kt: (t) ->
(if (t < 20) then 1518500249 else (if (t < 40) then 1859775393 else (if (t < 60) then -1894007588 else -899497514)))
#
# * Add integers, wrapping at 2^32. This uses 16-bit operations internally
# * to work around bugs in some JS interpreters.
#
safe_add: (x, y) ->
lsw = (x & 0xFFFF) + (y & 0xFFFF)
msw = (x >> 16) + (y >> 16) + (lsw >> 16)
(msw << 16) | (lsw & 0xFFFF)
#
# * Bitwise rotate a 32-bit number to the left.
#
bit_rol: (num, cnt) ->
(num << cnt) | (num >>> (32 - cnt))
create_hash: ->
hash = @b64_sha1((new Date()).getTime() + ":" + Math.floor(Math.random() * 9999999))
hash.replace(/\+/g, "-").replace(/\//g, "_").replace /\=+$/, ""
| 189512 |
#
# * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
# * in FIPS 180-1
# * Version 2.2 Copyright <NAME> 2000 - 2009.
# * Other contributors: <NAME>, <NAME>, <NAME>, <NAME>
# * Distributed under the BSD License
# * See http://pajhome.org.uk/crypt/md5 for details.
#
#
# * Configurable variables. You may need to tweak these to be compatible with
# * the server-side, but the defaults work in most cases.
#
hexcase = 0 # hex output format. 0 - lowercase; 1 - uppercase
b64pad = "" # base-64 pad character. "=" for strict RFC compliance
#
# * These are the functions you'll usually want to call
# * They take string arguments and return either hex or base-64 encoded strings
#
### istanbul ignore next ###
module.exports =
hex_sha1: (s) ->
@rstr2hex @rstr_sha1(@str2rstr_utf8(s))
b64_sha1: (s) ->
@rstr2b64 @rstr_sha1(@str2rstr_utf8(s))
any_sha1: (s, e) ->
@rstr2any @rstr_sha1(@str2rstr_utf8(s)), e
hex_hmac_sha1: (k, d) ->
@rstr2hex @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d))
b64_hmac_sha1: (k, d) ->
@rstr2b64 @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d))
any_hmac_sha1: (k, d, e) ->
@rstr2any @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d)), e
#
# * Perform a simple self-test to see if the VM is working
#
sha1_vm_test: ->
thishex_sha1("abc").toLowerCase() is "a9993e364706816aba3e25717850c26c9cd0d89d"
#
# * Calculate the SHA1 of a raw string
#
rstr_sha1: (s) ->
@binb2rstr @binb_sha1(@rstr2binb(s), s.length * 8)
#
# * Calculate the HMAC-SHA1 of a key and some data (raw strings)
#
rstr_hmac_sha1: (key, data) ->
bkey = @rstr2binb(key)
bkey = @binb_sha1(bkey, key.length * 8) if bkey.length > 16
ipad = Array(16)
opad = Array(16)
i = 0
while i < 16
ipad[i] = bkey[i] ^ 0x36363636
opad[i] = bkey[i] ^ 0x5C5C5C5C
i++
hash = @binb_sha1(ipad.concat(@rstr2binb(data)), 512 + data.length * 8)
@binb2rstr @binb_sha1(opad.concat(hash), 512 + 160)
#
# * Convert a raw string to a hex string
#
rstr2hex: (input) ->
try
hexcase
catch e
hexcase = 0
hex_tab = (if hexcase then "0123456789ABCDEF" else "0123456789abcdef")
output = ""
x = undefined
i = 0
while i < input.length
x = input.charCodeAt(i)
output += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F)
i++
output
#
# * Convert a raw string to a base-64 string
#
rstr2b64: (input) ->
try
b64pad
catch e
b64pad = ""
tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
output = ""
len = input.length
i = 0
while i < len
triplet = (input.charCodeAt(i) << 16) | ((if i + 1 < len then input.charCodeAt(i + 1) << 8 else 0)) | ((if i + 2 < len then input.charCodeAt(i + 2) else 0))
j = 0
while j < 4
if i * 8 + j * 6 > input.length * 8
output += b64pad
else
output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F)
j++
i += 3
output
#
# * Convert a raw string to an arbitrary string encoding
#
rstr2any: (input, encoding) ->
divisor = encoding.length
remainders = Array()
i = undefined
q = undefined
x = undefined
quotient = undefined
# Convert to an array of 16-bit big-endian values, forming the dividend
dividend = Array(Math.ceil(input.length / 2))
i = 0
while i < dividend.length
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1)
i++
#
# * Repeatedly perform a long division. The binary array forms the dividend,
# * the length of the encoding is the divisor. Once computed, the quotient
# * forms the dividend for the next step. We stop when the dividend is zero.
# * All remainders are stored for later use.
#
while dividend.length > 0
quotient = Array()
x = 0
i = 0
while i < dividend.length
x = (x << 16) + dividend[i]
q = Math.floor(x / divisor)
x -= q * divisor
quotient[quotient.length] = q if quotient.length > 0 or q > 0
i++
remainders[remainders.length] = x
dividend = quotient
# Convert the remainders to the output string
output = ""
i = remainders.length - 1
while i >= 0
output += encoding.charAt(remainders[i])
i--
# Append leading zero equivalents
full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)))
i = output.length
while i < full_length
output = encoding[0] + output
i++
output
#
# * Encode a string as utf-8.
# * For efficiency, this assumes the input is valid utf-16.
#
str2rstr_utf8: (input) ->
output = ""
i = -1
x = undefined
y = undefined
while ++i < input.length
# Decode utf-16 surrogate pairs
x = input.charCodeAt(i)
y = (if i + 1 < input.length then input.charCodeAt(i + 1) else 0)
if 0xD800 <= x and x <= 0xDBFF and 0xDC00 <= y and y <= 0xDFFF
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF)
i++
# Encode output as utf-8
if x <= 0x7F
output += String.fromCharCode(x)
else if x <= 0x7FF
output += String.fromCharCode(0xC0 | ((x >>> 6) & 0x1F), 0x80 | (x & 0x3F))
else if x <= 0xFFFF
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F))
else output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), 0x80 | ((x >>> 12) & 0x3F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F)) if x <= 0x1FFFFF
output
#
# * Encode a string as utf-16
#
str2rstr_utf16le: (input) ->
output = ""
i = 0
while i < input.length
output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF)
i++
output
str2rstr_utf16be: (input) ->
output = ""
i = 0
while i < input.length
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF)
i++
output
#
# * Convert a raw string to an array of big-endian words
# * Characters >255 have their high-byte silently ignored.
#
rstr2binb: (input) ->
output = Array(input.length >> 2)
i = 0
while i < output.length
output[i] = 0
i++
i = 0
while i < input.length * 8
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32)
i += 8
output
#
# * Convert an array of big-endian words to a string
#
binb2rstr: (input) ->
output = ""
i = 0
while i < input.length * 32
output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF)
i += 8
output
#
# * Calculate the SHA-1 of an array of big-endian words, and a bit length
#
binb_sha1: (x, len) ->
# append padding
x[len >> 5] |= 0x80 << (24 - len % 32)
x[((len + 64 >> 9) << 4) + 15] = len
w = Array(80)
a = 1732584193
b = -271733879
c = -1732584194
d = 271733878
e = -1009589776
i = 0
while i < x.length
olda = a
oldb = b
oldc = c
oldd = d
olde = e
j = 0
while j < 80
if j < 16
w[j] = x[i + j]
else
w[j] = @bit_rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)
t = @safe_add(@safe_add(@bit_rol(a, 5), @sha1_ft(j, b, c, d)), @safe_add(@safe_add(e, w[j]), @sha1_kt(j)))
e = d
d = c
c = @bit_rol(b, 30)
b = a
a = t
j++
a = @safe_add(a, olda)
b = @safe_add(b, oldb)
c = @safe_add(c, oldc)
d = @safe_add(d, oldd)
e = @safe_add(e, olde)
i += 16
Array a, b, c, d, e
#
# * Perform the appropriate triplet combination function for the current
# * iteration
#
sha1_ft: (t, b, c, d) ->
return (b & c) | ((~b) & d) if t < 20
return b ^ c ^ d if t < 40
return (b & c) | (b & d) | (c & d) if t < 60
b ^ c ^ d
#
# * Determine the appropriate additive constant for the current iteration
#
sha1_kt: (t) ->
(if (t < 20) then 1518500249 else (if (t < 40) then 1859775393 else (if (t < 60) then -1894007588 else -899497514)))
#
# * Add integers, wrapping at 2^32. This uses 16-bit operations internally
# * to work around bugs in some JS interpreters.
#
safe_add: (x, y) ->
lsw = (x & 0xFFFF) + (y & 0xFFFF)
msw = (x >> 16) + (y >> 16) + (lsw >> 16)
(msw << 16) | (lsw & 0xFFFF)
#
# * Bitwise rotate a 32-bit number to the left.
#
bit_rol: (num, cnt) ->
(num << cnt) | (num >>> (32 - cnt))
create_hash: ->
hash = @b64_sha1((new Date()).getTime() + ":" + Math.floor(Math.random() * 9999999))
hash.replace(/\+/g, "-").replace(/\//g, "_").replace /\=+$/, ""
| true |
#
# * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
# * in FIPS 180-1
# * Version 2.2 Copyright PI:NAME:<NAME>END_PI 2000 - 2009.
# * Other contributors: PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI
# * Distributed under the BSD License
# * See http://pajhome.org.uk/crypt/md5 for details.
#
#
# * Configurable variables. You may need to tweak these to be compatible with
# * the server-side, but the defaults work in most cases.
#
hexcase = 0 # hex output format. 0 - lowercase; 1 - uppercase
b64pad = "" # base-64 pad character. "=" for strict RFC compliance
#
# * These are the functions you'll usually want to call
# * They take string arguments and return either hex or base-64 encoded strings
#
### istanbul ignore next ###
module.exports =
hex_sha1: (s) ->
@rstr2hex @rstr_sha1(@str2rstr_utf8(s))
b64_sha1: (s) ->
@rstr2b64 @rstr_sha1(@str2rstr_utf8(s))
any_sha1: (s, e) ->
@rstr2any @rstr_sha1(@str2rstr_utf8(s)), e
hex_hmac_sha1: (k, d) ->
@rstr2hex @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d))
b64_hmac_sha1: (k, d) ->
@rstr2b64 @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d))
any_hmac_sha1: (k, d, e) ->
@rstr2any @rstr_hmac_sha1(@str2rstr_utf8(k), @str2rstr_utf8(d)), e
#
# * Perform a simple self-test to see if the VM is working
#
sha1_vm_test: ->
thishex_sha1("abc").toLowerCase() is "a9993e364706816aba3e25717850c26c9cd0d89d"
#
# * Calculate the SHA1 of a raw string
#
rstr_sha1: (s) ->
@binb2rstr @binb_sha1(@rstr2binb(s), s.length * 8)
#
# * Calculate the HMAC-SHA1 of a key and some data (raw strings)
#
rstr_hmac_sha1: (key, data) ->
bkey = @rstr2binb(key)
bkey = @binb_sha1(bkey, key.length * 8) if bkey.length > 16
ipad = Array(16)
opad = Array(16)
i = 0
while i < 16
ipad[i] = bkey[i] ^ 0x36363636
opad[i] = bkey[i] ^ 0x5C5C5C5C
i++
hash = @binb_sha1(ipad.concat(@rstr2binb(data)), 512 + data.length * 8)
@binb2rstr @binb_sha1(opad.concat(hash), 512 + 160)
#
# * Convert a raw string to a hex string
#
rstr2hex: (input) ->
try
hexcase
catch e
hexcase = 0
hex_tab = (if hexcase then "0123456789ABCDEF" else "0123456789abcdef")
output = ""
x = undefined
i = 0
while i < input.length
x = input.charCodeAt(i)
output += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F)
i++
output
#
# * Convert a raw string to a base-64 string
#
rstr2b64: (input) ->
try
b64pad
catch e
b64pad = ""
tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
output = ""
len = input.length
i = 0
while i < len
triplet = (input.charCodeAt(i) << 16) | ((if i + 1 < len then input.charCodeAt(i + 1) << 8 else 0)) | ((if i + 2 < len then input.charCodeAt(i + 2) else 0))
j = 0
while j < 4
if i * 8 + j * 6 > input.length * 8
output += b64pad
else
output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F)
j++
i += 3
output
#
# * Convert a raw string to an arbitrary string encoding
#
rstr2any: (input, encoding) ->
divisor = encoding.length
remainders = Array()
i = undefined
q = undefined
x = undefined
quotient = undefined
# Convert to an array of 16-bit big-endian values, forming the dividend
dividend = Array(Math.ceil(input.length / 2))
i = 0
while i < dividend.length
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1)
i++
#
# * Repeatedly perform a long division. The binary array forms the dividend,
# * the length of the encoding is the divisor. Once computed, the quotient
# * forms the dividend for the next step. We stop when the dividend is zero.
# * All remainders are stored for later use.
#
while dividend.length > 0
quotient = Array()
x = 0
i = 0
while i < dividend.length
x = (x << 16) + dividend[i]
q = Math.floor(x / divisor)
x -= q * divisor
quotient[quotient.length] = q if quotient.length > 0 or q > 0
i++
remainders[remainders.length] = x
dividend = quotient
# Convert the remainders to the output string
output = ""
i = remainders.length - 1
while i >= 0
output += encoding.charAt(remainders[i])
i--
# Append leading zero equivalents
full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)))
i = output.length
while i < full_length
output = encoding[0] + output
i++
output
#
# * Encode a string as utf-8.
# * For efficiency, this assumes the input is valid utf-16.
#
str2rstr_utf8: (input) ->
output = ""
i = -1
x = undefined
y = undefined
while ++i < input.length
# Decode utf-16 surrogate pairs
x = input.charCodeAt(i)
y = (if i + 1 < input.length then input.charCodeAt(i + 1) else 0)
if 0xD800 <= x and x <= 0xDBFF and 0xDC00 <= y and y <= 0xDFFF
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF)
i++
# Encode output as utf-8
if x <= 0x7F
output += String.fromCharCode(x)
else if x <= 0x7FF
output += String.fromCharCode(0xC0 | ((x >>> 6) & 0x1F), 0x80 | (x & 0x3F))
else if x <= 0xFFFF
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F))
else output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), 0x80 | ((x >>> 12) & 0x3F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F)) if x <= 0x1FFFFF
output
#
# * Encode a string as utf-16
#
str2rstr_utf16le: (input) ->
output = ""
i = 0
while i < input.length
output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF)
i++
output
str2rstr_utf16be: (input) ->
output = ""
i = 0
while i < input.length
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF)
i++
output
#
# * Convert a raw string to an array of big-endian words
# * Characters >255 have their high-byte silently ignored.
#
rstr2binb: (input) ->
output = Array(input.length >> 2)
i = 0
while i < output.length
output[i] = 0
i++
i = 0
while i < input.length * 8
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32)
i += 8
output
#
# * Convert an array of big-endian words to a string
#
binb2rstr: (input) ->
output = ""
i = 0
while i < input.length * 32
output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF)
i += 8
output
#
# * Calculate the SHA-1 of an array of big-endian words, and a bit length
#
binb_sha1: (x, len) ->
# append padding
x[len >> 5] |= 0x80 << (24 - len % 32)
x[((len + 64 >> 9) << 4) + 15] = len
w = Array(80)
a = 1732584193
b = -271733879
c = -1732584194
d = 271733878
e = -1009589776
i = 0
while i < x.length
olda = a
oldb = b
oldc = c
oldd = d
olde = e
j = 0
while j < 80
if j < 16
w[j] = x[i + j]
else
w[j] = @bit_rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)
t = @safe_add(@safe_add(@bit_rol(a, 5), @sha1_ft(j, b, c, d)), @safe_add(@safe_add(e, w[j]), @sha1_kt(j)))
e = d
d = c
c = @bit_rol(b, 30)
b = a
a = t
j++
a = @safe_add(a, olda)
b = @safe_add(b, oldb)
c = @safe_add(c, oldc)
d = @safe_add(d, oldd)
e = @safe_add(e, olde)
i += 16
Array a, b, c, d, e
#
# * Perform the appropriate triplet combination function for the current
# * iteration
#
sha1_ft: (t, b, c, d) ->
return (b & c) | ((~b) & d) if t < 20
return b ^ c ^ d if t < 40
return (b & c) | (b & d) | (c & d) if t < 60
b ^ c ^ d
#
# * Determine the appropriate additive constant for the current iteration
#
sha1_kt: (t) ->
(if (t < 20) then 1518500249 else (if (t < 40) then 1859775393 else (if (t < 60) then -1894007588 else -899497514)))
#
# * Add integers, wrapping at 2^32. This uses 16-bit operations internally
# * to work around bugs in some JS interpreters.
#
safe_add: (x, y) ->
lsw = (x & 0xFFFF) + (y & 0xFFFF)
msw = (x >> 16) + (y >> 16) + (lsw >> 16)
(msw << 16) | (lsw & 0xFFFF)
#
# * Bitwise rotate a 32-bit number to the left.
#
bit_rol: (num, cnt) ->
(num << cnt) | (num >>> (32 - cnt))
create_hash: ->
hash = @b64_sha1((new Date()).getTime() + ":" + Math.floor(Math.random() * 9999999))
hash.replace(/\+/g, "-").replace(/\//g, "_").replace /\=+$/, ""
|
[
{
"context": "y.name\n email: req.body.email\n password: req.body.password\n ).end (err, sres) ->\n if err and err.mes",
"end": 1221,
"score": 0.9936437606811523,
"start": 1204,
"tag": "PASSWORD",
"value": "req.body.password"
}
] | lib/app/lifecycle.coffee | craigspaeth/artsy-passport | 0 | #
# Middleware functions that help control what happens before and after
# logging in or signing up.
#
_ = require 'underscore'
_s = require 'underscore.string'
opts = require '../options'
passport = require 'passport'
qs = require 'querystring'
redirectBack = require './redirectback'
request = require 'superagent'
artsyXapp = require 'artsy-xapp'
Mailcheck = require 'mailcheck'
crypto = require 'crypto'
{ parse, resolve } = require 'url'
@onLocalLogin = (req, res, next) ->
return next() if req.user and not req.xhr
passport.authenticate('local') req, res, (err) ->
if req.xhr
if err
res.send 500, { success: false, error: err.message }
else
next()
else
if err?.response?.body?.error_description is 'invalid email or password'
res.redirect opts.loginPagePath + '?error=Invalid email or password.'
else if err
next err
else
next()
@onLocalSignup = (req, res, next) ->
req.artsyPassportSignedUp = true
request
.post(opts.ARTSY_URL + '/api/v1/user')
.set('X-Xapp-Token': artsyXapp.token, 'User-Agent': req.get 'user-agent')
.send(
name: req.body.name
email: req.body.email
password: req.body.password
).end (err, sres) ->
if err and err.message is 'Email is invalid.'
suggestion = Mailcheck.run(email: req.body.email)?.full
msg = "Email is invalid."
msg += " Did you mean #{suggestion}?" if suggestion
if req.xhr
res.send 403, { success: false, error: msg }
else
res.redirect opts.signupPagePath + "?error=#{msg}"
else if err and req.xhr
msg = err.response?.body?.error or err.message
res.send 500, { success: false, error: msg }
else if err
next new Error err
else
next()
@beforeSocialAuth = (provider) -> (req, res, next) ->
req.session.redirectTo = req.query['redirect-to']
req.session.skipOnboarding = req.query['skip-onboarding']
options = {}
options.scope = switch provider
when 'linkedin' then ['r_basicprofile', 'r_emailaddress']
else 'email'
# Twitter OAuth 1 doesn't support `state` param csrf out of the box.
# So we implement it ourselves ( -__- )
# https://twittercommunity.com/t/is-the-state-parameter-supported/1889
if provider is 'twitter' and not req.query.state
rand = Math.random().toString()
h = crypto.createHash('sha1').update(rand).digest('hex')
req.session.twitterState = h
options.callbackURL = "#{opts.APP_URL}#{opts.twitterCallbackPath}?state=#{h}"
passport.authenticate(provider, options)(req, res, next)
@afterSocialAuth = (provider) -> (req, res, next) ->
return next(new Error "#{provider} denied") if req.query.denied
# Twitter OAuth 1 doesn't support `state` param csrf out of the box.
# So we implement it ourselves ( -__- )
# https://twittercommunity.com/t/is-the-state-parameter-supported/1889
if provider is 'twitter' and req.query.state isnt req.session.twitterState
err = new Error "Must pass a valid `state` param."
return next err
# Determine if we're linking the account and handle any Gravity errors
# that we can do a better job explaining and redirecting for.
providerName = switch provider
when 'linkedin' then 'LinkedIn'
else _s.capitalize provider
linkingAccount = req.user?
passport.authenticate(provider) req, res, (err) ->
if err?.response?.body?.error is 'User Already Exists'
if req.socialProfileEmail
msg = "A user with the email address #{req.socialProfileEmail} already " +
"exists. Log in to Artsy via email and password and link " +
"#{providerName} in your settings instead."
else
msg = "#{providerName} account previously linked to Artsy. " +
"Log in to your Artsy account via email and password and link" +
"#{providerName} in your settings instead."
res.redirect opts.loginPagePath + '?error=' + msg
else if err?.response?.body?.error is 'Another Account Already Linked'
msg = "#{providerName} account already linked to another Artsy account. " +
"Try logging out and back in with #{providerName}. Then consider " +
"deleting that user account and re-linking #{providerName}. "
res.redirect opts.settingsPagePath + '?error=' + msg
else if err?.message?.match 'Unauthorized source IP address'
msg = "Your IP address was blocked by Facebook."
res.redirect opts.loginPagePath + '?error=' + msg
else if err?
msg = err.message or err.toString?()
res.redirect opts.loginPagePath + '?error=' + msg
else if linkingAccount
res.redirect opts.settingsPagePath
else if req.artsyPassportSignedUp and provider is 'twitter'
res.redirect opts.twitterLastStepPath
else if req.artsyPassportSignedUp and !req.session.skipOnboarding
res.redirect opts.afterSignupPagePath
else
next()
@ensureLoggedInOnAfterSignupPage = (req, res, next) ->
res.redirect opts.loginPagePath unless req.user?
next()
@onError = (err, req, res, next) ->
if err.message is 'twitter denied'
res.redirect opts.loginPagePath + "?error=Canceled Twitter login"
else
next err
@ssoAndRedirectBack = (req, res, next) ->
return res.send { success: true, user: req.user.toJSON() } if req.xhr
parsed = parse redirectBack req
parsed = parse resolve opts.APP_URL, parsed.path unless parsed.hostname
domain = parsed.hostname?.split('.').slice(1).join('.')
return redirectBack(req, res) if domain isnt 'artsy.net'
request
.post "#{opts.ARTSY_URL}/api/v1/me/trust_token"
.set 'X-Access-Token': req.user.get 'accessToken'
.end (err, sres) ->
return res.redirect parsed.href if err
res.redirect "#{opts.ARTSY_URL}/users/sign_in" +
"?trust_token=#{sres.body.trust_token}" +
"&redirect_uri=#{parsed.href}"
| 64432 | #
# Middleware functions that help control what happens before and after
# logging in or signing up.
#
_ = require 'underscore'
_s = require 'underscore.string'
opts = require '../options'
passport = require 'passport'
qs = require 'querystring'
redirectBack = require './redirectback'
request = require 'superagent'
artsyXapp = require 'artsy-xapp'
Mailcheck = require 'mailcheck'
crypto = require 'crypto'
{ parse, resolve } = require 'url'
@onLocalLogin = (req, res, next) ->
return next() if req.user and not req.xhr
passport.authenticate('local') req, res, (err) ->
if req.xhr
if err
res.send 500, { success: false, error: err.message }
else
next()
else
if err?.response?.body?.error_description is 'invalid email or password'
res.redirect opts.loginPagePath + '?error=Invalid email or password.'
else if err
next err
else
next()
@onLocalSignup = (req, res, next) ->
req.artsyPassportSignedUp = true
request
.post(opts.ARTSY_URL + '/api/v1/user')
.set('X-Xapp-Token': artsyXapp.token, 'User-Agent': req.get 'user-agent')
.send(
name: req.body.name
email: req.body.email
password: <PASSWORD>
).end (err, sres) ->
if err and err.message is 'Email is invalid.'
suggestion = Mailcheck.run(email: req.body.email)?.full
msg = "Email is invalid."
msg += " Did you mean #{suggestion}?" if suggestion
if req.xhr
res.send 403, { success: false, error: msg }
else
res.redirect opts.signupPagePath + "?error=#{msg}"
else if err and req.xhr
msg = err.response?.body?.error or err.message
res.send 500, { success: false, error: msg }
else if err
next new Error err
else
next()
@beforeSocialAuth = (provider) -> (req, res, next) ->
req.session.redirectTo = req.query['redirect-to']
req.session.skipOnboarding = req.query['skip-onboarding']
options = {}
options.scope = switch provider
when 'linkedin' then ['r_basicprofile', 'r_emailaddress']
else 'email'
# Twitter OAuth 1 doesn't support `state` param csrf out of the box.
# So we implement it ourselves ( -__- )
# https://twittercommunity.com/t/is-the-state-parameter-supported/1889
if provider is 'twitter' and not req.query.state
rand = Math.random().toString()
h = crypto.createHash('sha1').update(rand).digest('hex')
req.session.twitterState = h
options.callbackURL = "#{opts.APP_URL}#{opts.twitterCallbackPath}?state=#{h}"
passport.authenticate(provider, options)(req, res, next)
@afterSocialAuth = (provider) -> (req, res, next) ->
return next(new Error "#{provider} denied") if req.query.denied
# Twitter OAuth 1 doesn't support `state` param csrf out of the box.
# So we implement it ourselves ( -__- )
# https://twittercommunity.com/t/is-the-state-parameter-supported/1889
if provider is 'twitter' and req.query.state isnt req.session.twitterState
err = new Error "Must pass a valid `state` param."
return next err
# Determine if we're linking the account and handle any Gravity errors
# that we can do a better job explaining and redirecting for.
providerName = switch provider
when 'linkedin' then 'LinkedIn'
else _s.capitalize provider
linkingAccount = req.user?
passport.authenticate(provider) req, res, (err) ->
if err?.response?.body?.error is 'User Already Exists'
if req.socialProfileEmail
msg = "A user with the email address #{req.socialProfileEmail} already " +
"exists. Log in to Artsy via email and password and link " +
"#{providerName} in your settings instead."
else
msg = "#{providerName} account previously linked to Artsy. " +
"Log in to your Artsy account via email and password and link" +
"#{providerName} in your settings instead."
res.redirect opts.loginPagePath + '?error=' + msg
else if err?.response?.body?.error is 'Another Account Already Linked'
msg = "#{providerName} account already linked to another Artsy account. " +
"Try logging out and back in with #{providerName}. Then consider " +
"deleting that user account and re-linking #{providerName}. "
res.redirect opts.settingsPagePath + '?error=' + msg
else if err?.message?.match 'Unauthorized source IP address'
msg = "Your IP address was blocked by Facebook."
res.redirect opts.loginPagePath + '?error=' + msg
else if err?
msg = err.message or err.toString?()
res.redirect opts.loginPagePath + '?error=' + msg
else if linkingAccount
res.redirect opts.settingsPagePath
else if req.artsyPassportSignedUp and provider is 'twitter'
res.redirect opts.twitterLastStepPath
else if req.artsyPassportSignedUp and !req.session.skipOnboarding
res.redirect opts.afterSignupPagePath
else
next()
@ensureLoggedInOnAfterSignupPage = (req, res, next) ->
res.redirect opts.loginPagePath unless req.user?
next()
@onError = (err, req, res, next) ->
if err.message is 'twitter denied'
res.redirect opts.loginPagePath + "?error=Canceled Twitter login"
else
next err
@ssoAndRedirectBack = (req, res, next) ->
return res.send { success: true, user: req.user.toJSON() } if req.xhr
parsed = parse redirectBack req
parsed = parse resolve opts.APP_URL, parsed.path unless parsed.hostname
domain = parsed.hostname?.split('.').slice(1).join('.')
return redirectBack(req, res) if domain isnt 'artsy.net'
request
.post "#{opts.ARTSY_URL}/api/v1/me/trust_token"
.set 'X-Access-Token': req.user.get 'accessToken'
.end (err, sres) ->
return res.redirect parsed.href if err
res.redirect "#{opts.ARTSY_URL}/users/sign_in" +
"?trust_token=#{sres.body.trust_token}" +
"&redirect_uri=#{parsed.href}"
| true | #
# Middleware functions that help control what happens before and after
# logging in or signing up.
#
_ = require 'underscore'
_s = require 'underscore.string'
opts = require '../options'
passport = require 'passport'
qs = require 'querystring'
redirectBack = require './redirectback'
request = require 'superagent'
artsyXapp = require 'artsy-xapp'
Mailcheck = require 'mailcheck'
crypto = require 'crypto'
{ parse, resolve } = require 'url'
@onLocalLogin = (req, res, next) ->
return next() if req.user and not req.xhr
passport.authenticate('local') req, res, (err) ->
if req.xhr
if err
res.send 500, { success: false, error: err.message }
else
next()
else
if err?.response?.body?.error_description is 'invalid email or password'
res.redirect opts.loginPagePath + '?error=Invalid email or password.'
else if err
next err
else
next()
@onLocalSignup = (req, res, next) ->
req.artsyPassportSignedUp = true
request
.post(opts.ARTSY_URL + '/api/v1/user')
.set('X-Xapp-Token': artsyXapp.token, 'User-Agent': req.get 'user-agent')
.send(
name: req.body.name
email: req.body.email
password: PI:PASSWORD:<PASSWORD>END_PI
).end (err, sres) ->
if err and err.message is 'Email is invalid.'
suggestion = Mailcheck.run(email: req.body.email)?.full
msg = "Email is invalid."
msg += " Did you mean #{suggestion}?" if suggestion
if req.xhr
res.send 403, { success: false, error: msg }
else
res.redirect opts.signupPagePath + "?error=#{msg}"
else if err and req.xhr
msg = err.response?.body?.error or err.message
res.send 500, { success: false, error: msg }
else if err
next new Error err
else
next()
@beforeSocialAuth = (provider) -> (req, res, next) ->
req.session.redirectTo = req.query['redirect-to']
req.session.skipOnboarding = req.query['skip-onboarding']
options = {}
options.scope = switch provider
when 'linkedin' then ['r_basicprofile', 'r_emailaddress']
else 'email'
# Twitter OAuth 1 doesn't support `state` param csrf out of the box.
# So we implement it ourselves ( -__- )
# https://twittercommunity.com/t/is-the-state-parameter-supported/1889
if provider is 'twitter' and not req.query.state
rand = Math.random().toString()
h = crypto.createHash('sha1').update(rand).digest('hex')
req.session.twitterState = h
options.callbackURL = "#{opts.APP_URL}#{opts.twitterCallbackPath}?state=#{h}"
passport.authenticate(provider, options)(req, res, next)
@afterSocialAuth = (provider) -> (req, res, next) ->
return next(new Error "#{provider} denied") if req.query.denied
# Twitter OAuth 1 doesn't support `state` param csrf out of the box.
# So we implement it ourselves ( -__- )
# https://twittercommunity.com/t/is-the-state-parameter-supported/1889
if provider is 'twitter' and req.query.state isnt req.session.twitterState
err = new Error "Must pass a valid `state` param."
return next err
# Determine if we're linking the account and handle any Gravity errors
# that we can do a better job explaining and redirecting for.
providerName = switch provider
when 'linkedin' then 'LinkedIn'
else _s.capitalize provider
linkingAccount = req.user?
passport.authenticate(provider) req, res, (err) ->
if err?.response?.body?.error is 'User Already Exists'
if req.socialProfileEmail
msg = "A user with the email address #{req.socialProfileEmail} already " +
"exists. Log in to Artsy via email and password and link " +
"#{providerName} in your settings instead."
else
msg = "#{providerName} account previously linked to Artsy. " +
"Log in to your Artsy account via email and password and link" +
"#{providerName} in your settings instead."
res.redirect opts.loginPagePath + '?error=' + msg
else if err?.response?.body?.error is 'Another Account Already Linked'
msg = "#{providerName} account already linked to another Artsy account. " +
"Try logging out and back in with #{providerName}. Then consider " +
"deleting that user account and re-linking #{providerName}. "
res.redirect opts.settingsPagePath + '?error=' + msg
else if err?.message?.match 'Unauthorized source IP address'
msg = "Your IP address was blocked by Facebook."
res.redirect opts.loginPagePath + '?error=' + msg
else if err?
msg = err.message or err.toString?()
res.redirect opts.loginPagePath + '?error=' + msg
else if linkingAccount
res.redirect opts.settingsPagePath
else if req.artsyPassportSignedUp and provider is 'twitter'
res.redirect opts.twitterLastStepPath
else if req.artsyPassportSignedUp and !req.session.skipOnboarding
res.redirect opts.afterSignupPagePath
else
next()
@ensureLoggedInOnAfterSignupPage = (req, res, next) ->
res.redirect opts.loginPagePath unless req.user?
next()
@onError = (err, req, res, next) ->
if err.message is 'twitter denied'
res.redirect opts.loginPagePath + "?error=Canceled Twitter login"
else
next err
@ssoAndRedirectBack = (req, res, next) ->
return res.send { success: true, user: req.user.toJSON() } if req.xhr
parsed = parse redirectBack req
parsed = parse resolve opts.APP_URL, parsed.path unless parsed.hostname
domain = parsed.hostname?.split('.').slice(1).join('.')
return redirectBack(req, res) if domain isnt 'artsy.net'
request
.post "#{opts.ARTSY_URL}/api/v1/me/trust_token"
.set 'X-Access-Token': req.user.get 'accessToken'
.end (err, sres) ->
return res.redirect parsed.href if err
res.redirect "#{opts.ARTSY_URL}/users/sign_in" +
"?trust_token=#{sres.body.trust_token}" +
"&redirect_uri=#{parsed.href}"
|
[
{
"context": "###!\nApp.net timeline fetcher (c) 2013 Brandon Mathis, @imathis // MIT License\nVersion: 1.2\nSource: htt",
"end": 53,
"score": 0.9998561143875122,
"start": 39,
"tag": "NAME",
"value": "Brandon Mathis"
},
{
"context": "\nApp.net timeline fetcher (c) 2013 Brandon Mathis... | javascripts/coffeescript/adn-timeline.coffee | imathis/adn-timeline | 3 | ###!
App.net timeline fetcher (c) 2013 Brandon Mathis, @imathis // MIT License
Version: 1.2
Source: https://github.com/imathis/adn-timeline/
###
class AdnTimeline
defaults:
el: '.adn-timeline'
count: 4
replies: false
reposts: false
cookie: 'adn-timeline'
avatars: false
# A page can render multiple timelines
# Options can be passed as simple hash, but an array allows multiple timelines to be configured independantly
# If no options are passed init will look for elements with the class '.adn-feed' and read data attributes to configure options
constructor: (optionsArray=[{}]) ->
# Single options hashes are dropped into an array to unify the approach
optionsArray = [optionsArray] unless optionsArray instanceof Array
for options in optionsArray
# Configuring timeline is very flexible
# Options are loaded in order of element data-attributes, passed options, and finally defaults.
$(options.el or @defaults.el).each (i, el) =>
el = $(el)
options.render or= @render
callback = options.callback or (->)
options = $.extend({}, @defaults, options, el.data())
options.el = el
options.username = options.username?.replace '@', ''
options.hashtag = options.hashtag?.replace '#', ''
return console.error 'You need to provide an App.net username or hashtag' unless options.username? or options.hashtag?
options.cookie = options.cookie + "-#{options.username or options.hashtag}" if options.cookie is @defaults.cookie
@timeline(@helpers).fetch @render, callback, options
@
# Walk through a series of options, returning the first option which is not undefined or NaN.
# This allows options to cascade.
cascadeOptions: (options...) ->
for option in options
if option? and option is option
return option; break
# Convert posts to HTML and render them in target element.
render: (options, posts) ->
el = options.el
text = "<ul id='adn-timeline-#{options.username or options.hashtag}'>"
for post in posts
text += "<li><figure class='adn-post'>"
if post.author.avatar
text += "<a href='#{post.author.url}' class='adn-author-avatar-link'>"
text += "<img alt='@#{post.author.username}'s avatar on App.net' class='adn-author-avatar' width=48 src='#{post.author.avatar}'>"
text += "</a>"
text += "<figcaption>"
if post.author.unique
text += "<p>"
text += "<a href='#{post.author.url}' class='adn-author-url' rel=author>"
text += "<strong class='adn-author-name'>#{post.author.name}</strong> <span class='adn-author-username'>@#{post.author.username}</span>"
text += "</a></p>"
text += "<a href='#{post.url}' class='adn-post-url'><time datetime='#{post.date}'>#{post.display_date}</time></a>"
text += "</figcaption>"
text += "<blockquote><p>"
text += post.text
text += "</p></blockquote>"
text += "<p class='adn-reposted'><span class='adn-repost-marker'>➥</span> reposted by <a href='#{post.repost.user.url}'>#{post.repost.user.name}</a></p>" if post.repost
text += "</figure></li>"
text += "</ul>"
el.append text
# Returns a function for easy variable scoping
timeline: (helpers) ->
data: []
# Let's get some data!
fetch: (render, callback, options) ->
# Using the jquery cookies plugin is optional, but recommended
# When testing we can set cookie to false to disable cookie storage
if $.cookie and options.cookie and posts = $.cookie options.cookie
data = JSON.parse posts
if data.length isnt options.count
$.removeCookie options.cookie
@fetch render, callback, options
else
options.render options, data, render
callback data
else
url = "https://alpha-api.app.net/stream/0/"
url += "users/@#{options.username}/posts?include_deleted=0" if options.username
url += "posts/tag/#{options.hashtag}?include_deleted=0" if options.hashtag
# before_id allows us to page through posts if the first fetch didn't yeild enough posts.
url += "&before_id=#{options.before_id}" if options.before_id
url += "&include_directed_posts=0" unless options.replies
url += "&callback=?"
$.ajax
url: url
dataType: 'jsonp'
error: (err) ->
console.error 'Error fetching App.net timeline'
console.error err
success: (response) =>
# Strip out reposts if necessary
unless options.reposts
data = []
(data.push post unless post.repost_of) for post in response.data
response.data = data
# Add up response data to see if we have enough posts to continue
@data = @data.concat response.data
if @data.length < options.count
# Set before_id and fetch the next page of posts
options.before_id = response.meta.min_id
@fetch render, callback, options
else
# Now that we have enough posts, let's condense the data and store a cookie if possible.
@data = (helpers.postData post, options for post in @data.slice(0, options.count))
$.cookie(options.cookie, JSON.stringify @data, { path: '/' }) if $.cookie and options.cookie
options.render options, @data, render
callback @data
# Post parsing helpers are scoped for easier internal referencing when passed into timeline
helpers:
# Trims urls to 40 characters. Tries to trim urls elegantly on a '/'.
# Why 40 characters? When linking to App.net posts, usernames (which can be 20 characters) are never trimmed.
trimUrl: (url)->
parts = []
max = 40
url = url.replace /(https?:\/\/)/i, ''
# Split up a url then put it back together until it's too long
for part in url.split '/'
break unless parts.concat(part).join('/').length < max
parts.push part
short = parts.join('/')
# If a url gets too short, slice at 40 characters to preserve useful url information.
# http://example.com/?q=wow+that+is+quite+a+query+you+have+there would be trimmed to example.com...
# Instead we get example.com/?q=wow+that+is+quite+a+query...
short = url.slice(0, max) if url.length - short.length > 15
# Finally add an elipsis if the url was actually shortened
if short.length < url.length then short + '…' else short
# Replace the display urls with shorter ones preventing long urls from dominating a post
trimDisplayUrls: (text)->
text.replace />\s*(https?:\/\/.+?)\s*</gi, (match, p1)=> ">#{@trimUrl(p1)}<"
# Trim urls and replace mentions and hashtags with links
linkify: (post)->
text = @trimDisplayUrls post.html
# Using entities from the API ensures we never accidentally link a username with no account.
# We could use a regex for hastags but this format is more clear and there's no worry that our regex differs from App.net.
text = text.replace new RegExp("@(#{mention.name})", "gi"), "<a class='adn-username' href='https://alpha.app.net/$1'>@$1</a>" for mention in post.entities.mentions
text = text.replace new RegExp("#(#{hashtag.name})", "gi"), "<a class='adn-hashtag' href='https://alpha.app.net/hashtags/$1'>#$1</a>" for hashtag in post.entities.hashtags
text
postData: (post, options) ->
repost = if !!(post.repost_of) then { user: { username: post.user.username, name: post.user.name, ur: post.user.canonical_url } } else false
post = post.repost_of if repost
avatar = post.user.avatar_image.url if options.avatars
{
repost: repost
url: post.canonical_url
date: post.created_at
display_date: @timeago post.created_at
author: { username: post.user.username, name: post.user.name, url: post.user.canonical_url, avatar: avatar, unique: !!(options.reposts or options.hashtag) }
text: @linkify post
}
# Timeago by Brandon Mathis, based on JavaScript Pretty Date Copyright (c) 2011 John Resig
# Returns relative time
timeago: (time)->
say =
just_now: "now"
minute_ago: "1m"
minutes_ago: "m"
hour_ago: "1h"
hours_ago: "h"
yesterday: "1d"
days_ago: "d"
last_week: "1w"
weeks_ago: "w"
secs = ((new Date().getTime() - new Date(time).getTime()) / 1000)
mins = Math.floor secs / 60
hours = Math.floor secs / 3600
days = Math.floor secs / 86400
weeks = Math.floor days / 7
return '#' if isNaN(secs) or days < 0
if days is 0
if secs < 60 then say.just_now
else if secs < 120 then say.minute_ago
else if secs < 3600 then mins + say.minutes_ago
else if secs < 7200 then say.hour_ago
else hours + say.hours_ago
else
if days is 1 then say.yesterday
else if days < 7 then days + say.days_ago
else if days is 7 then say.last_week
else weeks + say.weeks_ago
# CommonJS Footer
if exports?
if module? and module.exports
module.exports = AdnTimeline
else
exports.AdnTimeline = AdnTimeline
else
@AdnTimeline = AdnTimeline
| 205490 | ###!
App.net timeline fetcher (c) 2013 <NAME>, @imathis // MIT License
Version: 1.2
Source: https://github.com/imathis/adn-timeline/
###
class AdnTimeline
defaults:
el: '.adn-timeline'
count: 4
replies: false
reposts: false
cookie: 'adn-timeline'
avatars: false
# A page can render multiple timelines
# Options can be passed as simple hash, but an array allows multiple timelines to be configured independantly
# If no options are passed init will look for elements with the class '.adn-feed' and read data attributes to configure options
constructor: (optionsArray=[{}]) ->
# Single options hashes are dropped into an array to unify the approach
optionsArray = [optionsArray] unless optionsArray instanceof Array
for options in optionsArray
# Configuring timeline is very flexible
# Options are loaded in order of element data-attributes, passed options, and finally defaults.
$(options.el or @defaults.el).each (i, el) =>
el = $(el)
options.render or= @render
callback = options.callback or (->)
options = $.extend({}, @defaults, options, el.data())
options.el = el
options.username = options.username?.replace '@', ''
options.hashtag = options.hashtag?.replace '#', ''
return console.error 'You need to provide an App.net username or hashtag' unless options.username? or options.hashtag?
options.cookie = options.cookie + "-#{options.username or options.hashtag}" if options.cookie is @defaults.cookie
@timeline(@helpers).fetch @render, callback, options
@
# Walk through a series of options, returning the first option which is not undefined or NaN.
# This allows options to cascade.
cascadeOptions: (options...) ->
for option in options
if option? and option is option
return option; break
# Convert posts to HTML and render them in target element.
render: (options, posts) ->
el = options.el
text = "<ul id='adn-timeline-#{options.username or options.hashtag}'>"
for post in posts
text += "<li><figure class='adn-post'>"
if post.author.avatar
text += "<a href='#{post.author.url}' class='adn-author-avatar-link'>"
text += "<img alt='@#{post.author.username}'s avatar on App.net' class='adn-author-avatar' width=48 src='#{post.author.avatar}'>"
text += "</a>"
text += "<figcaption>"
if post.author.unique
text += "<p>"
text += "<a href='#{post.author.url}' class='adn-author-url' rel=author>"
text += "<strong class='adn-author-name'>#{post.author.name}</strong> <span class='adn-author-username'>@#{post.author.username}</span>"
text += "</a></p>"
text += "<a href='#{post.url}' class='adn-post-url'><time datetime='#{post.date}'>#{post.display_date}</time></a>"
text += "</figcaption>"
text += "<blockquote><p>"
text += post.text
text += "</p></blockquote>"
text += "<p class='adn-reposted'><span class='adn-repost-marker'>➥</span> reposted by <a href='#{post.repost.user.url}'>#{post.repost.user.name}</a></p>" if post.repost
text += "</figure></li>"
text += "</ul>"
el.append text
# Returns a function for easy variable scoping
timeline: (helpers) ->
data: []
# Let's get some data!
fetch: (render, callback, options) ->
# Using the jquery cookies plugin is optional, but recommended
# When testing we can set cookie to false to disable cookie storage
if $.cookie and options.cookie and posts = $.cookie options.cookie
data = JSON.parse posts
if data.length isnt options.count
$.removeCookie options.cookie
@fetch render, callback, options
else
options.render options, data, render
callback data
else
url = "https://alpha-api.app.net/stream/0/"
url += "users/@#{options.username}/posts?include_deleted=0" if options.username
url += "posts/tag/#{options.hashtag}?include_deleted=0" if options.hashtag
# before_id allows us to page through posts if the first fetch didn't yeild enough posts.
url += "&before_id=#{options.before_id}" if options.before_id
url += "&include_directed_posts=0" unless options.replies
url += "&callback=?"
$.ajax
url: url
dataType: 'jsonp'
error: (err) ->
console.error 'Error fetching App.net timeline'
console.error err
success: (response) =>
# Strip out reposts if necessary
unless options.reposts
data = []
(data.push post unless post.repost_of) for post in response.data
response.data = data
# Add up response data to see if we have enough posts to continue
@data = @data.concat response.data
if @data.length < options.count
# Set before_id and fetch the next page of posts
options.before_id = response.meta.min_id
@fetch render, callback, options
else
# Now that we have enough posts, let's condense the data and store a cookie if possible.
@data = (helpers.postData post, options for post in @data.slice(0, options.count))
$.cookie(options.cookie, JSON.stringify @data, { path: '/' }) if $.cookie and options.cookie
options.render options, @data, render
callback @data
# Post parsing helpers are scoped for easier internal referencing when passed into timeline
helpers:
# Trims urls to 40 characters. Tries to trim urls elegantly on a '/'.
# Why 40 characters? When linking to App.net posts, usernames (which can be 20 characters) are never trimmed.
trimUrl: (url)->
parts = []
max = 40
url = url.replace /(https?:\/\/)/i, ''
# Split up a url then put it back together until it's too long
for part in url.split '/'
break unless parts.concat(part).join('/').length < max
parts.push part
short = parts.join('/')
# If a url gets too short, slice at 40 characters to preserve useful url information.
# http://example.com/?q=wow+that+is+quite+a+query+you+have+there would be trimmed to example.com...
# Instead we get example.com/?q=wow+that+is+quite+a+query...
short = url.slice(0, max) if url.length - short.length > 15
# Finally add an elipsis if the url was actually shortened
if short.length < url.length then short + '…' else short
# Replace the display urls with shorter ones preventing long urls from dominating a post
trimDisplayUrls: (text)->
text.replace />\s*(https?:\/\/.+?)\s*</gi, (match, p1)=> ">#{@trimUrl(p1)}<"
# Trim urls and replace mentions and hashtags with links
linkify: (post)->
text = @trimDisplayUrls post.html
# Using entities from the API ensures we never accidentally link a username with no account.
# We could use a regex for hastags but this format is more clear and there's no worry that our regex differs from App.net.
text = text.replace new RegExp("@(#{mention.name})", "gi"), "<a class='adn-username' href='https://alpha.app.net/$1'>@$1</a>" for mention in post.entities.mentions
text = text.replace new RegExp("#(#{hashtag.name})", "gi"), "<a class='adn-hashtag' href='https://alpha.app.net/hashtags/$1'>#$1</a>" for hashtag in post.entities.hashtags
text
postData: (post, options) ->
repost = if !!(post.repost_of) then { user: { username: post.user.username, name: post.user.name, ur: post.user.canonical_url } } else false
post = post.repost_of if repost
avatar = post.user.avatar_image.url if options.avatars
{
repost: repost
url: post.canonical_url
date: post.created_at
display_date: @timeago post.created_at
author: { username: post.user.username, name: post.user.name, url: post.user.canonical_url, avatar: avatar, unique: !!(options.reposts or options.hashtag) }
text: @linkify post
}
# Timeago by <NAME>, based on JavaScript Pretty Date Copyright (c) 2011 <NAME>
# Returns relative time
timeago: (time)->
say =
just_now: "now"
minute_ago: "1m"
minutes_ago: "m"
hour_ago: "1h"
hours_ago: "h"
yesterday: "1d"
days_ago: "d"
last_week: "1w"
weeks_ago: "w"
secs = ((new Date().getTime() - new Date(time).getTime()) / 1000)
mins = Math.floor secs / 60
hours = Math.floor secs / 3600
days = Math.floor secs / 86400
weeks = Math.floor days / 7
return '#' if isNaN(secs) or days < 0
if days is 0
if secs < 60 then say.just_now
else if secs < 120 then say.minute_ago
else if secs < 3600 then mins + say.minutes_ago
else if secs < 7200 then say.hour_ago
else hours + say.hours_ago
else
if days is 1 then say.yesterday
else if days < 7 then days + say.days_ago
else if days is 7 then say.last_week
else weeks + say.weeks_ago
# CommonJS Footer
if exports?
if module? and module.exports
module.exports = AdnTimeline
else
exports.AdnTimeline = AdnTimeline
else
@AdnTimeline = AdnTimeline
| true | ###!
App.net timeline fetcher (c) 2013 PI:NAME:<NAME>END_PI, @imathis // MIT License
Version: 1.2
Source: https://github.com/imathis/adn-timeline/
###
class AdnTimeline
defaults:
el: '.adn-timeline'
count: 4
replies: false
reposts: false
cookie: 'adn-timeline'
avatars: false
# A page can render multiple timelines
# Options can be passed as simple hash, but an array allows multiple timelines to be configured independantly
# If no options are passed init will look for elements with the class '.adn-feed' and read data attributes to configure options
constructor: (optionsArray=[{}]) ->
# Single options hashes are dropped into an array to unify the approach
optionsArray = [optionsArray] unless optionsArray instanceof Array
for options in optionsArray
# Configuring timeline is very flexible
# Options are loaded in order of element data-attributes, passed options, and finally defaults.
$(options.el or @defaults.el).each (i, el) =>
el = $(el)
options.render or= @render
callback = options.callback or (->)
options = $.extend({}, @defaults, options, el.data())
options.el = el
options.username = options.username?.replace '@', ''
options.hashtag = options.hashtag?.replace '#', ''
return console.error 'You need to provide an App.net username or hashtag' unless options.username? or options.hashtag?
options.cookie = options.cookie + "-#{options.username or options.hashtag}" if options.cookie is @defaults.cookie
@timeline(@helpers).fetch @render, callback, options
@
# Walk through a series of options, returning the first option which is not undefined or NaN.
# This allows options to cascade.
cascadeOptions: (options...) ->
for option in options
if option? and option is option
return option; break
# Convert posts to HTML and render them in target element.
render: (options, posts) ->
el = options.el
text = "<ul id='adn-timeline-#{options.username or options.hashtag}'>"
for post in posts
text += "<li><figure class='adn-post'>"
if post.author.avatar
text += "<a href='#{post.author.url}' class='adn-author-avatar-link'>"
text += "<img alt='@#{post.author.username}'s avatar on App.net' class='adn-author-avatar' width=48 src='#{post.author.avatar}'>"
text += "</a>"
text += "<figcaption>"
if post.author.unique
text += "<p>"
text += "<a href='#{post.author.url}' class='adn-author-url' rel=author>"
text += "<strong class='adn-author-name'>#{post.author.name}</strong> <span class='adn-author-username'>@#{post.author.username}</span>"
text += "</a></p>"
text += "<a href='#{post.url}' class='adn-post-url'><time datetime='#{post.date}'>#{post.display_date}</time></a>"
text += "</figcaption>"
text += "<blockquote><p>"
text += post.text
text += "</p></blockquote>"
text += "<p class='adn-reposted'><span class='adn-repost-marker'>➥</span> reposted by <a href='#{post.repost.user.url}'>#{post.repost.user.name}</a></p>" if post.repost
text += "</figure></li>"
text += "</ul>"
el.append text
# Returns a function for easy variable scoping
timeline: (helpers) ->
data: []
# Let's get some data!
fetch: (render, callback, options) ->
# Using the jquery cookies plugin is optional, but recommended
# When testing we can set cookie to false to disable cookie storage
if $.cookie and options.cookie and posts = $.cookie options.cookie
data = JSON.parse posts
if data.length isnt options.count
$.removeCookie options.cookie
@fetch render, callback, options
else
options.render options, data, render
callback data
else
url = "https://alpha-api.app.net/stream/0/"
url += "users/@#{options.username}/posts?include_deleted=0" if options.username
url += "posts/tag/#{options.hashtag}?include_deleted=0" if options.hashtag
# before_id allows us to page through posts if the first fetch didn't yeild enough posts.
url += "&before_id=#{options.before_id}" if options.before_id
url += "&include_directed_posts=0" unless options.replies
url += "&callback=?"
$.ajax
url: url
dataType: 'jsonp'
error: (err) ->
console.error 'Error fetching App.net timeline'
console.error err
success: (response) =>
# Strip out reposts if necessary
unless options.reposts
data = []
(data.push post unless post.repost_of) for post in response.data
response.data = data
# Add up response data to see if we have enough posts to continue
@data = @data.concat response.data
if @data.length < options.count
# Set before_id and fetch the next page of posts
options.before_id = response.meta.min_id
@fetch render, callback, options
else
# Now that we have enough posts, let's condense the data and store a cookie if possible.
@data = (helpers.postData post, options for post in @data.slice(0, options.count))
$.cookie(options.cookie, JSON.stringify @data, { path: '/' }) if $.cookie and options.cookie
options.render options, @data, render
callback @data
# Post parsing helpers are scoped for easier internal referencing when passed into timeline
helpers:
# Trims urls to 40 characters. Tries to trim urls elegantly on a '/'.
# Why 40 characters? When linking to App.net posts, usernames (which can be 20 characters) are never trimmed.
trimUrl: (url)->
parts = []
max = 40
url = url.replace /(https?:\/\/)/i, ''
# Split up a url then put it back together until it's too long
for part in url.split '/'
break unless parts.concat(part).join('/').length < max
parts.push part
short = parts.join('/')
# If a url gets too short, slice at 40 characters to preserve useful url information.
# http://example.com/?q=wow+that+is+quite+a+query+you+have+there would be trimmed to example.com...
# Instead we get example.com/?q=wow+that+is+quite+a+query...
short = url.slice(0, max) if url.length - short.length > 15
# Finally add an elipsis if the url was actually shortened
if short.length < url.length then short + '…' else short
# Replace the display urls with shorter ones preventing long urls from dominating a post
trimDisplayUrls: (text)->
text.replace />\s*(https?:\/\/.+?)\s*</gi, (match, p1)=> ">#{@trimUrl(p1)}<"
# Trim urls and replace mentions and hashtags with links
linkify: (post)->
text = @trimDisplayUrls post.html
# Using entities from the API ensures we never accidentally link a username with no account.
# We could use a regex for hastags but this format is more clear and there's no worry that our regex differs from App.net.
text = text.replace new RegExp("@(#{mention.name})", "gi"), "<a class='adn-username' href='https://alpha.app.net/$1'>@$1</a>" for mention in post.entities.mentions
text = text.replace new RegExp("#(#{hashtag.name})", "gi"), "<a class='adn-hashtag' href='https://alpha.app.net/hashtags/$1'>#$1</a>" for hashtag in post.entities.hashtags
text
postData: (post, options) ->
repost = if !!(post.repost_of) then { user: { username: post.user.username, name: post.user.name, ur: post.user.canonical_url } } else false
post = post.repost_of if repost
avatar = post.user.avatar_image.url if options.avatars
{
repost: repost
url: post.canonical_url
date: post.created_at
display_date: @timeago post.created_at
author: { username: post.user.username, name: post.user.name, url: post.user.canonical_url, avatar: avatar, unique: !!(options.reposts or options.hashtag) }
text: @linkify post
}
# Timeago by PI:NAME:<NAME>END_PI, based on JavaScript Pretty Date Copyright (c) 2011 PI:NAME:<NAME>END_PI
# Returns relative time
timeago: (time)->
say =
just_now: "now"
minute_ago: "1m"
minutes_ago: "m"
hour_ago: "1h"
hours_ago: "h"
yesterday: "1d"
days_ago: "d"
last_week: "1w"
weeks_ago: "w"
secs = ((new Date().getTime() - new Date(time).getTime()) / 1000)
mins = Math.floor secs / 60
hours = Math.floor secs / 3600
days = Math.floor secs / 86400
weeks = Math.floor days / 7
return '#' if isNaN(secs) or days < 0
if days is 0
if secs < 60 then say.just_now
else if secs < 120 then say.minute_ago
else if secs < 3600 then mins + say.minutes_ago
else if secs < 7200 then say.hour_ago
else hours + say.hours_ago
else
if days is 1 then say.yesterday
else if days < 7 then days + say.days_ago
else if days is 7 then say.last_week
else weeks + say.weeks_ago
# CommonJS Footer
if exports?
if module? and module.exports
module.exports = AdnTimeline
else
exports.AdnTimeline = AdnTimeline
else
@AdnTimeline = AdnTimeline
|
[
{
"context": "# @Author: Guan Gui <guiguan>\n# @Date: 2016-01-21T00:44:03+11:00\n# ",
"end": 19,
"score": 0.9998286366462708,
"start": 11,
"tag": "NAME",
"value": "Guan Gui"
},
{
"context": "# @Author: Guan Gui <guiguan>\n# @Date: 2016-01-21T00:44:03+11:00\n# @Email: ",
"end... | keymaps/file-header.cson | Shinrai/file-header | 38 | # @Author: Guan Gui <guiguan>
# @Date: 2016-01-21T00:44:03+11:00
# @Email: root@guiguan.net
# @Last modified by: guiguan
# @Last modified time: 2016-01-21T22:02:34+11:00
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://atom.io/docs/latest/behind-atom-keymaps-in-depth
'atom-text-editor:not(.mini)':
'shift-cmd-H': 'file-header:add'
| 193378 | # @Author: <NAME> <guiguan>
# @Date: 2016-01-21T00:44:03+11:00
# @Email: <EMAIL>
# @Last modified by: guiguan
# @Last modified time: 2016-01-21T22:02:34+11:00
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://atom.io/docs/latest/behind-atom-keymaps-in-depth
'atom-text-editor:not(.mini)':
'shift-cmd-H': 'file-header:add'
| true | # @Author: PI:NAME:<NAME>END_PI <guiguan>
# @Date: 2016-01-21T00:44:03+11:00
# @Email: PI:EMAIL:<EMAIL>END_PI
# @Last modified by: guiguan
# @Last modified time: 2016-01-21T22:02:34+11:00
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://atom.io/docs/latest/behind-atom-keymaps-in-depth
'atom-text-editor:not(.mini)':
'shift-cmd-H': 'file-header:add'
|
[
{
"context": "=================================\n# Copyright 2014 Hatio, Lab.\n# Licensed under The MIT License\n# http://o",
"end": 67,
"score": 0.9268958568572998,
"start": 62,
"tag": "NAME",
"value": "Hatio"
}
] | src/spec/SpecCircle.coffee | heartyoh/infopik | 0 | # ==========================================
# Copyright 2014 Hatio, Lab.
# Licensed under The MIT License
# http://opensource.org/licenses/MIT
# ==========================================
define [
'KineticJS'
], (kin) ->
"use strict"
createView = (attributes) ->
new kin.Circle(attributes)
createHandle = (attributes) ->
new Kin.Circle(attributes)
{
type: 'circle'
name: 'circle'
description: 'Circle Specification'
defaults: {
width: 100
height: 100
fill: 'green'
stroke: 'black'
strokeWidth: 4
}
view_factory_fn: createView
handle_factory_fn: createHandle
toolbox_image: 'images/toolbox_circle.png'
}
| 10158 | # ==========================================
# Copyright 2014 <NAME>, Lab.
# Licensed under The MIT License
# http://opensource.org/licenses/MIT
# ==========================================
define [
'KineticJS'
], (kin) ->
"use strict"
createView = (attributes) ->
new kin.Circle(attributes)
createHandle = (attributes) ->
new Kin.Circle(attributes)
{
type: 'circle'
name: 'circle'
description: 'Circle Specification'
defaults: {
width: 100
height: 100
fill: 'green'
stroke: 'black'
strokeWidth: 4
}
view_factory_fn: createView
handle_factory_fn: createHandle
toolbox_image: 'images/toolbox_circle.png'
}
| true | # ==========================================
# Copyright 2014 PI:NAME:<NAME>END_PI, Lab.
# Licensed under The MIT License
# http://opensource.org/licenses/MIT
# ==========================================
define [
'KineticJS'
], (kin) ->
"use strict"
createView = (attributes) ->
new kin.Circle(attributes)
createHandle = (attributes) ->
new Kin.Circle(attributes)
{
type: 'circle'
name: 'circle'
description: 'Circle Specification'
defaults: {
width: 100
height: 100
fill: 'green'
stroke: 'black'
strokeWidth: 4
}
view_factory_fn: createView
handle_factory_fn: createHandle
toolbox_image: 'images/toolbox_circle.png'
}
|
[
{
"context": "lback = (error, recentlyCompiled) ->) ->\n\t\tkey = \"compile:#{project_id}:#{user_id}\"\n\t\trclient.set key, true, \"EX\", @COMPILE_DELAY, \"N",
"end": 2050,
"score": 0.995663583278656,
"start": 2017,
"tag": "KEY",
"value": "compile:#{project_id}:#{user_id}\""
}
] | app/coffee/Features/Compile/CompileManager.coffee | ukasiu/web-sharelatex | 0 | Settings = require('settings-sharelatex')
redis = require('redis')
rclient = redis.createClient(Settings.redis.web.port, Settings.redis.web.host)
rclient.auth(Settings.redis.web.password)
DocumentUpdaterHandler = require "../DocumentUpdater/DocumentUpdaterHandler"
Project = require("../../models/Project").Project
ProjectRootDocManager = require "../Project/ProjectRootDocManager"
ClsiManager = require "./ClsiManager"
Metrics = require('../../infrastructure/Metrics')
logger = require("logger-sharelatex")
rateLimiter = require("../../infrastructure/RateLimiter")
module.exports = CompileManager =
compile: (project_id, user_id, opt = {}, _callback = (error) ->) ->
timer = new Metrics.Timer("editor.compile")
callback = (args...) ->
timer.done()
_callback(args...)
@_checkIfAutoCompileLimitHasBeenHit opt.isAutoCompile, (err, canCompile)->
if !canCompile
return callback null, "autocompile-backoff", []
logger.log project_id: project_id, user_id: user_id, "compiling project"
CompileManager._checkIfRecentlyCompiled project_id, user_id, (error, recentlyCompiled) ->
return callback(error) if error?
if recentlyCompiled
return callback new Error("project was recently compiled so not continuing")
CompileManager._ensureRootDocumentIsSet project_id, (error) ->
return callback(error) if error?
DocumentUpdaterHandler.flushProjectToMongo project_id, (error) ->
return callback(error) if error?
ClsiManager.sendRequest project_id, opt.settingsOverride, (error, status, outputFiles) ->
return callback(error) if error?
logger.log files: outputFiles, "output files"
callback(null, status, outputFiles)
getLogLines: (project_id, callback)->
Metrics.inc "editor.raw-logs"
ClsiManager.getLogLines project_id, (error, logLines)->
return callback(error) if error?
callback null, logLines
COMPILE_DELAY: 1 # seconds
_checkIfRecentlyCompiled: (project_id, user_id, callback = (error, recentlyCompiled) ->) ->
key = "compile:#{project_id}:#{user_id}"
rclient.set key, true, "EX", @COMPILE_DELAY, "NX", (error, ok) ->
return callback(error) if error?
if ok == "OK"
return callback null, false
else
return callback null, true
_checkIfAutoCompileLimitHasBeenHit: (isAutoCompile, callback = (err, canCompile)->)->
if !isAutoCompile
return callback(null, true)
opts =
endpointName:"auto_compile"
timeInterval:15
subjectName:"everyone"
throttle: 10
rateLimiter.addCount opts, (err, canCompile)->
if err?
canCompile = false
logger.log canCompile:canCompile, opts:opts, "checking if auto compile limit has been hit"
callback err, canCompile
_ensureRootDocumentIsSet: (project_id, callback = (error) ->) ->
Project.findById project_id, 'rootDoc_id', (error, project)=>
return callback(error) if error?
if !project?
return callback new Error("project not found")
if project.rootDoc_id?
callback()
else
ProjectRootDocManager.setRootDocAutomatically project_id, callback
| 152300 | Settings = require('settings-sharelatex')
redis = require('redis')
rclient = redis.createClient(Settings.redis.web.port, Settings.redis.web.host)
rclient.auth(Settings.redis.web.password)
DocumentUpdaterHandler = require "../DocumentUpdater/DocumentUpdaterHandler"
Project = require("../../models/Project").Project
ProjectRootDocManager = require "../Project/ProjectRootDocManager"
ClsiManager = require "./ClsiManager"
Metrics = require('../../infrastructure/Metrics')
logger = require("logger-sharelatex")
rateLimiter = require("../../infrastructure/RateLimiter")
module.exports = CompileManager =
compile: (project_id, user_id, opt = {}, _callback = (error) ->) ->
timer = new Metrics.Timer("editor.compile")
callback = (args...) ->
timer.done()
_callback(args...)
@_checkIfAutoCompileLimitHasBeenHit opt.isAutoCompile, (err, canCompile)->
if !canCompile
return callback null, "autocompile-backoff", []
logger.log project_id: project_id, user_id: user_id, "compiling project"
CompileManager._checkIfRecentlyCompiled project_id, user_id, (error, recentlyCompiled) ->
return callback(error) if error?
if recentlyCompiled
return callback new Error("project was recently compiled so not continuing")
CompileManager._ensureRootDocumentIsSet project_id, (error) ->
return callback(error) if error?
DocumentUpdaterHandler.flushProjectToMongo project_id, (error) ->
return callback(error) if error?
ClsiManager.sendRequest project_id, opt.settingsOverride, (error, status, outputFiles) ->
return callback(error) if error?
logger.log files: outputFiles, "output files"
callback(null, status, outputFiles)
getLogLines: (project_id, callback)->
Metrics.inc "editor.raw-logs"
ClsiManager.getLogLines project_id, (error, logLines)->
return callback(error) if error?
callback null, logLines
COMPILE_DELAY: 1 # seconds
_checkIfRecentlyCompiled: (project_id, user_id, callback = (error, recentlyCompiled) ->) ->
key = "<KEY>
rclient.set key, true, "EX", @COMPILE_DELAY, "NX", (error, ok) ->
return callback(error) if error?
if ok == "OK"
return callback null, false
else
return callback null, true
_checkIfAutoCompileLimitHasBeenHit: (isAutoCompile, callback = (err, canCompile)->)->
if !isAutoCompile
return callback(null, true)
opts =
endpointName:"auto_compile"
timeInterval:15
subjectName:"everyone"
throttle: 10
rateLimiter.addCount opts, (err, canCompile)->
if err?
canCompile = false
logger.log canCompile:canCompile, opts:opts, "checking if auto compile limit has been hit"
callback err, canCompile
_ensureRootDocumentIsSet: (project_id, callback = (error) ->) ->
Project.findById project_id, 'rootDoc_id', (error, project)=>
return callback(error) if error?
if !project?
return callback new Error("project not found")
if project.rootDoc_id?
callback()
else
ProjectRootDocManager.setRootDocAutomatically project_id, callback
| true | Settings = require('settings-sharelatex')
redis = require('redis')
rclient = redis.createClient(Settings.redis.web.port, Settings.redis.web.host)
rclient.auth(Settings.redis.web.password)
DocumentUpdaterHandler = require "../DocumentUpdater/DocumentUpdaterHandler"
Project = require("../../models/Project").Project
ProjectRootDocManager = require "../Project/ProjectRootDocManager"
ClsiManager = require "./ClsiManager"
Metrics = require('../../infrastructure/Metrics')
logger = require("logger-sharelatex")
rateLimiter = require("../../infrastructure/RateLimiter")
module.exports = CompileManager =
compile: (project_id, user_id, opt = {}, _callback = (error) ->) ->
timer = new Metrics.Timer("editor.compile")
callback = (args...) ->
timer.done()
_callback(args...)
@_checkIfAutoCompileLimitHasBeenHit opt.isAutoCompile, (err, canCompile)->
if !canCompile
return callback null, "autocompile-backoff", []
logger.log project_id: project_id, user_id: user_id, "compiling project"
CompileManager._checkIfRecentlyCompiled project_id, user_id, (error, recentlyCompiled) ->
return callback(error) if error?
if recentlyCompiled
return callback new Error("project was recently compiled so not continuing")
CompileManager._ensureRootDocumentIsSet project_id, (error) ->
return callback(error) if error?
DocumentUpdaterHandler.flushProjectToMongo project_id, (error) ->
return callback(error) if error?
ClsiManager.sendRequest project_id, opt.settingsOverride, (error, status, outputFiles) ->
return callback(error) if error?
logger.log files: outputFiles, "output files"
callback(null, status, outputFiles)
getLogLines: (project_id, callback)->
Metrics.inc "editor.raw-logs"
ClsiManager.getLogLines project_id, (error, logLines)->
return callback(error) if error?
callback null, logLines
COMPILE_DELAY: 1 # seconds
_checkIfRecentlyCompiled: (project_id, user_id, callback = (error, recentlyCompiled) ->) ->
key = "PI:KEY:<KEY>END_PI
rclient.set key, true, "EX", @COMPILE_DELAY, "NX", (error, ok) ->
return callback(error) if error?
if ok == "OK"
return callback null, false
else
return callback null, true
_checkIfAutoCompileLimitHasBeenHit: (isAutoCompile, callback = (err, canCompile)->)->
if !isAutoCompile
return callback(null, true)
opts =
endpointName:"auto_compile"
timeInterval:15
subjectName:"everyone"
throttle: 10
rateLimiter.addCount opts, (err, canCompile)->
if err?
canCompile = false
logger.log canCompile:canCompile, opts:opts, "checking if auto compile limit has been hit"
callback err, canCompile
_ensureRootDocumentIsSet: (project_id, callback = (error) ->) ->
Project.findById project_id, 'rootDoc_id', (error, project)=>
return callback(error) if error?
if !project?
return callback new Error("project not found")
if project.rootDoc_id?
callback()
else
ProjectRootDocManager.setRootDocAutomatically project_id, callback
|
[
{
"context": "# Chrome storage data key\nDATA_KEY = 'game-of-spoils'\n\n# jQuery selectors that specify elements to blo",
"end": 52,
"score": 0.6518591046333313,
"start": 38,
"tag": "KEY",
"value": "game-of-spoils"
},
{
"context": "ler blocker\nSPOILER_WORDS_LIST = [\n '#got'\n 'ad... | src/scripts/constants.coffee | stu-blair/game-of-spoils | 27 | # Chrome storage data key
DATA_KEY = 'game-of-spoils'
# jQuery selectors that specify elements to block on each supported site
AVCLUB_FEED_ELEMENTS_SELECTOR = '.item, article.short, article > .heading'
BUZZFEED_ELEMENTS_SELECTOR = '.card--article-featured, .card--article, .card--package, .card--video, .sidebar__link, .js-now-buzzing__list > li'
FACEBOOK_FEED_ELEMENTS_SELECTOR = 'div[data-testid="fbfeed_story"], div[role="article"], #pagelet_trending_tags_and_topics ul > li'
FEEDLY_ELEMENTS_SELECTOR = '.entry'
GIZMODO_ELEMENTS_SELECTOR = '.featured-item, article'
GOOGLE_NEWS_FEED_ELEMENTS_SELECTOR = 'a[target="_blank"]'
GOOGLE_PLUS_ELEMENTS_SELECTOR = 'div[id^="update-"], c-wiz div div c-wiz'
REDDIT_FEED_ELEMENTS_SELECTOR = '.sitetable > .thing.link:visible, .usertext-body'
SLACK_FEED_ELEMENTS_SELECTOR = 'ts-message'
TUMBLR_ELEMENTS_SELECTOR = '.post_container, article'
TWITTER_FEED_ELEMENTS_SELECTOR = "[data-item-type='tweet'], .trend-item"
YOUTUBE_ELEMENTS_SELECTOR = '.yt-lockup, .related-list-item, .comment-renderer-text'
# GoT-specific words that are potentially spoiler-ific and thus trigger a spoiler blocker
SPOILER_WORDS_LIST = [
'#got'
'ady stonehea'
'aidan gillen'
'alfie allen'
'arya stark'
'asoiaf'
'azor ahai'
'baelish'
'baratheon'
'ben crompton'
'bloodraven'
'braavos'
'bran stark'
'briene of tarth'
'brienne of tarth'
'carice van houten'
'casterly rock'
'cersei '
'conleth hill'
'd.b. weiss'
'daenerys'
'daniel portman'
'david benioff'
'davos seaworth'
'dornish'
'dothraki'
'dreadfort'
'emilia clarke'
'game of thrones'
'gameofthrone'
'gameofthone'
'gamesofthrone'
'greyjoy'
'gwendoline christie'
'highgarden'
'hodor'
'house bolton'
'house stark'
'house tyrell'
'howland reed'
'iain glen'
'ian mcelhinney'
'iron throne'
'isaac hempstead wright'
'jerome flynn'
'john bradley'
'jojen reed'
'jon snow'
'julian glover'
'khaleesi'
"king's landing"
'kit harington'
'kit harrington'
'kristian nairn'
'lanister'
'lannisport'
'lannister'
'lena headey'
'liam cunningham'
'littlefinger'
'maisie williams'
'meereen'
'melisandre'
'michele fairley'
'michelle fairley'
'myrcella'
'natalie dormer'
'nathalie emmanue'
'ned stark'
'nikolaj coster-waldau'
'olenna tyrell'
'peter dinklage'
'podrick payne'
'queen of thorns'
'ramsay bolton'
'roose bolton'
'rory mccann'
'sandor clegane'
'sansa stark'
'sophie turner'
'sothoryos'
'stephen dillane'
'targaryen'
'three eyed raven'
'tower of joy'
'tyrion'
'vaes dothrak'
'viserys'
'walder frey'
'westeros'
'white walker'
'whitewalker'
'wildling'
'winterfell'
]
# Regex formed from the spoiler array for quick matching
SPOILER_WORDS_REGEX = new RegExp(SPOILER_WORDS_LIST.join('|'), 'i')
# Phrases to describe the grisly ways that spoilers are disposed of
DEATH_NAMES = [
"got burned at the stake to appease R'hllor"
'contracted greyscale and was quarantined permanently'
'did not live through the Long Night'
'drank way too much Moon Tea'
'found itself too far north when winter came'
'is dark and full of terrors'
'lost in trial by combat'
'did not win the game of thrones'
'suffered terribly at the paws of Ser Pounce'
'warged into a dead cat'
'was grimly beheaded for desertion'
'was impaled by a lance at a tournament by a lowly hedge knight'
'was incinerated by hot dragon breath'
'was murdered by its very own nuncle'
'was slain by a shadow'
'was slowly poisoned over a period of many fortnights'
'was torn asunder by six direwolves'
]
# Subreddits that are GoT related, dont block GoT-related things there, since that'd pretty much block everything...
GOT_RELATED_SUBREDDITS = [
'gameofthrones'
'asoiaf'
'iceandfire'
'agotboardgame'
'gamesofthrones'
'westeros'
'thronescomics'
'asongofmemesandrage'
'earthoficeandfire'
]
GOT_SUBREDDITS_REGEX = new RegExp('(\/r\/)' + GOT_RELATED_SUBREDDITS.join('|'), 'i')
| 159237 | # Chrome storage data key
DATA_KEY = '<KEY>'
# jQuery selectors that specify elements to block on each supported site
AVCLUB_FEED_ELEMENTS_SELECTOR = '.item, article.short, article > .heading'
BUZZFEED_ELEMENTS_SELECTOR = '.card--article-featured, .card--article, .card--package, .card--video, .sidebar__link, .js-now-buzzing__list > li'
FACEBOOK_FEED_ELEMENTS_SELECTOR = 'div[data-testid="fbfeed_story"], div[role="article"], #pagelet_trending_tags_and_topics ul > li'
FEEDLY_ELEMENTS_SELECTOR = '.entry'
GIZMODO_ELEMENTS_SELECTOR = '.featured-item, article'
GOOGLE_NEWS_FEED_ELEMENTS_SELECTOR = 'a[target="_blank"]'
GOOGLE_PLUS_ELEMENTS_SELECTOR = 'div[id^="update-"], c-wiz div div c-wiz'
REDDIT_FEED_ELEMENTS_SELECTOR = '.sitetable > .thing.link:visible, .usertext-body'
SLACK_FEED_ELEMENTS_SELECTOR = 'ts-message'
TUMBLR_ELEMENTS_SELECTOR = '.post_container, article'
TWITTER_FEED_ELEMENTS_SELECTOR = "[data-item-type='tweet'], .trend-item"
YOUTUBE_ELEMENTS_SELECTOR = '.yt-lockup, .related-list-item, .comment-renderer-text'
# GoT-specific words that are potentially spoiler-ific and thus trigger a spoiler blocker
SPOILER_WORDS_LIST = [
'#got'
'ady <NAME>'
'aid<NAME>'
'<NAME>'
'ary<NAME>'
'asoiaf'
'azor ahai'
'baelish'
'baratheon'
'<NAME>'
'bloodraven'
'braavos'
'bran stark'
'briene of tarth'
'brienne of tarth'
'car<NAME>'
'<NAME>'
'<NAME> '
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'd<NAME>fort'
'<NAME>'
'game of thrones'
'gameofthrone'
'gameofthone'
'gamesofthrone'
'greyjoy'
'<NAME>'
'highgarden'
'<NAME>'
'house bolton'
'house stark'
'house tyrell'
'<NAME>'
'<NAME>'
'<NAME>'
'iron throne'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
"king's landing"
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'ned <NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'queen of thorns'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'<NAME>'
'three eyed raven'
'tower of joy'
'tyrion'
'vaes dothrak'
'viserys'
'walder frey'
'westeros'
'white walker'
'whitewalker'
'wildling'
'winterfell'
]
# Regex formed from the spoiler array for quick matching
SPOILER_WORDS_REGEX = new RegExp(SPOILER_WORDS_LIST.join('|'), 'i')
# Phrases to describe the grisly ways that spoilers are disposed of
DEATH_NAMES = [
"got burned at the stake to appease R'hllor"
'contracted greyscale and was quarantined permanently'
'did not live through the Long Night'
'drank way too much Moon Tea'
'found itself too far north when winter came'
'is dark and full of terrors'
'lost in trial by combat'
'did not win the game of thrones'
'suffered terribly at the paws of Ser Pounce'
'warged into a dead cat'
'was grimly beheaded for desertion'
'was impaled by a lance at a tournament by a lowly hedge knight'
'was incinerated by hot dragon breath'
'was murdered by its very own nuncle'
'was slain by a shadow'
'was slowly poisoned over a period of many fortnights'
'was torn asunder by six direwolves'
]
# Subreddits that are GoT related, dont block GoT-related things there, since that'd pretty much block everything...
GOT_RELATED_SUBREDDITS = [
'gameofthrones'
'asoiaf'
'iceandfire'
'agotboardgame'
'gamesofthrones'
'westeros'
'thronescomics'
'asongofmemesandrage'
'earthoficeandfire'
]
GOT_SUBREDDITS_REGEX = new RegExp('(\/r\/)' + GOT_RELATED_SUBREDDITS.join('|'), 'i')
| true | # Chrome storage data key
DATA_KEY = 'PI:KEY:<KEY>END_PI'
# jQuery selectors that specify elements to block on each supported site
AVCLUB_FEED_ELEMENTS_SELECTOR = '.item, article.short, article > .heading'
BUZZFEED_ELEMENTS_SELECTOR = '.card--article-featured, .card--article, .card--package, .card--video, .sidebar__link, .js-now-buzzing__list > li'
FACEBOOK_FEED_ELEMENTS_SELECTOR = 'div[data-testid="fbfeed_story"], div[role="article"], #pagelet_trending_tags_and_topics ul > li'
FEEDLY_ELEMENTS_SELECTOR = '.entry'
GIZMODO_ELEMENTS_SELECTOR = '.featured-item, article'
GOOGLE_NEWS_FEED_ELEMENTS_SELECTOR = 'a[target="_blank"]'
GOOGLE_PLUS_ELEMENTS_SELECTOR = 'div[id^="update-"], c-wiz div div c-wiz'
REDDIT_FEED_ELEMENTS_SELECTOR = '.sitetable > .thing.link:visible, .usertext-body'
SLACK_FEED_ELEMENTS_SELECTOR = 'ts-message'
TUMBLR_ELEMENTS_SELECTOR = '.post_container, article'
TWITTER_FEED_ELEMENTS_SELECTOR = "[data-item-type='tweet'], .trend-item"
YOUTUBE_ELEMENTS_SELECTOR = '.yt-lockup, .related-list-item, .comment-renderer-text'
# GoT-specific words that are potentially spoiler-ific and thus trigger a spoiler blocker
SPOILER_WORDS_LIST = [
'#got'
'ady PI:NAME:<NAME>END_PI'
'aidPI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'aryPI:NAME:<NAME>END_PI'
'asoiaf'
'azor ahai'
'baelish'
'baratheon'
'PI:NAME:<NAME>END_PI'
'bloodraven'
'braavos'
'bran stark'
'briene of tarth'
'brienne of tarth'
'carPI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI '
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'dPI:NAME:<NAME>END_PIfort'
'PI:NAME:<NAME>END_PI'
'game of thrones'
'gameofthrone'
'gameofthone'
'gamesofthrone'
'greyjoy'
'PI:NAME:<NAME>END_PI'
'highgarden'
'PI:NAME:<NAME>END_PI'
'house bolton'
'house stark'
'house tyrell'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'iron throne'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
"king's landing"
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'ned PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'queen of thorns'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'PI:NAME:<NAME>END_PI'
'three eyed raven'
'tower of joy'
'tyrion'
'vaes dothrak'
'viserys'
'walder frey'
'westeros'
'white walker'
'whitewalker'
'wildling'
'winterfell'
]
# Regex formed from the spoiler array for quick matching
SPOILER_WORDS_REGEX = new RegExp(SPOILER_WORDS_LIST.join('|'), 'i')
# Phrases to describe the grisly ways that spoilers are disposed of
DEATH_NAMES = [
"got burned at the stake to appease R'hllor"
'contracted greyscale and was quarantined permanently'
'did not live through the Long Night'
'drank way too much Moon Tea'
'found itself too far north when winter came'
'is dark and full of terrors'
'lost in trial by combat'
'did not win the game of thrones'
'suffered terribly at the paws of Ser Pounce'
'warged into a dead cat'
'was grimly beheaded for desertion'
'was impaled by a lance at a tournament by a lowly hedge knight'
'was incinerated by hot dragon breath'
'was murdered by its very own nuncle'
'was slain by a shadow'
'was slowly poisoned over a period of many fortnights'
'was torn asunder by six direwolves'
]
# Subreddits that are GoT related, dont block GoT-related things there, since that'd pretty much block everything...
GOT_RELATED_SUBREDDITS = [
'gameofthrones'
'asoiaf'
'iceandfire'
'agotboardgame'
'gamesofthrones'
'westeros'
'thronescomics'
'asongofmemesandrage'
'earthoficeandfire'
]
GOT_SUBREDDITS_REGEX = new RegExp('(\/r\/)' + GOT_RELATED_SUBREDDITS.join('|'), 'i')
|
[
{
"context": "###\n# @author Will Steinmetz\n# jQuery notification plug-in inspired by the not",
"end": 28,
"score": 0.9998559951782227,
"start": 14,
"tag": "NAME",
"value": "Will Steinmetz"
},
{
"context": "ation style of Windows 8\n# Copyright (c)2013-2015, Will Steinmetz\n# Licens... | public/third_party/notific8/grunt/update-json.coffee | pvndn/spa | 130 | ###
# @author Will Steinmetz
# jQuery notification plug-in inspired by the notification style of Windows 8
# Copyright (c)2013-2015, Will Steinmetz
# Licensed under the BSD license.
# http://opensource.org/licenses/BSD-3-Clause
###
module.exports = (grunt) ->
grunt.config('update_json',
options:
src: 'package.json'
indent: ' '
bower:
src: 'package.json'
dest: 'bower.json'
fields: 'version'
jquery:
src: 'package.json'
dest: 'notific8.jquery.json'
fields: 'version'
)
grunt.loadNpmTasks 'grunt-update-json'
| 118338 | ###
# @author <NAME>
# jQuery notification plug-in inspired by the notification style of Windows 8
# Copyright (c)2013-2015, <NAME>
# Licensed under the BSD license.
# http://opensource.org/licenses/BSD-3-Clause
###
module.exports = (grunt) ->
grunt.config('update_json',
options:
src: 'package.json'
indent: ' '
bower:
src: 'package.json'
dest: 'bower.json'
fields: 'version'
jquery:
src: 'package.json'
dest: 'notific8.jquery.json'
fields: 'version'
)
grunt.loadNpmTasks 'grunt-update-json'
| true | ###
# @author PI:NAME:<NAME>END_PI
# jQuery notification plug-in inspired by the notification style of Windows 8
# Copyright (c)2013-2015, PI:NAME:<NAME>END_PI
# Licensed under the BSD license.
# http://opensource.org/licenses/BSD-3-Clause
###
module.exports = (grunt) ->
grunt.config('update_json',
options:
src: 'package.json'
indent: ' '
bower:
src: 'package.json'
dest: 'bower.json'
fields: 'version'
jquery:
src: 'package.json'
dest: 'notific8.jquery.json'
fields: 'version'
)
grunt.loadNpmTasks 'grunt-update-json'
|
[
{
"context": "RIA state and property values are valid.\n# @author Ethan Cohen\n###\n\n# ------------------------------------------",
"end": 116,
"score": 0.9998547434806824,
"start": 105,
"tag": "NAME",
"value": "Ethan Cohen"
}
] | src/tests/rules/aria-proptypes.coffee | danielbayley/eslint-plugin-coffee | 21 | ### eslint-env jest ###
###*
# @fileoverview Enforce ARIA state and property values are valid.
# @author Ethan Cohen
###
# -----------------------------------------------------------------------------
# Requirements
# -----------------------------------------------------------------------------
path = require 'path'
assert = require 'assert'
{aria} = require 'aria-query'
{RuleTester} = require 'eslint'
{
default: parserOptionsMapper
} = require '../eslint-plugin-jsx-a11y-parser-options-mapper'
rule = require 'eslint-plugin-jsx-a11y/lib/rules/aria-proptypes'
{validityCheck} = rule
# -----------------------------------------------------------------------------
# Tests
# -----------------------------------------------------------------------------
ruleTester = new RuleTester parser: path.join __dirname, '../../..'
errorMessage = (name) ->
{type, values: permittedValues} = aria.get name.toLowerCase()
switch type
when 'tristate'
return "The value for #{name} must be a boolean or the string \"mixed\"."
when 'token'
return "The value for #{name} must be a single token from the following: #{permittedValues}."
when 'tokenlist'
return """
The value for #{name} must be a list of one or more \
tokens from the following: #{permittedValues}.
"""
when 'idlist'
return "The value for #{name} must be a list of strings that represent DOM element IDs (idlist)"
when 'id'
return "The value for #{name} must be a string that represents a DOM element ID"
else
return "The value for #{name} must be a #{type}."
describe 'validityCheck', ->
it 'should false for an unknown expected type', ->
# expect(validityCheck null, null).toBe no
assert.equal validityCheck(null, null), no
### eslint-disable coffee/no-template-curly-in-string ###
ruleTester.run 'aria-proptypes', rule,
valid: [
# DON'T TEST INVALID ARIA-* PROPS
code: '<div aria-foo="true" />'
,
code: '<div abcaria-foo="true" />'
,
# BOOLEAN
code: '<div aria-hidden={true} />'
,
code: '<div aria-hidden="true" />'
,
code: '<div aria-hidden={"false"} />'
,
code: '<div aria-hidden={!false} />'
,
code: '<div aria-hidden />'
,
code: '<div aria-hidden={false} />'
,
code: '<div aria-hidden={!true} />'
,
code: '<div aria-hidden={!"yes"} />'
,
code: '<div aria-hidden={foo} />'
,
code: '<div aria-hidden={foo.bar} />'
,
code: '<div aria-hidden={null} />'
,
code: '<div aria-hidden={undefined} />'
,
code: '<div aria-hidden={<div />} />'
,
# STRING
code: '<div aria-label="Close" />'
,
code: '<div aria-label={"Close"} />'
,
code: '<div aria-label={foo} />'
,
code: '<div aria-label={foo.bar} />'
,
code: '<div aria-label={null} />'
,
code: '<div aria-label={undefined} />'
,
code: '<input aria-invalid={error ? "true" : "false"} />'
,
code: '<input aria-invalid={undefined ? "true" : "false"} />'
,
# TRISTATE
code: '<div aria-checked={true} />'
,
code: '<div aria-checked="true" />'
,
code: '<div aria-checked={"false"} />'
,
code: '<div aria-checked={!false} />'
,
code: '<div aria-checked />'
,
code: '<div aria-checked={false} />'
,
code: '<div aria-checked={!true} />'
,
code: '<div aria-checked={!"yes"} />'
,
code: '<div aria-checked={foo} />'
,
code: '<div aria-checked={foo.bar} />'
,
code: '<div aria-checked="mixed" />'
,
code: '<div aria-checked={"mixed"} />'
,
code: '<div aria-checked={null} />'
,
code: '<div aria-checked={undefined} />'
,
# INTEGER
code: '<div aria-level={123} />'
,
code: '<div aria-level={-123} />'
,
code: '<div aria-level={+123} />'
,
code: '<div aria-level={~123} />'
,
code: '<div aria-level={"123"} />'
,
code: '<div aria-level={"123"} />'
,
code: '<div aria-level="123" />'
,
code: '<div aria-level={foo} />'
,
code: '<div aria-level={foo.bar} />'
,
code: '<div aria-level={null} />'
,
code: '<div aria-level={undefined} />'
,
# NUMBER
code: '<div aria-valuemax={123} />'
,
code: '<div aria-valuemax={-123} />'
,
code: '<div aria-valuemax={+123} />'
,
code: '<div aria-valuemax={~123} />'
,
code: '<div aria-valuemax={"123"} />'
,
code: '<div aria-valuemax={"123"} />'
,
code: '<div aria-valuemax="123" />'
,
code: '<div aria-valuemax={foo} />'
,
code: '<div aria-valuemax={foo.bar} />'
,
code: '<div aria-valuemax={null} />'
,
code: '<div aria-valuemax={undefined} />'
,
# TOKEN
code: '<div aria-sort="ascending" />'
,
code: '<div aria-sort="ASCENDING" />'
,
code: '<div aria-sort={"ascending"} />'
,
code: '<div aria-sort={"ascending"} />'
,
code: '<div aria-sort="descending" />'
,
code: '<div aria-sort={"descending"} />'
,
code: '<div aria-sort={"descending"} />'
,
code: '<div aria-sort="none" />'
,
code: '<div aria-sort={"none"} />'
,
code: '<div aria-sort={"none"} />'
,
code: '<div aria-sort="other" />'
,
code: '<div aria-sort={"other"} />'
,
code: '<div aria-sort={"other"} />'
,
code: '<div aria-sort={foo} />'
,
code: '<div aria-sort={foo.bar} />'
,
code: '<div aria-invalid={true} />'
,
code: '<div aria-invalid="true" />'
,
code: '<div aria-invalid={false} />'
,
code: '<div aria-invalid="false" />'
,
code: '<div aria-invalid="grammar" />'
,
code: '<div aria-invalid="spelling" />'
,
code: '<div aria-invalid={null} />'
,
code: '<div aria-invalid={undefined} />'
,
# TOKENLIST
code: '<div aria-relevant="additions" />'
,
code: '<div aria-relevant={"additions"} />'
,
code: '<div aria-relevant={"additions"} />'
,
code: '<div aria-relevant="additions removals" />'
,
code: '<div aria-relevant="additions additions" />'
,
code: '<div aria-relevant={"additions removals"} />'
,
code: '<div aria-relevant={"additions removals"} />'
,
code: '<div aria-relevant="additions removals text" />'
,
code: '<div aria-relevant={"additions removals text"} />'
,
code: '<div aria-relevant={"additions removals text"} />'
,
code: '<div aria-relevant="additions removals text all" />'
,
code: '<div aria-relevant={"additions removals text all"} />'
,
code: '<div aria-relevant={"removals additions text all"} />'
,
code: '<div aria-relevant={foo} />'
,
code: '<div aria-relevant={foo.bar} />'
,
code: '<div aria-relevant={null} />'
,
code: '<div aria-relevant={undefined} />'
,
# ID
code: '<div aria-activedescendant="ascending" />'
,
code: '<div aria-activedescendant="ASCENDING" />'
,
code: '<div aria-activedescendant={"ascending"} />'
,
code: '<div aria-activedescendant={"ascending"} />'
,
code: '<div aria-activedescendant="descending" />'
,
code: '<div aria-activedescendant={"descending"} />'
,
code: '<div aria-activedescendant={"descending"} />'
,
code: '<div aria-activedescendant="none" />'
,
code: '<div aria-activedescendant={"none"} />'
,
code: '<div aria-activedescendant={"none"} />'
,
code: '<div aria-activedescendant="other" />'
,
code: '<div aria-activedescendant={"other"} />'
,
code: '<div aria-activedescendant={"other"} />'
,
code: '<div aria-activedescendant={foo} />'
,
code: '<div aria-activedescendant={foo.bar} />'
,
code: '<div aria-activedescendant={null} />'
,
code: '<div aria-activedescendant={undefined} />'
,
# IDLIST
code: '<div aria-labelledby="additions" />'
,
code: '<div aria-labelledby={"additions"} />'
,
code: '<div aria-labelledby={"additions"} />'
,
code: '<div aria-labelledby="additions removals" />'
,
code: '<div aria-labelledby="additions additions" />'
,
code: '<div aria-labelledby={"additions removals"} />'
,
code: '<div aria-labelledby={"additions removals"} />'
,
code: '<div aria-labelledby="additions removals text" />'
,
code: '<div aria-labelledby={"additions removals text"} />'
,
code: '<div aria-labelledby={"additions removals text"} />'
,
code: '<div aria-labelledby="additions removals text all" />'
,
code: '<div aria-labelledby={"additions removals text all"} />'
,
code: '<div aria-labelledby={"removals additions text all"} />'
,
code: '<div aria-labelledby={foo} />'
,
code: '<div aria-labelledby={foo.bar} />'
,
code: '<div aria-labelledby={null} />'
,
code: '<div aria-labelledby={undefined} />'
].map parserOptionsMapper
invalid: [
# BOOLEAN
code: '<div aria-hidden="yes" />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden="no" />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden={1234} />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden={"#{abc}"} />'
errors: [errorMessage 'aria-hidden']
,
# STRING
code: '<div aria-label />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={true} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={false} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={1234} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={!true} />', errors: [errorMessage 'aria-label']
,
# TRISTATE
code: '<div aria-checked="yes" />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked="no" />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked={1234} />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked={"#{abc}"} />'
errors: [errorMessage 'aria-checked']
,
# INTEGER
code: '<div aria-level="yes" />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level="no" />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={"abc"} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={true} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={"false"} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={!"false"} />', errors: [errorMessage 'aria-level']
,
# NUMBER
code: '<div aria-valuemax="yes" />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax="no" />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={"abc"} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={true} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={"false"} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={!"false"} />'
errors: [errorMessage 'aria-valuemax']
,
# TOKEN
code: '<div aria-sort="" />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort="descnding" />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort={true} />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort={"false"} />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort="ascending descending" />'
errors: [errorMessage 'aria-sort']
,
# TOKENLIST
code: '<div aria-relevant="" />', errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="foobar" />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant />', errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant={true} />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant={"false"} />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="additions removalss" />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="additions removalss " />'
errors: [errorMessage 'aria-relevant']
].map parserOptionsMapper
| 202642 | ### eslint-env jest ###
###*
# @fileoverview Enforce ARIA state and property values are valid.
# @author <NAME>
###
# -----------------------------------------------------------------------------
# Requirements
# -----------------------------------------------------------------------------
path = require 'path'
assert = require 'assert'
{aria} = require 'aria-query'
{RuleTester} = require 'eslint'
{
default: parserOptionsMapper
} = require '../eslint-plugin-jsx-a11y-parser-options-mapper'
rule = require 'eslint-plugin-jsx-a11y/lib/rules/aria-proptypes'
{validityCheck} = rule
# -----------------------------------------------------------------------------
# Tests
# -----------------------------------------------------------------------------
ruleTester = new RuleTester parser: path.join __dirname, '../../..'
errorMessage = (name) ->
{type, values: permittedValues} = aria.get name.toLowerCase()
switch type
when 'tristate'
return "The value for #{name} must be a boolean or the string \"mixed\"."
when 'token'
return "The value for #{name} must be a single token from the following: #{permittedValues}."
when 'tokenlist'
return """
The value for #{name} must be a list of one or more \
tokens from the following: #{permittedValues}.
"""
when 'idlist'
return "The value for #{name} must be a list of strings that represent DOM element IDs (idlist)"
when 'id'
return "The value for #{name} must be a string that represents a DOM element ID"
else
return "The value for #{name} must be a #{type}."
describe 'validityCheck', ->
it 'should false for an unknown expected type', ->
# expect(validityCheck null, null).toBe no
assert.equal validityCheck(null, null), no
### eslint-disable coffee/no-template-curly-in-string ###
ruleTester.run 'aria-proptypes', rule,
valid: [
# DON'T TEST INVALID ARIA-* PROPS
code: '<div aria-foo="true" />'
,
code: '<div abcaria-foo="true" />'
,
# BOOLEAN
code: '<div aria-hidden={true} />'
,
code: '<div aria-hidden="true" />'
,
code: '<div aria-hidden={"false"} />'
,
code: '<div aria-hidden={!false} />'
,
code: '<div aria-hidden />'
,
code: '<div aria-hidden={false} />'
,
code: '<div aria-hidden={!true} />'
,
code: '<div aria-hidden={!"yes"} />'
,
code: '<div aria-hidden={foo} />'
,
code: '<div aria-hidden={foo.bar} />'
,
code: '<div aria-hidden={null} />'
,
code: '<div aria-hidden={undefined} />'
,
code: '<div aria-hidden={<div />} />'
,
# STRING
code: '<div aria-label="Close" />'
,
code: '<div aria-label={"Close"} />'
,
code: '<div aria-label={foo} />'
,
code: '<div aria-label={foo.bar} />'
,
code: '<div aria-label={null} />'
,
code: '<div aria-label={undefined} />'
,
code: '<input aria-invalid={error ? "true" : "false"} />'
,
code: '<input aria-invalid={undefined ? "true" : "false"} />'
,
# TRISTATE
code: '<div aria-checked={true} />'
,
code: '<div aria-checked="true" />'
,
code: '<div aria-checked={"false"} />'
,
code: '<div aria-checked={!false} />'
,
code: '<div aria-checked />'
,
code: '<div aria-checked={false} />'
,
code: '<div aria-checked={!true} />'
,
code: '<div aria-checked={!"yes"} />'
,
code: '<div aria-checked={foo} />'
,
code: '<div aria-checked={foo.bar} />'
,
code: '<div aria-checked="mixed" />'
,
code: '<div aria-checked={"mixed"} />'
,
code: '<div aria-checked={null} />'
,
code: '<div aria-checked={undefined} />'
,
# INTEGER
code: '<div aria-level={123} />'
,
code: '<div aria-level={-123} />'
,
code: '<div aria-level={+123} />'
,
code: '<div aria-level={~123} />'
,
code: '<div aria-level={"123"} />'
,
code: '<div aria-level={"123"} />'
,
code: '<div aria-level="123" />'
,
code: '<div aria-level={foo} />'
,
code: '<div aria-level={foo.bar} />'
,
code: '<div aria-level={null} />'
,
code: '<div aria-level={undefined} />'
,
# NUMBER
code: '<div aria-valuemax={123} />'
,
code: '<div aria-valuemax={-123} />'
,
code: '<div aria-valuemax={+123} />'
,
code: '<div aria-valuemax={~123} />'
,
code: '<div aria-valuemax={"123"} />'
,
code: '<div aria-valuemax={"123"} />'
,
code: '<div aria-valuemax="123" />'
,
code: '<div aria-valuemax={foo} />'
,
code: '<div aria-valuemax={foo.bar} />'
,
code: '<div aria-valuemax={null} />'
,
code: '<div aria-valuemax={undefined} />'
,
# TOKEN
code: '<div aria-sort="ascending" />'
,
code: '<div aria-sort="ASCENDING" />'
,
code: '<div aria-sort={"ascending"} />'
,
code: '<div aria-sort={"ascending"} />'
,
code: '<div aria-sort="descending" />'
,
code: '<div aria-sort={"descending"} />'
,
code: '<div aria-sort={"descending"} />'
,
code: '<div aria-sort="none" />'
,
code: '<div aria-sort={"none"} />'
,
code: '<div aria-sort={"none"} />'
,
code: '<div aria-sort="other" />'
,
code: '<div aria-sort={"other"} />'
,
code: '<div aria-sort={"other"} />'
,
code: '<div aria-sort={foo} />'
,
code: '<div aria-sort={foo.bar} />'
,
code: '<div aria-invalid={true} />'
,
code: '<div aria-invalid="true" />'
,
code: '<div aria-invalid={false} />'
,
code: '<div aria-invalid="false" />'
,
code: '<div aria-invalid="grammar" />'
,
code: '<div aria-invalid="spelling" />'
,
code: '<div aria-invalid={null} />'
,
code: '<div aria-invalid={undefined} />'
,
# TOKENLIST
code: '<div aria-relevant="additions" />'
,
code: '<div aria-relevant={"additions"} />'
,
code: '<div aria-relevant={"additions"} />'
,
code: '<div aria-relevant="additions removals" />'
,
code: '<div aria-relevant="additions additions" />'
,
code: '<div aria-relevant={"additions removals"} />'
,
code: '<div aria-relevant={"additions removals"} />'
,
code: '<div aria-relevant="additions removals text" />'
,
code: '<div aria-relevant={"additions removals text"} />'
,
code: '<div aria-relevant={"additions removals text"} />'
,
code: '<div aria-relevant="additions removals text all" />'
,
code: '<div aria-relevant={"additions removals text all"} />'
,
code: '<div aria-relevant={"removals additions text all"} />'
,
code: '<div aria-relevant={foo} />'
,
code: '<div aria-relevant={foo.bar} />'
,
code: '<div aria-relevant={null} />'
,
code: '<div aria-relevant={undefined} />'
,
# ID
code: '<div aria-activedescendant="ascending" />'
,
code: '<div aria-activedescendant="ASCENDING" />'
,
code: '<div aria-activedescendant={"ascending"} />'
,
code: '<div aria-activedescendant={"ascending"} />'
,
code: '<div aria-activedescendant="descending" />'
,
code: '<div aria-activedescendant={"descending"} />'
,
code: '<div aria-activedescendant={"descending"} />'
,
code: '<div aria-activedescendant="none" />'
,
code: '<div aria-activedescendant={"none"} />'
,
code: '<div aria-activedescendant={"none"} />'
,
code: '<div aria-activedescendant="other" />'
,
code: '<div aria-activedescendant={"other"} />'
,
code: '<div aria-activedescendant={"other"} />'
,
code: '<div aria-activedescendant={foo} />'
,
code: '<div aria-activedescendant={foo.bar} />'
,
code: '<div aria-activedescendant={null} />'
,
code: '<div aria-activedescendant={undefined} />'
,
# IDLIST
code: '<div aria-labelledby="additions" />'
,
code: '<div aria-labelledby={"additions"} />'
,
code: '<div aria-labelledby={"additions"} />'
,
code: '<div aria-labelledby="additions removals" />'
,
code: '<div aria-labelledby="additions additions" />'
,
code: '<div aria-labelledby={"additions removals"} />'
,
code: '<div aria-labelledby={"additions removals"} />'
,
code: '<div aria-labelledby="additions removals text" />'
,
code: '<div aria-labelledby={"additions removals text"} />'
,
code: '<div aria-labelledby={"additions removals text"} />'
,
code: '<div aria-labelledby="additions removals text all" />'
,
code: '<div aria-labelledby={"additions removals text all"} />'
,
code: '<div aria-labelledby={"removals additions text all"} />'
,
code: '<div aria-labelledby={foo} />'
,
code: '<div aria-labelledby={foo.bar} />'
,
code: '<div aria-labelledby={null} />'
,
code: '<div aria-labelledby={undefined} />'
].map parserOptionsMapper
invalid: [
# BOOLEAN
code: '<div aria-hidden="yes" />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden="no" />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden={1234} />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden={"#{abc}"} />'
errors: [errorMessage 'aria-hidden']
,
# STRING
code: '<div aria-label />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={true} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={false} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={1234} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={!true} />', errors: [errorMessage 'aria-label']
,
# TRISTATE
code: '<div aria-checked="yes" />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked="no" />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked={1234} />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked={"#{abc}"} />'
errors: [errorMessage 'aria-checked']
,
# INTEGER
code: '<div aria-level="yes" />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level="no" />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={"abc"} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={true} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={"false"} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={!"false"} />', errors: [errorMessage 'aria-level']
,
# NUMBER
code: '<div aria-valuemax="yes" />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax="no" />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={"abc"} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={true} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={"false"} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={!"false"} />'
errors: [errorMessage 'aria-valuemax']
,
# TOKEN
code: '<div aria-sort="" />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort="descnding" />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort={true} />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort={"false"} />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort="ascending descending" />'
errors: [errorMessage 'aria-sort']
,
# TOKENLIST
code: '<div aria-relevant="" />', errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="foobar" />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant />', errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant={true} />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant={"false"} />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="additions removalss" />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="additions removalss " />'
errors: [errorMessage 'aria-relevant']
].map parserOptionsMapper
| true | ### eslint-env jest ###
###*
# @fileoverview Enforce ARIA state and property values are valid.
# @author PI:NAME:<NAME>END_PI
###
# -----------------------------------------------------------------------------
# Requirements
# -----------------------------------------------------------------------------
path = require 'path'
assert = require 'assert'
{aria} = require 'aria-query'
{RuleTester} = require 'eslint'
{
default: parserOptionsMapper
} = require '../eslint-plugin-jsx-a11y-parser-options-mapper'
rule = require 'eslint-plugin-jsx-a11y/lib/rules/aria-proptypes'
{validityCheck} = rule
# -----------------------------------------------------------------------------
# Tests
# -----------------------------------------------------------------------------
ruleTester = new RuleTester parser: path.join __dirname, '../../..'
errorMessage = (name) ->
{type, values: permittedValues} = aria.get name.toLowerCase()
switch type
when 'tristate'
return "The value for #{name} must be a boolean or the string \"mixed\"."
when 'token'
return "The value for #{name} must be a single token from the following: #{permittedValues}."
when 'tokenlist'
return """
The value for #{name} must be a list of one or more \
tokens from the following: #{permittedValues}.
"""
when 'idlist'
return "The value for #{name} must be a list of strings that represent DOM element IDs (idlist)"
when 'id'
return "The value for #{name} must be a string that represents a DOM element ID"
else
return "The value for #{name} must be a #{type}."
describe 'validityCheck', ->
it 'should false for an unknown expected type', ->
# expect(validityCheck null, null).toBe no
assert.equal validityCheck(null, null), no
### eslint-disable coffee/no-template-curly-in-string ###
ruleTester.run 'aria-proptypes', rule,
valid: [
# DON'T TEST INVALID ARIA-* PROPS
code: '<div aria-foo="true" />'
,
code: '<div abcaria-foo="true" />'
,
# BOOLEAN
code: '<div aria-hidden={true} />'
,
code: '<div aria-hidden="true" />'
,
code: '<div aria-hidden={"false"} />'
,
code: '<div aria-hidden={!false} />'
,
code: '<div aria-hidden />'
,
code: '<div aria-hidden={false} />'
,
code: '<div aria-hidden={!true} />'
,
code: '<div aria-hidden={!"yes"} />'
,
code: '<div aria-hidden={foo} />'
,
code: '<div aria-hidden={foo.bar} />'
,
code: '<div aria-hidden={null} />'
,
code: '<div aria-hidden={undefined} />'
,
code: '<div aria-hidden={<div />} />'
,
# STRING
code: '<div aria-label="Close" />'
,
code: '<div aria-label={"Close"} />'
,
code: '<div aria-label={foo} />'
,
code: '<div aria-label={foo.bar} />'
,
code: '<div aria-label={null} />'
,
code: '<div aria-label={undefined} />'
,
code: '<input aria-invalid={error ? "true" : "false"} />'
,
code: '<input aria-invalid={undefined ? "true" : "false"} />'
,
# TRISTATE
code: '<div aria-checked={true} />'
,
code: '<div aria-checked="true" />'
,
code: '<div aria-checked={"false"} />'
,
code: '<div aria-checked={!false} />'
,
code: '<div aria-checked />'
,
code: '<div aria-checked={false} />'
,
code: '<div aria-checked={!true} />'
,
code: '<div aria-checked={!"yes"} />'
,
code: '<div aria-checked={foo} />'
,
code: '<div aria-checked={foo.bar} />'
,
code: '<div aria-checked="mixed" />'
,
code: '<div aria-checked={"mixed"} />'
,
code: '<div aria-checked={null} />'
,
code: '<div aria-checked={undefined} />'
,
# INTEGER
code: '<div aria-level={123} />'
,
code: '<div aria-level={-123} />'
,
code: '<div aria-level={+123} />'
,
code: '<div aria-level={~123} />'
,
code: '<div aria-level={"123"} />'
,
code: '<div aria-level={"123"} />'
,
code: '<div aria-level="123" />'
,
code: '<div aria-level={foo} />'
,
code: '<div aria-level={foo.bar} />'
,
code: '<div aria-level={null} />'
,
code: '<div aria-level={undefined} />'
,
# NUMBER
code: '<div aria-valuemax={123} />'
,
code: '<div aria-valuemax={-123} />'
,
code: '<div aria-valuemax={+123} />'
,
code: '<div aria-valuemax={~123} />'
,
code: '<div aria-valuemax={"123"} />'
,
code: '<div aria-valuemax={"123"} />'
,
code: '<div aria-valuemax="123" />'
,
code: '<div aria-valuemax={foo} />'
,
code: '<div aria-valuemax={foo.bar} />'
,
code: '<div aria-valuemax={null} />'
,
code: '<div aria-valuemax={undefined} />'
,
# TOKEN
code: '<div aria-sort="ascending" />'
,
code: '<div aria-sort="ASCENDING" />'
,
code: '<div aria-sort={"ascending"} />'
,
code: '<div aria-sort={"ascending"} />'
,
code: '<div aria-sort="descending" />'
,
code: '<div aria-sort={"descending"} />'
,
code: '<div aria-sort={"descending"} />'
,
code: '<div aria-sort="none" />'
,
code: '<div aria-sort={"none"} />'
,
code: '<div aria-sort={"none"} />'
,
code: '<div aria-sort="other" />'
,
code: '<div aria-sort={"other"} />'
,
code: '<div aria-sort={"other"} />'
,
code: '<div aria-sort={foo} />'
,
code: '<div aria-sort={foo.bar} />'
,
code: '<div aria-invalid={true} />'
,
code: '<div aria-invalid="true" />'
,
code: '<div aria-invalid={false} />'
,
code: '<div aria-invalid="false" />'
,
code: '<div aria-invalid="grammar" />'
,
code: '<div aria-invalid="spelling" />'
,
code: '<div aria-invalid={null} />'
,
code: '<div aria-invalid={undefined} />'
,
# TOKENLIST
code: '<div aria-relevant="additions" />'
,
code: '<div aria-relevant={"additions"} />'
,
code: '<div aria-relevant={"additions"} />'
,
code: '<div aria-relevant="additions removals" />'
,
code: '<div aria-relevant="additions additions" />'
,
code: '<div aria-relevant={"additions removals"} />'
,
code: '<div aria-relevant={"additions removals"} />'
,
code: '<div aria-relevant="additions removals text" />'
,
code: '<div aria-relevant={"additions removals text"} />'
,
code: '<div aria-relevant={"additions removals text"} />'
,
code: '<div aria-relevant="additions removals text all" />'
,
code: '<div aria-relevant={"additions removals text all"} />'
,
code: '<div aria-relevant={"removals additions text all"} />'
,
code: '<div aria-relevant={foo} />'
,
code: '<div aria-relevant={foo.bar} />'
,
code: '<div aria-relevant={null} />'
,
code: '<div aria-relevant={undefined} />'
,
# ID
code: '<div aria-activedescendant="ascending" />'
,
code: '<div aria-activedescendant="ASCENDING" />'
,
code: '<div aria-activedescendant={"ascending"} />'
,
code: '<div aria-activedescendant={"ascending"} />'
,
code: '<div aria-activedescendant="descending" />'
,
code: '<div aria-activedescendant={"descending"} />'
,
code: '<div aria-activedescendant={"descending"} />'
,
code: '<div aria-activedescendant="none" />'
,
code: '<div aria-activedescendant={"none"} />'
,
code: '<div aria-activedescendant={"none"} />'
,
code: '<div aria-activedescendant="other" />'
,
code: '<div aria-activedescendant={"other"} />'
,
code: '<div aria-activedescendant={"other"} />'
,
code: '<div aria-activedescendant={foo} />'
,
code: '<div aria-activedescendant={foo.bar} />'
,
code: '<div aria-activedescendant={null} />'
,
code: '<div aria-activedescendant={undefined} />'
,
# IDLIST
code: '<div aria-labelledby="additions" />'
,
code: '<div aria-labelledby={"additions"} />'
,
code: '<div aria-labelledby={"additions"} />'
,
code: '<div aria-labelledby="additions removals" />'
,
code: '<div aria-labelledby="additions additions" />'
,
code: '<div aria-labelledby={"additions removals"} />'
,
code: '<div aria-labelledby={"additions removals"} />'
,
code: '<div aria-labelledby="additions removals text" />'
,
code: '<div aria-labelledby={"additions removals text"} />'
,
code: '<div aria-labelledby={"additions removals text"} />'
,
code: '<div aria-labelledby="additions removals text all" />'
,
code: '<div aria-labelledby={"additions removals text all"} />'
,
code: '<div aria-labelledby={"removals additions text all"} />'
,
code: '<div aria-labelledby={foo} />'
,
code: '<div aria-labelledby={foo.bar} />'
,
code: '<div aria-labelledby={null} />'
,
code: '<div aria-labelledby={undefined} />'
].map parserOptionsMapper
invalid: [
# BOOLEAN
code: '<div aria-hidden="yes" />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden="no" />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden={1234} />', errors: [errorMessage 'aria-hidden']
,
code: '<div aria-hidden={"#{abc}"} />'
errors: [errorMessage 'aria-hidden']
,
# STRING
code: '<div aria-label />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={true} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={false} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={1234} />', errors: [errorMessage 'aria-label']
,
code: '<div aria-label={!true} />', errors: [errorMessage 'aria-label']
,
# TRISTATE
code: '<div aria-checked="yes" />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked="no" />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked={1234} />', errors: [errorMessage 'aria-checked']
,
code: '<div aria-checked={"#{abc}"} />'
errors: [errorMessage 'aria-checked']
,
# INTEGER
code: '<div aria-level="yes" />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level="no" />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={"abc"} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={true} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={"false"} />', errors: [errorMessage 'aria-level']
,
code: '<div aria-level={!"false"} />', errors: [errorMessage 'aria-level']
,
# NUMBER
code: '<div aria-valuemax="yes" />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax="no" />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={"abc"} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={true} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax />', errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={"false"} />'
errors: [errorMessage 'aria-valuemax']
,
code: '<div aria-valuemax={!"false"} />'
errors: [errorMessage 'aria-valuemax']
,
# TOKEN
code: '<div aria-sort="" />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort="descnding" />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort={true} />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort={"false"} />', errors: [errorMessage 'aria-sort']
,
code: '<div aria-sort="ascending descending" />'
errors: [errorMessage 'aria-sort']
,
# TOKENLIST
code: '<div aria-relevant="" />', errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="foobar" />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant />', errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant={true} />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant={"false"} />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="additions removalss" />'
errors: [errorMessage 'aria-relevant']
,
code: '<div aria-relevant="additions removalss " />'
errors: [errorMessage 'aria-relevant']
].map parserOptionsMapper
|
[
{
"context": "cation _.extend {}, @props,\n key: \"navbar-notification-#{notification._id}\"\n notification: n",
"end": 2443,
"score": 0.9689007997512817,
"start": 2421,
"tag": "KEY",
"value": "navbar-notification-#{"
},
{
"context": " key: \"na... | src/components/navbar.coffee | EmmanuelCuillier/kerplunk-notifications-master | 0 | _ = require 'lodash'
React = require 'react'
Notification = require './notification'
{DOM} = React
diffArrays = (arr1 = [], arr2 = []) ->
return false if arr1.length != arr2.length
for item, index in arr1
if arr1[index] != arr2[index]
return false
true
module.exports = React.createFactory React.createClass
getInitialState: ->
expanded: false
componentDidMount: ->
@socket = @props.getSocket 'kerplunk'
@markRead()
componentDidUpdate: (prevProps, prevState) ->
changed = false
# console.log 'nav did update',
# prevProps.currentUrl
# @props.currentUrl
# prevProps.notifications?.length ? 0
# @props.notifications?.length ? 0
if prevProps.currentUrl != @props.currentUrl
changed = true
@setState
expanded: false
else
prevIds = _.map (prevProps.notifications ? []), '_id'
newIds = _.map (@props.notifications ? []), '_id'
if !diffArrays prevIds, newIds
changed = true
if changed
@markRead()
markRead: (url = @props.currentUrl) ->
return unless url?.length > 0
return unless @props.notifications?.length > 0
for notification in @props.notifications
for navUrl in notification?.navUrls
if navUrl == url
@socket?.write
currentUrl: url
return
toggle: (e) ->
e.preventDefault()
@setState
expanded: !@state.expanded
goToNotifications: (e) ->
@setState
expanded: false
@props.pushState e
render: ->
notifications = @props.notifications ? []
total = notifications.length
classes = ['dropdown-menu']
if @state.expanded
classes.push 'show'
DOM.li
className: 'dropdown notifications-menu'
,
DOM.a
href: '#'
className: 'dropdown-toggle'
onClick: @toggle
,
DOM.em className: 'fa fa-warning'
DOM.span
className: 'label label-warning notifications-count-nozero'
,
if total > 0 then total else ''
DOM.ul
className: classes.join ' '
,
DOM.li
className: 'header'
,
"You have #{total} notification#{if total == 1 then '' else 's'}"
DOM.li null,
DOM.ul
className: 'menu'
,
_.map notifications, (notification) =>
Notification _.extend {}, @props,
key: "navbar-notification-#{notification._id}"
notification: notification
DOM.li
className: 'footer'
,
DOM.a
onClick: @goToNotifications
href: '/admin/notifications'
, 'View all'
| 156382 | _ = require 'lodash'
React = require 'react'
Notification = require './notification'
{DOM} = React
diffArrays = (arr1 = [], arr2 = []) ->
return false if arr1.length != arr2.length
for item, index in arr1
if arr1[index] != arr2[index]
return false
true
module.exports = React.createFactory React.createClass
getInitialState: ->
expanded: false
componentDidMount: ->
@socket = @props.getSocket 'kerplunk'
@markRead()
componentDidUpdate: (prevProps, prevState) ->
changed = false
# console.log 'nav did update',
# prevProps.currentUrl
# @props.currentUrl
# prevProps.notifications?.length ? 0
# @props.notifications?.length ? 0
if prevProps.currentUrl != @props.currentUrl
changed = true
@setState
expanded: false
else
prevIds = _.map (prevProps.notifications ? []), '_id'
newIds = _.map (@props.notifications ? []), '_id'
if !diffArrays prevIds, newIds
changed = true
if changed
@markRead()
markRead: (url = @props.currentUrl) ->
return unless url?.length > 0
return unless @props.notifications?.length > 0
for notification in @props.notifications
for navUrl in notification?.navUrls
if navUrl == url
@socket?.write
currentUrl: url
return
toggle: (e) ->
e.preventDefault()
@setState
expanded: !@state.expanded
goToNotifications: (e) ->
@setState
expanded: false
@props.pushState e
render: ->
notifications = @props.notifications ? []
total = notifications.length
classes = ['dropdown-menu']
if @state.expanded
classes.push 'show'
DOM.li
className: 'dropdown notifications-menu'
,
DOM.a
href: '#'
className: 'dropdown-toggle'
onClick: @toggle
,
DOM.em className: 'fa fa-warning'
DOM.span
className: 'label label-warning notifications-count-nozero'
,
if total > 0 then total else ''
DOM.ul
className: classes.join ' '
,
DOM.li
className: 'header'
,
"You have #{total} notification#{if total == 1 then '' else 's'}"
DOM.li null,
DOM.ul
className: 'menu'
,
_.map notifications, (notification) =>
Notification _.extend {}, @props,
key: "<KEY>notification._<KEY>}"
notification: notification
DOM.li
className: 'footer'
,
DOM.a
onClick: @goToNotifications
href: '/admin/notifications'
, 'View all'
| true | _ = require 'lodash'
React = require 'react'
Notification = require './notification'
{DOM} = React
diffArrays = (arr1 = [], arr2 = []) ->
return false if arr1.length != arr2.length
for item, index in arr1
if arr1[index] != arr2[index]
return false
true
module.exports = React.createFactory React.createClass
getInitialState: ->
expanded: false
componentDidMount: ->
@socket = @props.getSocket 'kerplunk'
@markRead()
componentDidUpdate: (prevProps, prevState) ->
changed = false
# console.log 'nav did update',
# prevProps.currentUrl
# @props.currentUrl
# prevProps.notifications?.length ? 0
# @props.notifications?.length ? 0
if prevProps.currentUrl != @props.currentUrl
changed = true
@setState
expanded: false
else
prevIds = _.map (prevProps.notifications ? []), '_id'
newIds = _.map (@props.notifications ? []), '_id'
if !diffArrays prevIds, newIds
changed = true
if changed
@markRead()
markRead: (url = @props.currentUrl) ->
return unless url?.length > 0
return unless @props.notifications?.length > 0
for notification in @props.notifications
for navUrl in notification?.navUrls
if navUrl == url
@socket?.write
currentUrl: url
return
toggle: (e) ->
e.preventDefault()
@setState
expanded: !@state.expanded
goToNotifications: (e) ->
@setState
expanded: false
@props.pushState e
render: ->
notifications = @props.notifications ? []
total = notifications.length
classes = ['dropdown-menu']
if @state.expanded
classes.push 'show'
DOM.li
className: 'dropdown notifications-menu'
,
DOM.a
href: '#'
className: 'dropdown-toggle'
onClick: @toggle
,
DOM.em className: 'fa fa-warning'
DOM.span
className: 'label label-warning notifications-count-nozero'
,
if total > 0 then total else ''
DOM.ul
className: classes.join ' '
,
DOM.li
className: 'header'
,
"You have #{total} notification#{if total == 1 then '' else 's'}"
DOM.li null,
DOM.ul
className: 'menu'
,
_.map notifications, (notification) =>
Notification _.extend {}, @props,
key: "PI:KEY:<KEY>END_PInotification._PI:KEY:<KEY>END_PI}"
notification: notification
DOM.li
className: 'footer'
,
DOM.a
onClick: @goToNotifications
href: '/admin/notifications'
, 'View all'
|
[
{
"context": "ackUrl: 'whatevs.co'})\n @sut.authenticate 'sliced@diced.net', 'one-easy-payment', 'laptop.com'\n @rootS",
"end": 630,
"score": 0.9999251365661621,
"start": 614,
"tag": "EMAIL",
"value": "sliced@diced.net"
},
{
"context": ".com/sessions'\n params =\... | test/app/authenticator-service-spec.coffee | octoblu/email-password-site | 1 | describe 'AuthenticatorService', ->
beforeEach ->
module 'email-password', ($provide) =>
@http = post: sinon.stub()
$provide.value '$http', @http
$provide.constant 'AUTHENTICATOR_URI', 'https://email-password.octoblu.com'
return
inject ($q, $rootScope, AuthenticatorService) =>
@q = $q
@rootScope = $rootScope
@sut = AuthenticatorService
describe '->authenticate', ->
describe 'when called with a email, password, and a callbackUrl', ->
beforeEach ->
@http.post.returns @q.when(data: {callbackUrl: 'whatevs.co'})
@sut.authenticate 'sliced@diced.net', 'one-easy-payment', 'laptop.com'
@rootScope.$digest()
it 'should call POST /sessions', ->
url = 'https://email-password.octoblu.com/sessions'
params =
email: 'sliced@diced.net'
password: 'one-easy-payment'
callbackUrl: 'laptop.com'
expect(@http.post).to.have.been.calledWith url, params
describe 'when called and meshblu rejects the email & password', ->
beforeEach (done) ->
@http.post.returns @q.reject(data: 'Bad email & password')
@sut.authenticate 'sliced@diced.net', 'one-easy-payment', 'laptop.com'
.catch (@error) => done()
@rootScope.$digest()
it 'should reject the authenticate promise', ->
expect(@error).to.equal 'Bad email & password'
describe 'when called and meshblu resolves with the location', ->
beforeEach (done) ->
@http.post.returns @q.when(data: {callbackUrl: 'google.com?some-other=stuff'})
@sut.authenticate 'sliced@diced.net', 'one-easy-payment', 'google.com'
.then (@result) => done()
@rootScope.$digest()
it 'should return the Location url', ->
expect(@result).to.deep.equal 'google.com?some-other=stuff'
describe '->register', ->
describe 'when called', ->
beforeEach ->
@http.post.returns @q.when(data: {callbackUrl: 'something.biz'})
@sut.register 'taft@president.org', 'bathtub', 'underwater.dive'
@rootScope.$digest()
it 'should post to signup.octoblu.com with the email and password', ->
url = 'https://email-password.octoblu.com/devices'
params =
email: 'taft@president.org'
password: 'bathtub'
callbackUrl: 'underwater.dive'
expect(@http.post).to.have.been.calledWith url, params
describe 'when called and the service rejects', ->
beforeEach (done) ->
@http.post.returns @q.reject({data: 'you done screwed up'})
@sut.register 'complicated', 'dolphin', 'rockslide.gz'
.catch (@errorMessage) => done()
@rootScope.$digest()
it 'should reject the promise and return the error', ->
expect(@errorMessage).to.equal 'you done screwed up'
describe 'when called and the service resolves', ->
beforeEach (done) ->
@http.post.returns @q.when(data: {callbackUrl: 'die.cool'})
@sut.register 'crippling', 'insecurity', 'sucked-out'
.then (@result) => done()
@rootScope.$digest()
it 'should reject the promise and return the error', ->
expect(@result).to.equal 'die.cool'
describe '->forgotPassword', ->
describe 'when called with an email', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'hello' )
@sut.forgotPassword('peter@improved-bacon.com').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/forgot', ->
url = 'https://email-password.octoblu.com/forgot'
params =
email: 'peter@improved-bacon.com'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'hello'
describe 'when called with an email and http resolves a different result', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'goodbye!' )
@sut.forgotPassword('peter@improved-bacon.com').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/forgot', ->
url = 'https://email-password.octoblu.com/forgot'
params =
email: 'peter@improved-bacon.com'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'goodbye!'
describe '->resetPassword', ->
describe 'when called with an email', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'hello' )
@sut.resetPassword('death-from-above', 'attack', 'vantage-point').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/reset', ->
url = 'https://email-password.octoblu.com/reset'
params =
device: 'death-from-above'
token: 'attack'
password: 'vantage-point'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'hello'
describe 'when called with an email and http resolves a different result', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'goodbye!' )
@sut.resetPassword('shriek attack', 'startle', 'any person').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/reset', ->
url = 'https://email-password.octoblu.com/reset'
params =
device: 'shriek attack'
token: 'startle'
password: 'any person'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'goodbye!'
| 135429 | describe 'AuthenticatorService', ->
beforeEach ->
module 'email-password', ($provide) =>
@http = post: sinon.stub()
$provide.value '$http', @http
$provide.constant 'AUTHENTICATOR_URI', 'https://email-password.octoblu.com'
return
inject ($q, $rootScope, AuthenticatorService) =>
@q = $q
@rootScope = $rootScope
@sut = AuthenticatorService
describe '->authenticate', ->
describe 'when called with a email, password, and a callbackUrl', ->
beforeEach ->
@http.post.returns @q.when(data: {callbackUrl: 'whatevs.co'})
@sut.authenticate '<EMAIL>', 'one-easy-payment', 'laptop.com'
@rootScope.$digest()
it 'should call POST /sessions', ->
url = 'https://email-password.octoblu.com/sessions'
params =
email: '<EMAIL>'
password: '<PASSWORD>'
callbackUrl: 'laptop.com'
expect(@http.post).to.have.been.calledWith url, params
describe 'when called and meshblu rejects the email & password', ->
beforeEach (done) ->
@http.post.returns @q.reject(data: 'Bad email & password')
@sut.authenticate '<EMAIL>', 'one-easy-payment', 'laptop.com'
.catch (@error) => done()
@rootScope.$digest()
it 'should reject the authenticate promise', ->
expect(@error).to.equal 'Bad email & password'
describe 'when called and meshblu resolves with the location', ->
beforeEach (done) ->
@http.post.returns @q.when(data: {callbackUrl: 'google.com?some-other=stuff'})
@sut.authenticate '<EMAIL>', 'one-easy-payment', 'google.com'
.then (@result) => done()
@rootScope.$digest()
it 'should return the Location url', ->
expect(@result).to.deep.equal 'google.com?some-other=stuff'
describe '->register', ->
describe 'when called', ->
beforeEach ->
@http.post.returns @q.when(data: {callbackUrl: 'something.biz'})
@sut.register '<EMAIL>', 'bathtub', 'underwater.dive'
@rootScope.$digest()
it 'should post to signup.octoblu.com with the email and password', ->
url = 'https://email-password.octoblu.com/devices'
params =
email: '<EMAIL>'
password: '<PASSWORD>'
callbackUrl: 'underwater.dive'
expect(@http.post).to.have.been.calledWith url, params
describe 'when called and the service rejects', ->
beforeEach (done) ->
@http.post.returns @q.reject({data: 'you done screwed up'})
@sut.register 'complicated', 'dolphin', 'rockslide.gz'
.catch (@errorMessage) => done()
@rootScope.$digest()
it 'should reject the promise and return the error', ->
expect(@errorMessage).to.equal 'you done screwed up'
describe 'when called and the service resolves', ->
beforeEach (done) ->
@http.post.returns @q.when(data: {callbackUrl: 'die.cool'})
@sut.register 'crippling', 'insecurity', 'sucked-out'
.then (@result) => done()
@rootScope.$digest()
it 'should reject the promise and return the error', ->
expect(@result).to.equal 'die.cool'
describe '->forgotPassword', ->
describe 'when called with an email', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'hello' )
@sut.forgotPassword('<EMAIL>').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/forgot', ->
url = 'https://email-password.octoblu.com/forgot'
params =
email: '<EMAIL>'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'hello'
describe 'when called with an email and http resolves a different result', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'goodbye!' )
@sut.forgotPassword('<EMAIL>').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/forgot', ->
url = 'https://email-password.octoblu.com/forgot'
params =
email: '<EMAIL>'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'goodbye!'
describe '->resetPassword', ->
describe 'when called with an email', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'hello' )
@sut.resetPassword('death-<PASSWORD>', 'attack', 'v<PASSWORD>').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/reset', ->
url = 'https://email-password.octoblu.com/reset'
params =
device: 'death-from-above'
token: '<PASSWORD>'
password: '<PASSWORD>'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'hello'
describe 'when called with an email and http resolves a different result', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'goodbye!' )
@sut.resetPassword('<PASSWORD>', 'startle', '<PASSWORD>').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/reset', ->
url = 'https://email-password.octoblu.com/reset'
params =
device: 'shriek attack'
token: '<PASSWORD>'
password: '<PASSWORD>'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'goodbye!'
| true | describe 'AuthenticatorService', ->
beforeEach ->
module 'email-password', ($provide) =>
@http = post: sinon.stub()
$provide.value '$http', @http
$provide.constant 'AUTHENTICATOR_URI', 'https://email-password.octoblu.com'
return
inject ($q, $rootScope, AuthenticatorService) =>
@q = $q
@rootScope = $rootScope
@sut = AuthenticatorService
describe '->authenticate', ->
describe 'when called with a email, password, and a callbackUrl', ->
beforeEach ->
@http.post.returns @q.when(data: {callbackUrl: 'whatevs.co'})
@sut.authenticate 'PI:EMAIL:<EMAIL>END_PI', 'one-easy-payment', 'laptop.com'
@rootScope.$digest()
it 'should call POST /sessions', ->
url = 'https://email-password.octoblu.com/sessions'
params =
email: 'PI:EMAIL:<EMAIL>END_PI'
password: 'PI:PASSWORD:<PASSWORD>END_PI'
callbackUrl: 'laptop.com'
expect(@http.post).to.have.been.calledWith url, params
describe 'when called and meshblu rejects the email & password', ->
beforeEach (done) ->
@http.post.returns @q.reject(data: 'Bad email & password')
@sut.authenticate 'PI:EMAIL:<EMAIL>END_PI', 'one-easy-payment', 'laptop.com'
.catch (@error) => done()
@rootScope.$digest()
it 'should reject the authenticate promise', ->
expect(@error).to.equal 'Bad email & password'
describe 'when called and meshblu resolves with the location', ->
beforeEach (done) ->
@http.post.returns @q.when(data: {callbackUrl: 'google.com?some-other=stuff'})
@sut.authenticate 'PI:EMAIL:<EMAIL>END_PI', 'one-easy-payment', 'google.com'
.then (@result) => done()
@rootScope.$digest()
it 'should return the Location url', ->
expect(@result).to.deep.equal 'google.com?some-other=stuff'
describe '->register', ->
describe 'when called', ->
beforeEach ->
@http.post.returns @q.when(data: {callbackUrl: 'something.biz'})
@sut.register 'PI:EMAIL:<EMAIL>END_PI', 'bathtub', 'underwater.dive'
@rootScope.$digest()
it 'should post to signup.octoblu.com with the email and password', ->
url = 'https://email-password.octoblu.com/devices'
params =
email: 'PI:EMAIL:<EMAIL>END_PI'
password: 'PI:PASSWORD:<PASSWORD>END_PI'
callbackUrl: 'underwater.dive'
expect(@http.post).to.have.been.calledWith url, params
describe 'when called and the service rejects', ->
beforeEach (done) ->
@http.post.returns @q.reject({data: 'you done screwed up'})
@sut.register 'complicated', 'dolphin', 'rockslide.gz'
.catch (@errorMessage) => done()
@rootScope.$digest()
it 'should reject the promise and return the error', ->
expect(@errorMessage).to.equal 'you done screwed up'
describe 'when called and the service resolves', ->
beforeEach (done) ->
@http.post.returns @q.when(data: {callbackUrl: 'die.cool'})
@sut.register 'crippling', 'insecurity', 'sucked-out'
.then (@result) => done()
@rootScope.$digest()
it 'should reject the promise and return the error', ->
expect(@result).to.equal 'die.cool'
describe '->forgotPassword', ->
describe 'when called with an email', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'hello' )
@sut.forgotPassword('PI:EMAIL:<EMAIL>END_PI').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/forgot', ->
url = 'https://email-password.octoblu.com/forgot'
params =
email: 'PI:EMAIL:<EMAIL>END_PI'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'hello'
describe 'when called with an email and http resolves a different result', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'goodbye!' )
@sut.forgotPassword('PI:EMAIL:<EMAIL>END_PI').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/forgot', ->
url = 'https://email-password.octoblu.com/forgot'
params =
email: 'PI:EMAIL:<EMAIL>END_PI'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'goodbye!'
describe '->resetPassword', ->
describe 'when called with an email', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'hello' )
@sut.resetPassword('death-PI:PASSWORD:<PASSWORD>END_PI', 'attack', 'vPI:PASSWORD:<PASSWORD>END_PI').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/reset', ->
url = 'https://email-password.octoblu.com/reset'
params =
device: 'death-from-above'
token: 'PI:PASSWORD:<PASSWORD>END_PI'
password: 'PI:PASSWORD:<PASSWORD>END_PI'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'hello'
describe 'when called with an email and http resolves a different result', ->
beforeEach (done) ->
@http.post.returns @q.when( data: 'goodbye!' )
@sut.resetPassword('PI:PASSWORD:<PASSWORD>END_PI', 'startle', 'PI:PASSWORD:<PASSWORD>END_PI').then (@response) => done()
@rootScope.$digest()
it 'should post to http with a request to email-password.octoblu.com/reset', ->
url = 'https://email-password.octoblu.com/reset'
params =
device: 'shriek attack'
token: 'PI:PASSWORD:<PASSWORD>END_PI'
password: 'PI:PASSWORD:<PASSWORD>END_PI'
expect(@http.post).to.have.been.calledWith url, params
it 'should resolve the data', ->
expect(@response).to.equal 'goodbye!'
|
[
{
"context": "html ->\n\thead ->\n\t\tmeta charset: 'utf-8'\n\t\ttitle \"Jeffreel | #{@broadcasterData.username}\"\n\n\t\tstyle '''\n ",
"end": 68,
"score": 0.999046802520752,
"start": 60,
"tag": "NAME",
"value": "Jeffreel"
},
{
"context": "oken, contact: \"\n\t\t\t\ta href: \"htt... | jeffreel/views/index.coffee | MrBobBarker/jefflr | 0 | doctype 5
html ->
head ->
meta charset: 'utf-8'
title "Jeffreel | #{@broadcasterData.username}"
style '''
body {background-color: #1E262C; font-size: 12px; font-family: Tahoma, Verdana, Arial, sans-serif}
footer {text-align: center}
p {color: #E0A666; margin: 0px}
a {color: #D18026; text-decoration: none}
h1 {font-size: 48px; text-align: center; color: #E0A666}
#button {width: 600px; margin: 0 auto}
#broadcast {transition: all .3s ease; background-color: #34414C; width: 600px; margin-bottom: 10px; padding: 0 0 18px 4px}
#broadcast:hover {background-color: #536779}
#title {font-size: 22px; margin-bottom: 0px}
#date {display: inline-box; float: left}
#duration {display: inline-box; float: right; padding: 0 4px 0 0}
#footer {color: #E0A666}
'''
body ->
h1 "Mixlr Archives"
for broadcast in @broadcasts
div id: 'button', -> a href: broadcast.streams.http.url, ->
div id: 'broadcast', ->
div id: 'title', -> broadcast.title
div id: 'date', -> p "Started: " + broadcast.started_at_local
div id: 'duration', -> p "Duration: " + broadcast.runningtime
footer ->
div id: 'footer', ->
text "Rips are made automatically by a bot. If something is broken, contact: "
a href: "https://twitter.com/mrbobarker", -> "@mrbobarker"
| 185387 | doctype 5
html ->
head ->
meta charset: 'utf-8'
title "<NAME> | #{@broadcasterData.username}"
style '''
body {background-color: #1E262C; font-size: 12px; font-family: Tahoma, Verdana, Arial, sans-serif}
footer {text-align: center}
p {color: #E0A666; margin: 0px}
a {color: #D18026; text-decoration: none}
h1 {font-size: 48px; text-align: center; color: #E0A666}
#button {width: 600px; margin: 0 auto}
#broadcast {transition: all .3s ease; background-color: #34414C; width: 600px; margin-bottom: 10px; padding: 0 0 18px 4px}
#broadcast:hover {background-color: #536779}
#title {font-size: 22px; margin-bottom: 0px}
#date {display: inline-box; float: left}
#duration {display: inline-box; float: right; padding: 0 4px 0 0}
#footer {color: #E0A666}
'''
body ->
h1 "Mixlr Archives"
for broadcast in @broadcasts
div id: 'button', -> a href: broadcast.streams.http.url, ->
div id: 'broadcast', ->
div id: 'title', -> broadcast.title
div id: 'date', -> p "Started: " + broadcast.started_at_local
div id: 'duration', -> p "Duration: " + broadcast.runningtime
footer ->
div id: 'footer', ->
text "Rips are made automatically by a bot. If something is broken, contact: "
a href: "https://twitter.com/mrbobarker", -> "@mrbobarker"
| true | doctype 5
html ->
head ->
meta charset: 'utf-8'
title "PI:NAME:<NAME>END_PI | #{@broadcasterData.username}"
style '''
body {background-color: #1E262C; font-size: 12px; font-family: Tahoma, Verdana, Arial, sans-serif}
footer {text-align: center}
p {color: #E0A666; margin: 0px}
a {color: #D18026; text-decoration: none}
h1 {font-size: 48px; text-align: center; color: #E0A666}
#button {width: 600px; margin: 0 auto}
#broadcast {transition: all .3s ease; background-color: #34414C; width: 600px; margin-bottom: 10px; padding: 0 0 18px 4px}
#broadcast:hover {background-color: #536779}
#title {font-size: 22px; margin-bottom: 0px}
#date {display: inline-box; float: left}
#duration {display: inline-box; float: right; padding: 0 4px 0 0}
#footer {color: #E0A666}
'''
body ->
h1 "Mixlr Archives"
for broadcast in @broadcasts
div id: 'button', -> a href: broadcast.streams.http.url, ->
div id: 'broadcast', ->
div id: 'title', -> broadcast.title
div id: 'date', -> p "Started: " + broadcast.started_at_local
div id: 'duration', -> p "Duration: " + broadcast.runningtime
footer ->
div id: 'footer', ->
text "Rips are made automatically by a bot. If something is broken, contact: "
a href: "https://twitter.com/mrbobarker", -> "@mrbobarker"
|
[
{
"context": "*\n* Handle a mouse or a tactile screen\n*\n* @author David Jegat <david.jegat@gmail.com>\n###\nclass Mouse\n\n ###*\n ",
"end": 65,
"score": 0.9998775124549866,
"start": 54,
"tag": "NAME",
"value": "David Jegat"
},
{
"context": "ouse or a tactile screen\n*\n* @author ... | src/Mouse.coffee | Djeg/MicroRacing | 1 | ###*
* Handle a mouse or a tactile screen
*
* @author David Jegat <david.jegat@gmail.com>
###
class Mouse
###*
* @param {string} selector, the selector where you want to attach the Mouse
* @constructor
###
constructor: (selector) ->
@$ = $ selector
@x = 0
@y = 0
@in = off
@buttons = []
self = @
@$.mousedown (event) -> self.handleClick(event, true)
@$.mouseup (event) -> self.handleClick(event, false)
@$.mouseenter (event) -> self.refreshMouseState(event, true)
@$.mouseleave (event) -> self.refreshMouseState(event, false)
@$.mousemove (event) -> self.handleMovement(event)
###*
* Handle a mouse click
*
* @param {eventObject} event
* @param {boolean} pressing
###
handleClick: (event, pressing) ->
@buttons[event.which] = if pressing then true else false
###*
* Refresh the mouse state
*
* @param {eventObject} event
* @param {boolean} entering
###
refreshMouseState: (event, entering) ->
@in = if entering then true else false
###*
* Handle movement
*
* @param {eventObject} event
###
handleMovement: (event) ->
@x = (event.pageX - @$.offset().left)
@y = (event.pageY - @$.offset().top)
###*
* Test is the mouse is clicking
*
* @param {number} button
* @return boolean
###
isPress: (button) ->
if @buttons[button] then true else false
| 216705 | ###*
* Handle a mouse or a tactile screen
*
* @author <NAME> <<EMAIL>>
###
class Mouse
###*
* @param {string} selector, the selector where you want to attach the Mouse
* @constructor
###
constructor: (selector) ->
@$ = $ selector
@x = 0
@y = 0
@in = off
@buttons = []
self = @
@$.mousedown (event) -> self.handleClick(event, true)
@$.mouseup (event) -> self.handleClick(event, false)
@$.mouseenter (event) -> self.refreshMouseState(event, true)
@$.mouseleave (event) -> self.refreshMouseState(event, false)
@$.mousemove (event) -> self.handleMovement(event)
###*
* Handle a mouse click
*
* @param {eventObject} event
* @param {boolean} pressing
###
handleClick: (event, pressing) ->
@buttons[event.which] = if pressing then true else false
###*
* Refresh the mouse state
*
* @param {eventObject} event
* @param {boolean} entering
###
refreshMouseState: (event, entering) ->
@in = if entering then true else false
###*
* Handle movement
*
* @param {eventObject} event
###
handleMovement: (event) ->
@x = (event.pageX - @$.offset().left)
@y = (event.pageY - @$.offset().top)
###*
* Test is the mouse is clicking
*
* @param {number} button
* @return boolean
###
isPress: (button) ->
if @buttons[button] then true else false
| true | ###*
* Handle a mouse or a tactile screen
*
* @author PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
###
class Mouse
###*
* @param {string} selector, the selector where you want to attach the Mouse
* @constructor
###
constructor: (selector) ->
@$ = $ selector
@x = 0
@y = 0
@in = off
@buttons = []
self = @
@$.mousedown (event) -> self.handleClick(event, true)
@$.mouseup (event) -> self.handleClick(event, false)
@$.mouseenter (event) -> self.refreshMouseState(event, true)
@$.mouseleave (event) -> self.refreshMouseState(event, false)
@$.mousemove (event) -> self.handleMovement(event)
###*
* Handle a mouse click
*
* @param {eventObject} event
* @param {boolean} pressing
###
handleClick: (event, pressing) ->
@buttons[event.which] = if pressing then true else false
###*
* Refresh the mouse state
*
* @param {eventObject} event
* @param {boolean} entering
###
refreshMouseState: (event, entering) ->
@in = if entering then true else false
###*
* Handle movement
*
* @param {eventObject} event
###
handleMovement: (event) ->
@x = (event.pageX - @$.offset().left)
@y = (event.pageY - @$.offset().top)
###*
* Test is the mouse is clicking
*
* @param {number} button
* @return boolean
###
isPress: (button) ->
if @buttons[button] then true else false
|
[
{
"context": "name: 'one-time-device-uuid'\n password: 'one-time-device-token'\n\n request.get options, (error, @response, @",
"end": 2130,
"score": 0.999381422996521,
"start": 2109,
"tag": "PASSWORD",
"value": "one-time-device-token"
}
] | test/integration/box-link-download.coffee | octoblu/box-link-service | 0 | http = require 'http'
request = require 'request'
shmock = require '@octoblu/shmock'
enableDestroy = require 'server-destroy'
MeshbluHttp = require 'meshblu-http'
Server = require '../../src/server'
describe 'Download', ->
before ->
@timeout 20000
meshbluHttp = new MeshbluHttp({})
{@privateKey, publicKey} = meshbluHttp.generateKeyPair()
@privateKeyObj = meshbluHttp.setPrivateKey @privateKey
beforeEach (done) ->
@meshblu = shmock 0xd00d
enableDestroy @meshblu
@box = shmock 0xbabe
enableDestroy @box
serverOptions =
port: undefined,
disableLogging: true
meshbluConfig =
server: 'localhost'
port: 0xd00d
privateKey: @privateKey
@boxServiceUri = "http://localhost:#{0xbabe}"
@server = new Server serverOptions, {meshbluConfig,@boxServiceUri}
@server.run =>
@serverPort = @server.address().port
done()
afterEach ->
@server.destroy()
@meshblu.destroy()
@box.destroy()
describe 'On GET /meshblu/links', ->
beforeEach (done) ->
deviceAuth = new Buffer('one-time-device-uuid:one-time-device-token').toString 'base64'
@getTheDevice = @meshblu
.get '/v2/whoami'
.set 'Authorization', "Basic #{deviceAuth}"
.reply 200,
uuid: 'one-time-device-uuid'
box:
encryptedToken: @privateKeyObj.encrypt 'oh-this-is-my-bearer-token', 'base64'
encryptedFileId: @privateKeyObj.encrypt 'file-id', 'base64'
@shareLink = @box
.put "/files/file-id"
.reply 201,
shared_link:
download_url: "#{@boxServiceUri}/download-link"
@downloadLink = @box
.get "/download-link"
.reply 200, '{"some-data":true}'
@deleteTheDevice = @meshblu
.delete '/devices/one-time-device-uuid'
.set 'Authorization', "Basic #{deviceAuth}"
.reply 200
options =
uri: '/meshblu/links'
baseUrl: "http://localhost:#{@serverPort}"
auth:
username: 'one-time-device-uuid'
password: 'one-time-device-token'
request.get options, (error, @response, @body) =>
done error
it 'should get the device', ->
@getTheDevice.done()
it 'should share the link', ->
@shareLink.done()
it 'should dowload the link', ->
@downloadLink.done()
it 'should delete the device when done', ->
@deleteTheDevice.done()
it 'should return a 200', ->
expect(@response.statusCode).to.equal 200
it 'should return the result', ->
expect(@body).to.equal '{"some-data":true}'
| 62344 | http = require 'http'
request = require 'request'
shmock = require '@octoblu/shmock'
enableDestroy = require 'server-destroy'
MeshbluHttp = require 'meshblu-http'
Server = require '../../src/server'
describe 'Download', ->
before ->
@timeout 20000
meshbluHttp = new MeshbluHttp({})
{@privateKey, publicKey} = meshbluHttp.generateKeyPair()
@privateKeyObj = meshbluHttp.setPrivateKey @privateKey
beforeEach (done) ->
@meshblu = shmock 0xd00d
enableDestroy @meshblu
@box = shmock 0xbabe
enableDestroy @box
serverOptions =
port: undefined,
disableLogging: true
meshbluConfig =
server: 'localhost'
port: 0xd00d
privateKey: @privateKey
@boxServiceUri = "http://localhost:#{0xbabe}"
@server = new Server serverOptions, {meshbluConfig,@boxServiceUri}
@server.run =>
@serverPort = @server.address().port
done()
afterEach ->
@server.destroy()
@meshblu.destroy()
@box.destroy()
describe 'On GET /meshblu/links', ->
beforeEach (done) ->
deviceAuth = new Buffer('one-time-device-uuid:one-time-device-token').toString 'base64'
@getTheDevice = @meshblu
.get '/v2/whoami'
.set 'Authorization', "Basic #{deviceAuth}"
.reply 200,
uuid: 'one-time-device-uuid'
box:
encryptedToken: @privateKeyObj.encrypt 'oh-this-is-my-bearer-token', 'base64'
encryptedFileId: @privateKeyObj.encrypt 'file-id', 'base64'
@shareLink = @box
.put "/files/file-id"
.reply 201,
shared_link:
download_url: "#{@boxServiceUri}/download-link"
@downloadLink = @box
.get "/download-link"
.reply 200, '{"some-data":true}'
@deleteTheDevice = @meshblu
.delete '/devices/one-time-device-uuid'
.set 'Authorization', "Basic #{deviceAuth}"
.reply 200
options =
uri: '/meshblu/links'
baseUrl: "http://localhost:#{@serverPort}"
auth:
username: 'one-time-device-uuid'
password: '<PASSWORD>'
request.get options, (error, @response, @body) =>
done error
it 'should get the device', ->
@getTheDevice.done()
it 'should share the link', ->
@shareLink.done()
it 'should dowload the link', ->
@downloadLink.done()
it 'should delete the device when done', ->
@deleteTheDevice.done()
it 'should return a 200', ->
expect(@response.statusCode).to.equal 200
it 'should return the result', ->
expect(@body).to.equal '{"some-data":true}'
| true | http = require 'http'
request = require 'request'
shmock = require '@octoblu/shmock'
enableDestroy = require 'server-destroy'
MeshbluHttp = require 'meshblu-http'
Server = require '../../src/server'
describe 'Download', ->
before ->
@timeout 20000
meshbluHttp = new MeshbluHttp({})
{@privateKey, publicKey} = meshbluHttp.generateKeyPair()
@privateKeyObj = meshbluHttp.setPrivateKey @privateKey
beforeEach (done) ->
@meshblu = shmock 0xd00d
enableDestroy @meshblu
@box = shmock 0xbabe
enableDestroy @box
serverOptions =
port: undefined,
disableLogging: true
meshbluConfig =
server: 'localhost'
port: 0xd00d
privateKey: @privateKey
@boxServiceUri = "http://localhost:#{0xbabe}"
@server = new Server serverOptions, {meshbluConfig,@boxServiceUri}
@server.run =>
@serverPort = @server.address().port
done()
afterEach ->
@server.destroy()
@meshblu.destroy()
@box.destroy()
describe 'On GET /meshblu/links', ->
beforeEach (done) ->
deviceAuth = new Buffer('one-time-device-uuid:one-time-device-token').toString 'base64'
@getTheDevice = @meshblu
.get '/v2/whoami'
.set 'Authorization', "Basic #{deviceAuth}"
.reply 200,
uuid: 'one-time-device-uuid'
box:
encryptedToken: @privateKeyObj.encrypt 'oh-this-is-my-bearer-token', 'base64'
encryptedFileId: @privateKeyObj.encrypt 'file-id', 'base64'
@shareLink = @box
.put "/files/file-id"
.reply 201,
shared_link:
download_url: "#{@boxServiceUri}/download-link"
@downloadLink = @box
.get "/download-link"
.reply 200, '{"some-data":true}'
@deleteTheDevice = @meshblu
.delete '/devices/one-time-device-uuid'
.set 'Authorization', "Basic #{deviceAuth}"
.reply 200
options =
uri: '/meshblu/links'
baseUrl: "http://localhost:#{@serverPort}"
auth:
username: 'one-time-device-uuid'
password: 'PI:PASSWORD:<PASSWORD>END_PI'
request.get options, (error, @response, @body) =>
done error
it 'should get the device', ->
@getTheDevice.done()
it 'should share the link', ->
@shareLink.done()
it 'should dowload the link', ->
@downloadLink.done()
it 'should delete the device when done', ->
@deleteTheDevice.done()
it 'should return a 200', ->
expect(@response.statusCode).to.equal 200
it 'should return the result', ->
expect(@body).to.equal '{"some-data":true}'
|
[
{
"context": "###\ndoT Express Master of Ceremonies\n@author Dannel Albert <cuebix@gmail.com>\n@license http://opensource.org",
"end": 58,
"score": 0.9998583793640137,
"start": 45,
"tag": "NAME",
"value": "Dannel Albert"
},
{
"context": "press Master of Ceremonies\n@author Dannel Alb... | node_modules/dot-emc/src/dot-emc.coffee | junior201110/nef_node | 0 | ###
doT Express Master of Ceremonies
@author Dannel Albert <cuebix@gmail.com>
@license http://opensource.org/licenses/MIT
###
fs = require "fs"
path = require "path"
doT = require "dot"
# optional html pretty printer
try
html = require "html"
catch e
throw e if e.code != "MODULE_NOT_FOUND"
workingPaths = []
curOptions = null
curPath = null
defaults =
fileExtension: "def"
cacheManager:
get: (filename) -> @cache[filename]
set: (filename, data) -> @cache[filename] = data
cache: {}
options:
templateSettings:
cache: true
if html then defaults.options.prettyPrint =
indent_char: " "
indent_size: 1
class Defines
include: (filename, vars) ->
returnValue = undefined
filename = filename.replace '~', defaults.app?.get "views" or '~'
filename = "#{filename}.#{defaults.fileExtension}" if !path.extname filename
filename = path.resolve curPath, filename if curPath
curPath = path.dirname filename
workingPaths.push curPath
vars = if typeof vars != "object" then curOptions else mergeObjects true, clone(curOptions), vars
try
usingCache = curOptions.templateSettings.cache
if usingCache
cacheManager = defaults.cacheManager
template = cacheManager.get filename
if typeof template is "undefined"
template = fs.readFileSync filename, "utf8"
cacheManager.set filename, template if usingCache
returnValue = doT.template(template, curOptions.templateSettings, @)(vars)
workingPaths.pop()
catch err
workingPaths.pop()
curPath = if workingPaths.length then workingPaths[workingPaths.length - 1] else null
throw err
curPath = if workingPaths.length then workingPaths[workingPaths.length - 1] else null
returnValue
# modeled after jQuery's extend method
mergeObjects = () ->
target = arguments[0]
if typeof target is "boolean"
deep = target
target = arguments[1] or {}
start = 2
else
deep = false
target = arguments[0] or {}
start = 1
argLength = arguments.length
if deep
for i in [start..argLength]
arg = arguments[i]
continue if !arg
for key of arg
val = arg[key]
continue if target == val
t = target[key]
valIsArray = val instanceof Array
valIsObject = !valIsArray and typeof val == "object"
if (val) and (valIsObject or valIsArray)
val = val.slice(0) if valIsArray
if key of target
if valIsArray
t = if t instanceof Array then t else []
else
t = if typeof t is "object" then t else {}
target[key] = mergeObjects true, (if valIsArray then [] else {}), t, val
else
target[key] = val
else if val != undefined
target[key] = val
else
for i in [start..argLength]
arg = arguments[i]
for key of arg
val = arg[key]
target[key] = val if val != undefined
target
clone = (obj) -> mergeObjects true, {}, obj
renderFile = (filename, options, fn) ->
if typeof options == "function"
fn = options
options = {}
fn = ( -> ) if typeof fn != "function"
curOptions = mergeObjects true, options, defaults.options, templateSettings: doT.templateSettings
def = new Defines()
try
if html and curOptions.pretty
fn null, html.prettyPrint def.include(filename), curOptions.prettyPrint or {}
else
fn null, def.include filename
catch err
fn err
exports.__express = renderFile
exports.renderFile = renderFile
exports.Defines = Defines
exports.init = (settings) ->
defaults = mergeObjects true, defaults, settings
exports
| 200263 | ###
doT Express Master of Ceremonies
@author <NAME> <<EMAIL>>
@license http://opensource.org/licenses/MIT
###
fs = require "fs"
path = require "path"
doT = require "dot"
# optional html pretty printer
try
html = require "html"
catch e
throw e if e.code != "MODULE_NOT_FOUND"
workingPaths = []
curOptions = null
curPath = null
defaults =
fileExtension: "def"
cacheManager:
get: (filename) -> @cache[filename]
set: (filename, data) -> @cache[filename] = data
cache: {}
options:
templateSettings:
cache: true
if html then defaults.options.prettyPrint =
indent_char: " "
indent_size: 1
class Defines
include: (filename, vars) ->
returnValue = undefined
filename = filename.replace '~', defaults.app?.get "views" or '~'
filename = "#{filename}.#{defaults.fileExtension}" if !path.extname filename
filename = path.resolve curPath, filename if curPath
curPath = path.dirname filename
workingPaths.push curPath
vars = if typeof vars != "object" then curOptions else mergeObjects true, clone(curOptions), vars
try
usingCache = curOptions.templateSettings.cache
if usingCache
cacheManager = defaults.cacheManager
template = cacheManager.get filename
if typeof template is "undefined"
template = fs.readFileSync filename, "utf8"
cacheManager.set filename, template if usingCache
returnValue = doT.template(template, curOptions.templateSettings, @)(vars)
workingPaths.pop()
catch err
workingPaths.pop()
curPath = if workingPaths.length then workingPaths[workingPaths.length - 1] else null
throw err
curPath = if workingPaths.length then workingPaths[workingPaths.length - 1] else null
returnValue
# modeled after jQuery's extend method
mergeObjects = () ->
target = arguments[0]
if typeof target is "boolean"
deep = target
target = arguments[1] or {}
start = 2
else
deep = false
target = arguments[0] or {}
start = 1
argLength = arguments.length
if deep
for i in [start..argLength]
arg = arguments[i]
continue if !arg
for key of arg
val = arg[key]
continue if target == val
t = target[key]
valIsArray = val instanceof Array
valIsObject = !valIsArray and typeof val == "object"
if (val) and (valIsObject or valIsArray)
val = val.slice(0) if valIsArray
if key of target
if valIsArray
t = if t instanceof Array then t else []
else
t = if typeof t is "object" then t else {}
target[key] = mergeObjects true, (if valIsArray then [] else {}), t, val
else
target[key] = val
else if val != undefined
target[key] = val
else
for i in [start..argLength]
arg = arguments[i]
for key of arg
val = arg[key]
target[key] = val if val != undefined
target
clone = (obj) -> mergeObjects true, {}, obj
renderFile = (filename, options, fn) ->
if typeof options == "function"
fn = options
options = {}
fn = ( -> ) if typeof fn != "function"
curOptions = mergeObjects true, options, defaults.options, templateSettings: doT.templateSettings
def = new Defines()
try
if html and curOptions.pretty
fn null, html.prettyPrint def.include(filename), curOptions.prettyPrint or {}
else
fn null, def.include filename
catch err
fn err
exports.__express = renderFile
exports.renderFile = renderFile
exports.Defines = Defines
exports.init = (settings) ->
defaults = mergeObjects true, defaults, settings
exports
| true | ###
doT Express Master of Ceremonies
@author PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
@license http://opensource.org/licenses/MIT
###
fs = require "fs"
path = require "path"
doT = require "dot"
# optional html pretty printer
try
html = require "html"
catch e
throw e if e.code != "MODULE_NOT_FOUND"
workingPaths = []
curOptions = null
curPath = null
defaults =
fileExtension: "def"
cacheManager:
get: (filename) -> @cache[filename]
set: (filename, data) -> @cache[filename] = data
cache: {}
options:
templateSettings:
cache: true
if html then defaults.options.prettyPrint =
indent_char: " "
indent_size: 1
class Defines
include: (filename, vars) ->
returnValue = undefined
filename = filename.replace '~', defaults.app?.get "views" or '~'
filename = "#{filename}.#{defaults.fileExtension}" if !path.extname filename
filename = path.resolve curPath, filename if curPath
curPath = path.dirname filename
workingPaths.push curPath
vars = if typeof vars != "object" then curOptions else mergeObjects true, clone(curOptions), vars
try
usingCache = curOptions.templateSettings.cache
if usingCache
cacheManager = defaults.cacheManager
template = cacheManager.get filename
if typeof template is "undefined"
template = fs.readFileSync filename, "utf8"
cacheManager.set filename, template if usingCache
returnValue = doT.template(template, curOptions.templateSettings, @)(vars)
workingPaths.pop()
catch err
workingPaths.pop()
curPath = if workingPaths.length then workingPaths[workingPaths.length - 1] else null
throw err
curPath = if workingPaths.length then workingPaths[workingPaths.length - 1] else null
returnValue
# modeled after jQuery's extend method
mergeObjects = () ->
target = arguments[0]
if typeof target is "boolean"
deep = target
target = arguments[1] or {}
start = 2
else
deep = false
target = arguments[0] or {}
start = 1
argLength = arguments.length
if deep
for i in [start..argLength]
arg = arguments[i]
continue if !arg
for key of arg
val = arg[key]
continue if target == val
t = target[key]
valIsArray = val instanceof Array
valIsObject = !valIsArray and typeof val == "object"
if (val) and (valIsObject or valIsArray)
val = val.slice(0) if valIsArray
if key of target
if valIsArray
t = if t instanceof Array then t else []
else
t = if typeof t is "object" then t else {}
target[key] = mergeObjects true, (if valIsArray then [] else {}), t, val
else
target[key] = val
else if val != undefined
target[key] = val
else
for i in [start..argLength]
arg = arguments[i]
for key of arg
val = arg[key]
target[key] = val if val != undefined
target
clone = (obj) -> mergeObjects true, {}, obj
renderFile = (filename, options, fn) ->
if typeof options == "function"
fn = options
options = {}
fn = ( -> ) if typeof fn != "function"
curOptions = mergeObjects true, options, defaults.options, templateSettings: doT.templateSettings
def = new Defines()
try
if html and curOptions.pretty
fn null, html.prettyPrint def.include(filename), curOptions.prettyPrint or {}
else
fn null, def.include filename
catch err
fn err
exports.__express = renderFile
exports.renderFile = renderFile
exports.Defines = Defines
exports.init = (settings) ->
defaults = mergeObjects true, defaults, settings
exports
|
[
{
"context": " tomId = Meteor.users.insert(profile:\n name: \"Tom Coleman\"\n )\n tom = Meteor.users.findOne(tomId)\n sachaI",
"end": 157,
"score": 0.999846339225769,
"start": 146,
"tag": "NAME",
"value": "Tom Coleman"
},
{
"context": "sachaId = Meteor.users.insert(profile:\n ... | microscope/server/fixtures.coffee | Brabon/meteor-tutorial-coffeescript | 1 | # Fixture data
if Posts.find().count() is 0
now = new Date().getTime()
# create two users
tomId = Meteor.users.insert(profile:
name: "Tom Coleman"
)
tom = Meteor.users.findOne(tomId)
sachaId = Meteor.users.insert(profile:
name: "Sacha Greif"
)
sacha = Meteor.users.findOne(sachaId)
telescopeId = Posts.insert(
title: "Introducing Telescope"
userId: sacha._id
author: sacha.profile.name
url: "http://sachagreif.com/introducing-telescope/"
submitted: new Date(now - 7 * 3600 * 1000)
commentsCount: 2
)
Comments.insert
postId: telescopeId
userId: tom._id
author: tom.profile.name
submitted: new Date(now - 5 * 3600 * 1000)
body: "Interesting project Sacha, can I get involved?"
Comments.insert
postId: telescopeId
userId: sacha._id
author: sacha.profile.name
submitted: new Date(now - 3 * 3600 * 1000)
body: "You sure can Tom!"
Posts.insert
title: "Meteor"
userId: tom._id
author: tom.profile.name
url: "http://meteor.com"
submitted: new Date(now - 10 * 3600 * 1000)
commentsCount: 0
Posts.insert
title: "The Meteor Book"
userId: tom._id
author: tom.profile.name
url: "http://themeteorbook.com"
submitted: new Date(now - 12 * 3600 * 1000)
commentsCount: 0
i = 0
while i < 10
Posts.insert
title: "Test post #" + i
author: sacha.profile.name
userId: sacha._id
url: "http://google.com/?q=test-" + i
submitted: new Date(now - i * 3600 * 1000 + 1)
commentsCount: 0
i++ | 176295 | # Fixture data
if Posts.find().count() is 0
now = new Date().getTime()
# create two users
tomId = Meteor.users.insert(profile:
name: "<NAME>"
)
tom = Meteor.users.findOne(tomId)
sachaId = Meteor.users.insert(profile:
name: "<NAME>"
)
sacha = Meteor.users.findOne(sachaId)
telescopeId = Posts.insert(
title: "Introducing Telescope"
userId: sacha._id
author: sacha.<EMAIL>
url: "http://sachagreif.com/introducing-telescope/"
submitted: new Date(now - 7 * 3600 * 1000)
commentsCount: 2
)
Comments.insert
postId: telescopeId
userId: tom._id
author: tom.profile.name
submitted: new Date(now - 5 * 3600 * 1000)
body: "Interesting project <NAME>, can I get involved?"
Comments.insert
postId: telescopeId
userId: sacha._id
author: sacha.profile.name
submitted: new Date(now - 3 * 3600 * 1000)
body: "You sure can <NAME>!"
Posts.insert
title: "Meteor"
userId: tom._id
author: tom.profile.name
url: "http://meteor.com"
submitted: new Date(now - 10 * 3600 * 1000)
commentsCount: 0
Posts.insert
title: "The Meteor Book"
userId: tom._id
author: tom.profile.name
url: "http://themeteorbook.com"
submitted: new Date(now - 12 * 3600 * 1000)
commentsCount: 0
i = 0
while i < 10
Posts.insert
title: "Test post #" + i
author: <EMAIL>
userId: sacha._id
url: "http://google.com/?q=test-" + i
submitted: new Date(now - i * 3600 * 1000 + 1)
commentsCount: 0
i++ | true | # Fixture data
if Posts.find().count() is 0
now = new Date().getTime()
# create two users
tomId = Meteor.users.insert(profile:
name: "PI:NAME:<NAME>END_PI"
)
tom = Meteor.users.findOne(tomId)
sachaId = Meteor.users.insert(profile:
name: "PI:NAME:<NAME>END_PI"
)
sacha = Meteor.users.findOne(sachaId)
telescopeId = Posts.insert(
title: "Introducing Telescope"
userId: sacha._id
author: sacha.PI:EMAIL:<EMAIL>END_PI
url: "http://sachagreif.com/introducing-telescope/"
submitted: new Date(now - 7 * 3600 * 1000)
commentsCount: 2
)
Comments.insert
postId: telescopeId
userId: tom._id
author: tom.profile.name
submitted: new Date(now - 5 * 3600 * 1000)
body: "Interesting project PI:NAME:<NAME>END_PI, can I get involved?"
Comments.insert
postId: telescopeId
userId: sacha._id
author: sacha.profile.name
submitted: new Date(now - 3 * 3600 * 1000)
body: "You sure can PI:NAME:<NAME>END_PI!"
Posts.insert
title: "Meteor"
userId: tom._id
author: tom.profile.name
url: "http://meteor.com"
submitted: new Date(now - 10 * 3600 * 1000)
commentsCount: 0
Posts.insert
title: "The Meteor Book"
userId: tom._id
author: tom.profile.name
url: "http://themeteorbook.com"
submitted: new Date(now - 12 * 3600 * 1000)
commentsCount: 0
i = 0
while i < 10
Posts.insert
title: "Test post #" + i
author: PI:EMAIL:<EMAIL>END_PI
userId: sacha._id
url: "http://google.com/?q=test-" + i
submitted: new Date(now - i * 3600 * 1000 + 1)
commentsCount: 0
i++ |
[
{
"context": "s\",\"Prov\",\"Eccl\",\"Song\",\"Isa\",\"Jer\",\"Lam\",\"Ezek\",\"Dan\",\"Hos\",\"Joel\",\"Amos\",\"Obad\",\"Jonah\",\"Mic\",\"Nah\",\"",
"end": 505,
"score": 0.766970157623291,
"start": 502,
"tag": "NAME",
"value": "Dan"
},
{
"context": "ov\",\"Eccl\",\"Song\",\"Isa\",... | lib/bible-tools/lib/Bible-Passage-Reference-Parser/src/uk/spec.coffee | saiba-mais/bible-lessons | 0 | bcv_parser = require("../../js/uk_bcv_parser.js").bcv_parser
describe "Parsing", ->
p = {}
beforeEach ->
p = new bcv_parser
p.options.osis_compaction_strategy = "b"
p.options.sequence_combination_strategy = "combine"
it "should round-trip OSIS references", ->
p.set_options osis_compaction_strategy: "bc"
books = ["Gen","Exod","Lev","Num","Deut","Josh","Judg","Ruth","1Sam","2Sam","1Kgs","2Kgs","1Chr","2Chr","Ezra","Neh","Esth","Job","Ps","Prov","Eccl","Song","Isa","Jer","Lam","Ezek","Dan","Hos","Joel","Amos","Obad","Jonah","Mic","Nah","Hab","Zeph","Hag","Zech","Mal","Matt","Mark","Luke","John","Acts","Rom","1Cor","2Cor","Gal","Eph","Phil","Col","1Thess","2Thess","1Tim","2Tim","Titus","Phlm","Heb","Jas","1Pet","2Pet","1John","2John","3John","Jude","Rev"]
for book in books
bc = book + ".1"
bcv = bc + ".1"
bcv_range = bcv + "-" + bc + ".2"
expect(p.parse(bc).osis()).toEqual bc
expect(p.parse(bcv).osis()).toEqual bcv
expect(p.parse(bcv_range).osis()).toEqual bcv_range
it "should round-trip OSIS Apocrypha references", ->
p.set_options osis_compaction_strategy: "bc", ps151_strategy: "b"
p.include_apocrypha true
books = ["Tob","Jdt","GkEsth","Wis","Sir","Bar","PrAzar","Sus","Bel","SgThree","EpJer","1Macc","2Macc","3Macc","4Macc","1Esd","2Esd","PrMan","Ps151"]
for book in books
bc = book + ".1"
bcv = bc + ".1"
bcv_range = bcv + "-" + bc + ".2"
expect(p.parse(bc).osis()).toEqual bc
expect(p.parse(bcv).osis()).toEqual bcv
expect(p.parse(bcv_range).osis()).toEqual bcv_range
p.set_options ps151_strategy: "bc"
expect(p.parse("Ps151.1").osis()).toEqual "Ps.151"
expect(p.parse("Ps151.1.1").osis()).toEqual "Ps.151.1"
expect(p.parse("Ps151.1-Ps151.2").osis()).toEqual "Ps.151.1-Ps.151.2"
p.include_apocrypha false
for book in books
bc = book + ".1"
expect(p.parse(bc).osis()).toEqual ""
it "should handle a preceding character", ->
expect(p.parse(" Gen 1").osis()).toEqual "Gen.1"
expect(p.parse("Matt5John3").osis()).toEqual "Matt.5,John.3"
expect(p.parse("1Ps 1").osis()).toEqual ""
expect(p.parse("11Sam 1").osis()).toEqual ""
describe "Localized book Gen (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Gen (uk)", ->
`
expect(p.parse("1-ше. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перша книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перша книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перше книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перше книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Buttja 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Буття 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 М 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Gen 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Буг 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Бут 1:1").osis()).toEqual("Gen.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРША КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРША КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРШЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРШЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("BUTTJA 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУТТЯ 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 М 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("GEN 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУГ 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУТ 1:1").osis()).toEqual("Gen.1.1")
`
true
describe "Localized book Exod (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Exod (uk)", ->
`
expect(p.parse("2-ге. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друга книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друга книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друге книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друге книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Vyhid 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Vyȟid 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Вихід 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Exod 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 М 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Вих 1:1").osis()).toEqual("Exod.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("VYHID 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("VYȞID 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ВИХІД 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("EXOD 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 М 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ВИХ 1:1").osis()).toEqual("Exod.1.1")
`
true
describe "Localized book Bel (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Bel (uk)", ->
`
expect(p.parse("Бел і дракон 1:1").osis()).toEqual("Bel.1.1")
expect(p.parse("Bel 1:1").osis()).toEqual("Bel.1.1")
expect(p.parse("Бел 1:1").osis()).toEqual("Bel.1.1")
`
true
describe "Localized book Lev (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Lev (uk)", ->
`
expect(p.parse("3-тє. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третя книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третя книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третє книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третє книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Levyt 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Левит 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 М 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Lev 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Лев 1:1").osis()).toEqual("Lev.1.1")
p.include_apocrypha(false)
expect(p.parse("3-ТЄ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЯ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЯ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЄ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЄ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("LEVYT 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ЛЕВИТ 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 М 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("LEV 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ЛЕВ 1:1").osis()).toEqual("Lev.1.1")
`
true
describe "Localized book Num (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Num (uk)", ->
`
expect(p.parse("Четверта книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Четверта книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Cysla 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Čysla 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Числа 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Числ 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 М 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Num 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Чис 1:1").osis()).toEqual("Num.1.1")
p.include_apocrypha(false)
expect(p.parse("ЧЕТВЕРТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧЕТВЕРТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("CYSLA 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ČYSLA 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИСЛА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИСЛ 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 М 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("NUM 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИС 1:1").osis()).toEqual("Num.1.1")
`
true
describe "Localized book Sir (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Sir (uk)", ->
`
expect(p.parse("Премудрість Ісуса, сина Сирахова 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Книга Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Бен Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Еклесіаст 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Sir 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Сир 1:1").osis()).toEqual("Sir.1.1")
`
true
describe "Localized book Wis (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Wis (uk)", ->
`
expect(p.parse("Книга Премудрості Соломона 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Премудрість Соломона 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Книга Мудрости 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Мудрости 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Прем 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Wis 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Муд 1:1").osis()).toEqual("Wis.1.1")
`
true
describe "Localized book Lam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Lam (uk)", ->
`
expect(p.parse("Plac Jeremii 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plac Jeremiï 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plač Jeremii 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plač Jeremiï 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач Єреміі 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач Єремії 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Lam 1:1").osis()).toEqual("Lam.1.1")
p.include_apocrypha(false)
expect(p.parse("PLAC JEREMII 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAC JEREMIÏ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAČ JEREMII 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAČ JEREMIÏ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ ЄРЕМІІ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ ЄРЕМІЇ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("LAM 1:1").osis()).toEqual("Lam.1.1")
`
true
describe "Localized book EpJer (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: EpJer (uk)", ->
`
expect(p.parse("Послання Єреміі 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Послання Єремії 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Лист Єреміі 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Лист Єремії 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("EpJer 1:1").osis()).toEqual("EpJer.1.1")
`
true
describe "Localized book Rev (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Rev (uk)", ->
`
expect(p.parse("Об'явлення св. Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св. Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св. Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Ob'javlennja Ivana Bohoslova 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Ob’javlennja Ivana Bohoslova 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Одкровення Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Відкриття Івана 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апока́ліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокaліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокáліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокалiпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокалíпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокаліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Одкриттє 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явл 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явл 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Rev 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об 1:1").osis()).toEqual("Rev.1.1")
p.include_apocrypha(false)
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("OB'JAVLENNJA IVANA BOHOSLOVA 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("OB’JAVLENNJA IVANA BOHOSLOVA 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОДКРОВЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ВІДКРИТТЯ ІВАНА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКА́ЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКAЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКÁЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛIПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛÍПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОДКРИТТЄ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("REV 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ 1:1").osis()).toEqual("Rev.1.1")
`
true
describe "Localized book PrMan (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PrMan (uk)", ->
`
expect(p.parse("PrMan 1:1").osis()).toEqual("PrMan.1.1")
`
true
describe "Localized book Deut (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Deut (uk)", ->
`
expect(p.parse("П'ята книга Моисеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П'ята книга Мойсеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ята книга Моисеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ята книга Мойсеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Povtorennja Zakonu 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повторення Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Второзаконня 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт. Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П. Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П.Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Deut 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Втор 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПЗак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("5 М 1:1").osis()).toEqual("Deut.1.1")
p.include_apocrypha(false)
expect(p.parse("П'ЯТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П'ЯТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ЯТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ЯТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("POVTORENNJA ZAKONU 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТОРЕННЯ ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ВТОРОЗАКОННЯ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ. ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П. ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П.ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("DEUT 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ВТОР 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("5 М 1:1").osis()).toEqual("Deut.1.1")
`
true
describe "Localized book Josh (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Josh (uk)", ->
`
expect(p.parse("Книга Ісуса Навина 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Ісуса Навина 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Книга Єгошуі 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Книга Єгошуї 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Isus Navyn 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Ісус Навин 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єгошуі 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єгошуї 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І. Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Josh 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єг 1:1").osis()).toEqual("Josh.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ІСУСА НАВИНА 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ІСУСА НАВИНА 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("КНИГА ЄГОШУІ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("КНИГА ЄГОШУЇ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ISUS NAVYN 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ІСУС НАВИН 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГОШУІ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГОШУЇ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І. НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("JOSH 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГ 1:1").osis()).toEqual("Josh.1.1")
`
true
describe "Localized book Judg (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Judg (uk)", ->
`
expect(p.parse("Knyha Suddiv 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Книга Суддів 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Суддів 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Judg 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Суд 1:1").osis()).toEqual("Judg.1.1")
p.include_apocrypha(false)
expect(p.parse("KNYHA SUDDIV 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("КНИГА СУДДІВ 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("СУДДІВ 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("JUDG 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("СУД 1:1").osis()).toEqual("Judg.1.1")
`
true
describe "Localized book Ruth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ruth (uk)", ->
`
expect(p.parse("Книга Рут 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Ruth 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Rut 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Рут 1:1").osis()).toEqual("Ruth.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА РУТ 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("RUTH 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("RUT 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("РУТ 1:1").osis()).toEqual("Ruth.1.1")
`
true
describe "Localized book 1Esd (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Esd (uk)", ->
`
expect(p.parse("1-ше. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перша Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перша Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перше Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перше Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Езд 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1Esd 1:1").osis()).toEqual("1Esd.1.1")
`
true
describe "Localized book 2Esd (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Esd (uk)", ->
`
expect(p.parse("2-ге. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Езд 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2Esd 1:1").osis()).toEqual("2Esd.1.1")
`
true
describe "Localized book Isa (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Isa (uk)", ->
`
expect(p.parse("Книга пророка Ісаі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга пророка Ісаї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісаиі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісаиї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісайі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісайї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Isaja 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісая 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісаі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісаї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Isa 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Іс 1:1").osis()).toEqual("Isa.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ІСАІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ПРОРОКА ІСАЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАИІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАИЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАЙІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАЙЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ISAJA 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАЯ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ISA 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІС 1:1").osis()).toEqual("Isa.1.1")
`
true
describe "Localized book 2Sam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Sam (uk)", ->
`
expect(p.parse("2-ге. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Сам 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2Sam 1:1").osis()).toEqual("2Sam.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2SAM 1:1").osis()).toEqual("2Sam.1.1")
`
true
describe "Localized book 1Sam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Sam (uk)", ->
`
expect(p.parse("1-ше. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Сам 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1Sam 1:1").osis()).toEqual("1Sam.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1SAM 1:1").osis()).toEqual("1Sam.1.1")
`
true
describe "Localized book 2Kgs (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Kgs (uk)", ->
`
expect(p.parse("2-ге. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Четверта Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV. Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4. Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4 Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 Цар 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2Kgs 1:1").osis()).toEqual("2Kgs.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ЧЕТВЕРТА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4 ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 ЦАР 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2KGS 1:1").osis()).toEqual("2Kgs.1.1")
`
true
describe "Localized book 1Kgs (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Kgs (uk)", ->
`
expect(p.parse("1-ше. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-тє. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Третя Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Третє Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-а. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-е. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-тє Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-а Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-е Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3 Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 Цар 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1Kgs 1:1").osis()).toEqual("1Kgs.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-ТЄ. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ТРЕТЯ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ТРЕТЄ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-А. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-Е. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-ТЄ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-А ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-Е ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3 ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 ЦАР 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1KGS 1:1").osis()).toEqual("1Kgs.1.1")
`
true
describe "Localized book 2Chr (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Chr (uk)", ->
`
expect(p.parse("2-ге. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хр 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2Chr 1:1").osis()).toEqual("2Chr.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХР 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2CHR 1:1").osis()).toEqual("2Chr.1.1")
`
true
describe "Localized book 1Chr (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Chr (uk)", ->
`
expect(p.parse("1-ше. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хр 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1Chr 1:1").osis()).toEqual("1Chr.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХР 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1CHR 1:1").osis()).toEqual("1Chr.1.1")
`
true
describe "Localized book Ezra (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ezra (uk)", ->
`
expect(p.parse("Книга Ездри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ezdra 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Єздри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездра 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ezra 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездр 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Єзд 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Езд 1:1").osis()).toEqual("Ezra.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("EZDRA 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЄЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДРА 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("EZRA 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДР 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЄЗД 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗД 1:1").osis()).toEqual("Ezra.1.1")
`
true
describe "Localized book Neh (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Neh (uk)", ->
`
expect(p.parse("Книга Нееміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Книга Неемії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Neemija 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неемія 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Нееміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неемії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неєміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неємії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неем 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неєм 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Neh 1:1").osis()).toEqual("Neh.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА НЕЕМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("КНИГА НЕЕМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("NEEMIJA 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІЯ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("NEH 1:1").osis()).toEqual("Neh.1.1")
`
true
describe "Localized book GkEsth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: GkEsth (uk)", ->
`
expect(p.parse("GkEsth 1:1").osis()).toEqual("GkEsth.1.1")
`
true
describe "Localized book Esth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Esth (uk)", ->
`
expect(p.parse("Книга Естер 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Книга Есфір 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Ester 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Естер 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Есфір 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Esth 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Ест 1:1").osis()).toEqual("Esth.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕСТЕР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("КНИГА ЕСФІР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ESTER 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСТЕР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСФІР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ESTH 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСТ 1:1").osis()).toEqual("Esth.1.1")
`
true
describe "Localized book Job (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Job (uk)", ->
`
expect(p.parse("Книга Іова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Книга Иова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Книга Йова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Іова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Иова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Йова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Job 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Jov 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Иов 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Йов 1:1").osis()).toEqual("Job.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ІОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("КНИГА ИОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("КНИГА ЙОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ІОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ИОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ЙОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("JOB 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("JOV 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ИОВ 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ЙОВ 1:1").osis()).toEqual("Job.1.1")
`
true
describe "Localized book Ps (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ps (uk)", ->
`
expect(p.parse("Книга Псалмів 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалти́р 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалмів 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Psalmy 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалми 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псал 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Ps 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Пс 1:1").osis()).toEqual("Ps.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПСАЛМІВ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛТИ́Р 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛМІВ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("PSALMY 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛМИ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("PS 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПС 1:1").osis()).toEqual("Ps.1.1")
`
true
describe "Localized book PrAzar (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PrAzar (uk)", ->
`
expect(p.parse("Молитва Азаріі 1:1").osis()).toEqual("PrAzar.1.1")
expect(p.parse("Молитва Азарії 1:1").osis()).toEqual("PrAzar.1.1")
expect(p.parse("PrAzar 1:1").osis()).toEqual("PrAzar.1.1")
`
true
describe "Localized book Prov (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Prov (uk)", ->
`
expect(p.parse("Книга Приповістеи Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Книга Приповістей Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Книга Приказок Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістеи соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістей соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притчі Соломона 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістеи 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістей 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Prypovisti 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповідок 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповісті 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приказки 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приказок 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притчі 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притч 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Prov 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Прип 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Пр 1:1").osis()).toEqual("Prov.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРИПОВІСТЕИ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("КНИГА ПРИПОВІСТЕЙ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("КНИГА ПРИКАЗОК СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕИ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕЙ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧІ СОЛОМОНА 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕИ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕЙ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("PRYPOVISTI 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІДОК 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТІ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИКАЗКИ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИКАЗОК 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧІ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("PROV 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИП 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПР 1:1").osis()).toEqual("Prov.1.1")
`
true
describe "Localized book Eccl (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Eccl (uk)", ->
`
expect(p.parse("Книга Екклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Книга Еклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Еклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Проповідника 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Ekklezijast 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіяста 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіяст 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Коге́лет 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Eccl 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Еккл 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екл 1:1").osis()).toEqual("Eccl.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕККЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("КНИГА ЕКЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕКЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ПРОПОВІДНИКА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("EKKLEZIJAST 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("КОГЕ́ЛЕТ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ECCL 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕКЛ 1:1").osis()).toEqual("Eccl.1.1")
`
true
describe "Localized book SgThree (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: SgThree (uk)", ->
`
expect(p.parse("Пісня трьох отроків 1:1").osis()).toEqual("SgThree.1.1")
expect(p.parse("SgThree 1:1").osis()).toEqual("SgThree.1.1")
`
true
describe "Localized book Song (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Song (uk)", ->
`
expect(p.parse("Книга Пісні Пісень Соломона 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня над піснями Соломона 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Pisnja nad pisnjamy 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня над піснями 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня Піснеи 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня Пісней 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісні Пісень 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Song 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісн 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П 1:1").osis()).toEqual("Song.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПІСНІ ПІСЕНЬ СОЛОМОНА 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ НАД ПІСНЯМИ СОЛОМОНА 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("PISNJA NAD PISNJAMY 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ НАД ПІСНЯМИ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ ПІСНЕИ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ ПІСНЕЙ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНІ ПІСЕНЬ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("SONG 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСН 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П 1:1").osis()).toEqual("Song.1.1")
`
true
describe "Localized book Jer (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jer (uk)", ->
`
expect(p.parse("Книга пророка Єреміі 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Книга пророка Єремії 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Jeremija 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єремія 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єреміі 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єремії 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єрем 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Jer 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єр 1:1").osis()).toEqual("Jer.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЄРЕМІІ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("КНИГА ПРОРОКА ЄРЕМІЇ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("JEREMIJA 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІЯ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІІ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІЇ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("JER 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄР 1:1").osis()).toEqual("Jer.1.1")
`
true
describe "Localized book Ezek (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ezek (uk)", ->
`
expect(p.parse("Книга пророка Єзекііля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Книга пророка Єзекіїля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiil' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiil’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiïl' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiïl’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііла 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііль 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїла 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїль 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Ezek 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзек 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єз 1:1").osis()).toEqual("Ezek.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЄЗЕКІІЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("КНИГА ПРОРОКА ЄЗЕКІЇЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIIL' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIIL’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIÏL' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIÏL’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛА 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛЬ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛА 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛЬ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("EZEK 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕК 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗ 1:1").osis()).toEqual("Ezek.1.1")
`
true
describe "Localized book Dan (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Dan (uk)", ->
`
expect(p.parse("Книга пророка Даниіла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Книга пророка Даниїла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниіла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниїла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Danyil 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Danyïl 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниіл 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниїл 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Dan 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Дан 1:1").osis()).toEqual("Dan.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ДАНИІЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("КНИГА ПРОРОКА ДАНИЇЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИІЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИЇЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DANYIL 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DANYÏL 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИІЛ 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИЇЛ 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DAN 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАН 1:1").osis()).toEqual("Dan.1.1")
`
true
describe "Localized book Hos (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hos (uk)", ->
`
expect(p.parse("Книга пророка Осіі 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Книга пророка Осії 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Osija 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осія 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осіі 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осії 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Hos 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Ос 1:1").osis()).toEqual("Hos.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ОСІІ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("КНИГА ПРОРОКА ОСІЇ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("OSIJA 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІЯ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІІ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІЇ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("HOS 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОС 1:1").osis()).toEqual("Hos.1.1")
`
true
describe "Localized book Joel (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Joel (uk)", ->
`
expect(p.parse("Книга пророка Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга пророка Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joel 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joil 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joïl 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоіл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоін 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїн 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоіл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоін 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїн 1:1").osis()).toEqual("Joel.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ПРОРОКА ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOEL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOIL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOÏL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇН 1:1").osis()).toEqual("Joel.1.1")
`
true
describe "Localized book Amos (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Amos (uk)", ->
`
expect(p.parse("Книга пророка Амоса 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Амоса 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Amos 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Амос 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Ам 1:1").osis()).toEqual("Amos.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АМОСА 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМОСА 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("AMOS 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМОС 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМ 1:1").osis()).toEqual("Amos.1.1")
`
true
describe "Localized book Obad (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Obad (uk)", ->
`
expect(p.parse("Книга пророка Авдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Книга пророка Овдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Ovdij 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Авдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдіи 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдій 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Obad 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Авд 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овд 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Ов 1:1").osis()).toEqual("Obad.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("КНИГА ПРОРОКА ОВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("OVDIJ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("АВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІИ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІЙ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("OBAD 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("АВД 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВД 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВ 1:1").osis()).toEqual("Obad.1.1")
`
true
describe "Localized book Jonah (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jonah (uk)", ->
`
expect(p.parse("Книга пророка Иони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Книга пророка Йони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Jonah 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Jona 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Иона 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Иони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йона 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Ион 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йон 1:1").osis()).toEqual("Jonah.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ИОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("КНИГА ПРОРОКА ЙОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("JONAH 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("JONA 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОНА 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОНА 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОН 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОН 1:1").osis()).toEqual("Jonah.1.1")
`
true
describe "Localized book Mic (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mic (uk)", ->
`
expect(p.parse("Книга пророка Михея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Книга пророка Міхея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Myhej 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Myȟej 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михеи 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михей 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Міхея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Mic 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Мих 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Міх 1:1").osis()).toEqual("Mic.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА МИХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("КНИГА ПРОРОКА МІХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MYHEJ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MYȞEJ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕИ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕЙ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МІХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MIC 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МІХ 1:1").osis()).toEqual("Mic.1.1")
`
true
describe "Localized book Nah (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Nah (uk)", ->
`
expect(p.parse("Книга пророка Наума 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Наума 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Naum 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Наум 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Nah 1:1").osis()).toEqual("Nah.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА НАУМА 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("НАУМА 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("NAUM 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("НАУМ 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("NAH 1:1").osis()).toEqual("Nah.1.1")
`
true
describe "Localized book Hab (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hab (uk)", ->
`
expect(p.parse("Книга пророка Авакума 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Авакума 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Avakum 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Авакум 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Hab 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Ав 1:1").osis()).toEqual("Hab.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АВАКУМА 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВАКУМА 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("AVAKUM 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВАКУМ 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("HAB 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВ 1:1").osis()).toEqual("Hab.1.1")
`
true
describe "Localized book Zeph (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Zeph (uk)", ->
`
expect(p.parse("Книга пророка Софоніі 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Книга пророка Софонії 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Sofonija 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софонія 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софоніі 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софонії 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Zeph 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Соф 1:1").osis()).toEqual("Zeph.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА СОФОНІІ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("КНИГА ПРОРОКА СОФОНІЇ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("SOFONIJA 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІЯ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІІ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІЇ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("ZEPH 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФ 1:1").osis()).toEqual("Zeph.1.1")
`
true
describe "Localized book Hag (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hag (uk)", ->
`
expect(p.parse("Книга пророка Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Книга Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Аггея 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Ohij 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огіи 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огій 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Hag 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Аг 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Ог 1:1").osis()).toEqual("Hag.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("КНИГА ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("АГГЕЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("OHIJ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІИ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІЙ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("HAG 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("АГ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГ 1:1").osis()).toEqual("Hag.1.1")
`
true
describe "Localized book Zech (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Zech (uk)", ->
`
expect(p.parse("Книга пророка Захарія 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Книга Захаріі 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Книга Захарії 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zaharij 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zaȟarij 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захаріи 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарій 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарія 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захаріі 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарії 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zech 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Зах 1:1").osis()).toEqual("Zech.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЗАХАРІЯ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("КНИГА ЗАХАРІІ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("КНИГА ЗАХАРІЇ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZAHARIJ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZAȞARIJ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІИ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЙ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЯ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІІ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЇ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZECH 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХ 1:1").osis()).toEqual("Zech.1.1")
`
true
describe "Localized book Mal (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mal (uk)", ->
`
expect(p.parse("Книга пророка Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга пророка Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Malahija 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Malaȟija 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахія 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Mal 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Мал 1:1").osis()).toEqual("Mal.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА ПРОРОКА МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MALAHIJA 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MALAȞIJA 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІЯ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MAL 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛ 1:1").osis()).toEqual("Mal.1.1")
`
true
describe "Localized book Matt (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Matt (uk)", ->
`
expect(p.parse("Євангелія від св. Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від св. Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Jevanhelije vid Matvija 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангелія від св Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від св Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангелія від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від Матея 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матеи 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матей 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Matt 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матв 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Мат 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Мт 1:1").osis()).toEqual("Matt.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("JEVANHELIJE VID MATVIJA 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАТЕЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТЕИ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТЕЙ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("MATT 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТВ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МТ 1:1").osis()).toEqual("Matt.1.1")
`
true
describe "Localized book 2Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Macc (uk)", ->
`
expect(p.parse("2-ге. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Мак 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2Macc 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Мк 1:1").osis()).toEqual("2Macc.1.1")
`
true
describe "Localized book 3Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 3Macc (uk)", ->
`
expect(p.parse("3-тє. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Мак 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3Macc 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Мк 1:1").osis()).toEqual("3Macc.1.1")
`
true
describe "Localized book 4Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 4Macc (uk)", ->
`
expect(p.parse("Четверта книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Мак 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4Macc 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Мк 1:1").osis()).toEqual("4Macc.1.1")
`
true
describe "Localized book 1Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Macc (uk)", ->
`
expect(p.parse("1-ше. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Мак 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1Macc 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Мк 1:1").osis()).toEqual("1Macc.1.1")
`
true
describe "Localized book Mark (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mark (uk)", ->
`
expect(p.parse("Євангелія від св. Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від св. Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангелія від св Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від св Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Jevanhelije vid Marka 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангелія від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Марко 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Mark 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Мк 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Мр 1:1").osis()).toEqual("Mark.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("JEVANHELIJE VID MARKA 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МАРКО 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("MARK 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МК 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МР 1:1").osis()).toEqual("Mark.1.1")
`
true
describe "Localized book Luke (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Luke (uk)", ->
`
expect(p.parse("Євангелія від св. Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від св. Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангелія від св Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від св Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Jevanhelije vid Luky 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від Лу ки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангелія від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Luke 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Лука 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Лк 1:1").osis()).toEqual("Luke.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("JEVANHELIJE VID LUKY 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ЛУ КИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("LUKE 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛУКА 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛК 1:1").osis()).toEqual("Luke.1.1")
`
true
describe "Localized book 1John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1John (uk)", ->
`
expect(p.parse("1-ше. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Perse poslannja apostola Ivana 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Perše poslannja apostola Ivana 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1John 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Ів 1:1").osis()).toEqual("1John.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1JOHN 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІВ 1:1").osis()).toEqual("1John.1.1")
`
true
describe "Localized book 2John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2John (uk)", ->
`
expect(p.parse("2-ге. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Druhe poslannja apostola Ivana 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Послання до Тита 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2John 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Ів 1:1").osis()).toEqual("2John.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ПОСЛАННЯ ДО ТИТА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2JOHN 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІВ 1:1").osis()).toEqual("2John.1.1")
`
true
describe "Localized book 3John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 3John (uk)", ->
`
expect(p.parse("3-тє. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Tretje poslannja apostola Ivana 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3John 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Ів 1:1").osis()).toEqual("3John.1.1")
p.include_apocrypha(false)
expect(p.parse("3-ТЄ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("TRETJE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3JOHN 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІВ 1:1").osis()).toEqual("3John.1.1")
`
true
describe "Localized book John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: John (uk)", ->
`
expect(p.parse("Євангелія від св. Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св. Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св. Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангелія від св Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Jevanhelije vid Ivana 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангелія від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("John 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Иоан 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Йоан 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Ів 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Ін 1:1").osis()).toEqual("John.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("JEVANHELIJE VID IVANA 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("JOHN 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ИОАН 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЙОАН 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІВ 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІН 1:1").osis()).toEqual("John.1.1")
`
true
describe "Localized book Acts (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Acts (uk)", ->
`
expect(p.parse("Dijannja svjatyh apostoliv 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Dijannja svjatyȟ apostoliv 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діяння Святих Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі святих апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії святих апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діяння 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Acts 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діян 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії 1:1").osis()).toEqual("Acts.1.1")
p.include_apocrypha(false)
expect(p.parse("DIJANNJA SVJATYH APOSTOLIV 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("DIJANNJA SVJATYȞ APOSTOLIV 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯННЯ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯННЯ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ACTS 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯН 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ 1:1").osis()).toEqual("Acts.1.1")
`
true
describe "Localized book Rom (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Rom (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання св апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Poslannja apostola Pavla do rymljan 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("До римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римляни 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римл 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Rom 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Рим 1:1").osis()).toEqual("Rom.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO RYMLJAN 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛЯНИ 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛ 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ROM 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМ 1:1").osis()).toEqual("Rom.1.1")
`
true
describe "Localized book 2Cor (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Cor (uk)", ->
`
expect(p.parse("Druhe poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Кор 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2Cor 1:1").osis()).toEqual("2Cor.1.1")
p.include_apocrypha(false)
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОР 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2COR 1:1").osis()).toEqual("2Cor.1.1")
`
true
describe "Localized book 1Cor (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Cor (uk)", ->
`
expect(p.parse("Perse poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Perše poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Кор 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1Cor 1:1").osis()).toEqual("1Cor.1.1")
p.include_apocrypha(false)
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОР 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1COR 1:1").osis()).toEqual("1Cor.1.1")
`
true
describe "Localized book Gal (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Gal (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання св апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Poslannja apostola Pavla do halativ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("По слання до Галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("До галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Галатяни 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Gal 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Гал 1:1").osis()).toEqual("Gal.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO HALATIV 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПО СЛАННЯ ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛАТЯНИ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("GAL 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛ 1:1").osis()).toEqual("Gal.1.1")
`
true
describe "Localized book Eph (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Eph (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання св апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Poslannja apostola Pavla do efesjan 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("По слан ня до Єфесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("До ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефесяни 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефес 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Eph 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Єф 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Еф 1:1").osis()).toEqual("Eph.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO EFESJAN 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПО СЛАН НЯ ДО ЄФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕСЯНИ 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕС 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("EPH 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЄФ 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФ 1:1").osis()).toEqual("Eph.1.1")
`
true
describe "Localized book Phil (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Phil (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св. апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Poslannja apostola Pavla do fylyp'jan 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Poslannja apostola Pavla do fylyp’jan 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до Філіп'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до Філіп’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("До филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("До филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип'яни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип’яни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филипяни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Phil 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филп 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Фил 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Флп 1:1").osis()).toEqual("Phil.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYP'JAN 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYP’JAN 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФІЛІП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФІЛІП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП'ЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП’ЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИПЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("PHIL 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛП 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФЛП 1:1").osis()).toEqual("Phil.1.1")
`
true
describe "Localized book Col (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Col (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання св апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Poslannja apostola Pavla do kolosjan 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання до Колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("До колоссян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колоссян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колосяни 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колос 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Col 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Кол 1:1").osis()).toEqual("Col.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO KOLOSJAN 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ДО КОЛОССЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОССЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОСЯНИ 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОС 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("COL 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛ 1:1").osis()).toEqual("Col.1.1")
`
true
describe "Localized book 2Thess (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Thess (uk)", ->
`
expect(p.parse("2-ге. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Druhe poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2Thess 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Сол 1:1").osis()).toEqual("2Thess.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2THESS 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛ 1:1").osis()).toEqual("2Thess.1.1")
`
true
describe "Localized book 1Thess (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Thess (uk)", ->
`
expect(p.parse("1-ше. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Perse poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Perše poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1Thess 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Сол 1:1").osis()).toEqual("1Thess.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1THESS 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛ 1:1").osis()).toEqual("1Thess.1.1")
`
true
describe "Localized book 2Tim (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Tim (uk)", ->
`
expect(p.parse("2-ге. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Druhe poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тим 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2Tim 1:1").osis()).toEqual("2Tim.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2TIM 1:1").osis()).toEqual("2Tim.1.1")
`
true
describe "Localized book 1Tim (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Tim (uk)", ->
`
expect(p.parse("1-ше. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Perse poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Perše poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тим 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1Tim 1:1").osis()).toEqual("1Tim.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1TIM 1:1").osis()).toEqual("1Tim.1.1")
`
true
describe "Localized book Titus (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Titus (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послання св апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Poslannja apostola Pavla do Tyta 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послання апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послан ня до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("До Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Titus 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Тит 1:1").osis()).toEqual("Titus.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO TYTA 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("TITUS 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ТИТ 1:1").osis()).toEqual("Titus.1.1")
`
true
describe "Localized book Phlm (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Phlm (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання св апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Poslannja apostola Pavla do Fylymona 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филипіиців 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филипійців 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("До Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филимон 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филим 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Phlm 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филм 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Флм 1:1").osis()).toEqual("Phlm.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYMONA 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИПІИЦІВ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИПІЙЦІВ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМОН 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("PHLM 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛМ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФЛМ 1:1").osis()).toEqual("Phlm.1.1")
`
true
describe "Localized book Heb (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Heb (uk)", ->
`
expect(p.parse("Poslannja do jevreiv 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Poslannja do jevreïv 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послан ня до Євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послан ня до Євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послання до євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послання до євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("До євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("До євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреі 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреї 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Heb 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євр 1:1").osis()).toEqual("Heb.1.1")
p.include_apocrypha(false)
expect(p.parse("POSLANNJA DO JEVREIV 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("POSLANNJA DO JEVREÏV 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕІ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕЇ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("HEB 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВР 1:1").osis()).toEqual("Heb.1.1")
`
true
describe "Localized book Jas (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jas (uk)", ->
`
expect(p.parse("Соборне послання св. апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Соборне послання св апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Poslannja apostola Jakova 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Послання апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Соборне послання Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Послання Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Яков 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Jas 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Як 1:1").osis()).toEqual("Jas.1.1")
p.include_apocrypha(false)
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("POSLANNJA APOSTOLA JAKOVA 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ПОСЛАННЯ ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯКОВ 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("JAS 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯК 1:1").osis()).toEqual("Jas.1.1")
`
true
describe "Localized book 2Pet (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Pet (uk)", ->
`
expect(p.parse("2-ге. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Druhe poslannja apostola Petra 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петр 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Пет 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Пт 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2Pet 1:1").osis()).toEqual("2Pet.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТР 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТ 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПТ 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2PET 1:1").osis()).toEqual("2Pet.1.1")
`
true
describe "Localized book 1Pet (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Pet (uk)", ->
`
expect(p.parse("1-ше. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Perse poslannja apostola Petra 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Perše poslannja apostola Petra 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петр 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Пет 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Пт 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1Pet 1:1").osis()).toEqual("1Pet.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТР 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТ 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПТ 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1PET 1:1").osis()).toEqual("1Pet.1.1")
`
true
describe "Localized book Jude (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jude (uk)", ->
`
expect(p.parse("Соборне послання св. апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Соборне послання св апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Poslannja apostola Judy 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Соборне послання Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання Іуди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Jude 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Іуд 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юда 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юд 1:1").osis()).toEqual("Jude.1.1")
p.include_apocrypha(false)
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("POSLANNJA APOSTOLA JUDY 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ ІУДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("JUDE 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ІУД 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮДА 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮД 1:1").osis()).toEqual("Jude.1.1")
`
true
describe "Localized book Tob (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Tob (uk)", ->
`
expect(p.parse("Книга Товита 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Товита 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Товит 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Tob 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Тов 1:1").osis()).toEqual("Tob.1.1")
`
true
describe "Localized book Jdt (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jdt (uk)", ->
`
expect(p.parse("Книга Юдити 1:1").osis()).toEqual("Jdt.1.1")
expect(p.parse("Юдити 1:1").osis()).toEqual("Jdt.1.1")
expect(p.parse("Jdt 1:1").osis()).toEqual("Jdt.1.1")
`
true
describe "Localized book Bar (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Bar (uk)", ->
`
expect(p.parse("Варуха 1:1").osis()).toEqual("Bar.1.1")
expect(p.parse("Bar 1:1").osis()).toEqual("Bar.1.1")
expect(p.parse("Вар 1:1").osis()).toEqual("Bar.1.1")
`
true
describe "Localized book Sus (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Sus (uk)", ->
`
expect(p.parse("Сусанна 1:1").osis()).toEqual("Sus.1.1")
expect(p.parse("Sus 1:1").osis()).toEqual("Sus.1.1")
expect(p.parse("Сус 1:1").osis()).toEqual("Sus.1.1")
`
true
describe "Miscellaneous tests", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore", book_sequence_strategy: "ignore", osis_compaction_strategy: "bc", captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should return the expected language", ->
expect(p.languages).toEqual ["uk"]
it "should handle ranges (uk)", ->
expect(p.parse("Titus 1:1 - 2").osis()).toEqual "Titus.1.1-Titus.1.2"
expect(p.parse("Matt 1-2").osis()).toEqual "Matt.1-Matt.2"
expect(p.parse("Phlm 2 - 3").osis()).toEqual "Phlm.1.2-Phlm.1.3"
expect(p.parse("Titus 1:1 до 2").osis()).toEqual "Titus.1.1-Titus.1.2"
expect(p.parse("Matt 1до2").osis()).toEqual "Matt.1-Matt.2"
expect(p.parse("Phlm 2 ДО 3").osis()).toEqual "Phlm.1.2-Phlm.1.3"
it "should handle chapters (uk)", ->
expect(p.parse("Titus 1:1, глави 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛАВИ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, глава 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛАВА 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, гл 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, розділ 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 РОЗДІЛ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, розд 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 РОЗД 6").osis()).toEqual "Matt.3.4,Matt.6"
it "should handle verses (uk)", ->
expect(p.parse("Exod 1:1 вірші 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm ВІРШІ 6").osis()).toEqual "Phlm.1.6"
expect(p.parse("Exod 1:1 вірш 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm ВІРШ 6").osis()).toEqual "Phlm.1.6"
it "should handle 'and' (uk)", ->
expect(p.parse("Exod 1:1 і 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm 2 І 6").osis()).toEqual "Phlm.1.2,Phlm.1.6"
it "should handle titles (uk)", ->
expect(p.parse("Ps 3 title, 4:2, 5:title").osis()).toEqual "Ps.3.1,Ps.4.2,Ps.5.1"
expect(p.parse("PS 3 TITLE, 4:2, 5:TITLE").osis()).toEqual "Ps.3.1,Ps.4.2,Ps.5.1"
it "should handle 'ff' (uk)", ->
expect(p.parse("Rev 3ff, 4:2ff").osis()).toEqual "Rev.3-Rev.22,Rev.4.2-Rev.4.11"
expect(p.parse("REV 3 FF, 4:2 FF").osis()).toEqual "Rev.3-Rev.22,Rev.4.2-Rev.4.11"
it "should handle translations (uk)", ->
expect(p.parse("Lev 1 (ERV)").osis_and_translations()).toEqual [["Lev.1", "ERV"]]
expect(p.parse("lev 1 erv").osis_and_translations()).toEqual [["Lev.1", "ERV"]]
it "should handle book ranges (uk)", ->
p.set_options {book_alone_strategy: "full", book_range_strategy: "include"}
expect(p.parse("Перша - Третя Івана").osis()).toEqual "1John.1-3John.1"
expect(p.parse("Перша до Третя Івана").osis()).toEqual "1John.1-3John.1"
it "should handle boundaries (uk)", ->
p.set_options {book_alone_strategy: "full"}
expect(p.parse("\u2014Matt\u2014").osis()).toEqual "Matt.1-Matt.28"
expect(p.parse("\u201cMatt 1:1\u201d").osis()).toEqual "Matt.1.1"
| 53087 | bcv_parser = require("../../js/uk_bcv_parser.js").bcv_parser
describe "Parsing", ->
p = {}
beforeEach ->
p = new bcv_parser
p.options.osis_compaction_strategy = "b"
p.options.sequence_combination_strategy = "combine"
it "should round-trip OSIS references", ->
p.set_options osis_compaction_strategy: "bc"
books = ["Gen","Exod","Lev","Num","Deut","Josh","Judg","Ruth","1Sam","2Sam","1Kgs","2Kgs","1Chr","2Chr","Ezra","Neh","Esth","Job","Ps","Prov","Eccl","Song","Isa","Jer","Lam","Ezek","<NAME>","<NAME>","<NAME>","<NAME>mos","<NAME>ad","<NAME>","<NAME>","<NAME>ah","Hab","Zeph","Hag","Zech","<NAME>","<NAME>","<NAME>","<NAME>","<NAME>","Acts","Rom","1Cor","2Cor","Gal","Eph","Phil","Col","1Thess","2Thess","1Tim","2Tim","Titus","Phlm","Heb","Jas","1Pet","2Pet","1John","2John","3John","Jude","Rev"]
for book in books
bc = book + ".1"
bcv = bc + ".1"
bcv_range = bcv + "-" + bc + ".2"
expect(p.parse(bc).osis()).toEqual bc
expect(p.parse(bcv).osis()).toEqual bcv
expect(p.parse(bcv_range).osis()).toEqual bcv_range
it "should round-trip OSIS Apocrypha references", ->
p.set_options osis_compaction_strategy: "bc", ps151_strategy: "b"
p.include_apocrypha true
books = ["Tob","Jdt","GkEsth","Wis","Sir","Bar","PrAzar","Sus","Bel","SgThree","EpJer","1Macc","2Macc","3Macc","4Macc","1Esd","2Esd","PrMan","Ps151"]
for book in books
bc = book + ".1"
bcv = bc + ".1"
bcv_range = bcv + "-" + bc + ".2"
expect(p.parse(bc).osis()).toEqual bc
expect(p.parse(bcv).osis()).toEqual bcv
expect(p.parse(bcv_range).osis()).toEqual bcv_range
p.set_options ps151_strategy: "bc"
expect(p.parse("Ps151.1").osis()).toEqual "Ps.151"
expect(p.parse("Ps151.1.1").osis()).toEqual "Ps.151.1"
expect(p.parse("Ps151.1-Ps151.2").osis()).toEqual "Ps.151.1-Ps.151.2"
p.include_apocrypha false
for book in books
bc = book + ".1"
expect(p.parse(bc).osis()).toEqual ""
it "should handle a preceding character", ->
expect(p.parse(" Gen 1").osis()).toEqual "Gen.1"
expect(p.parse("Matt5John3").osis()).toEqual "Matt.5,John.3"
expect(p.parse("1Ps 1").osis()).toEqual ""
expect(p.parse("11Sam 1").osis()).toEqual ""
describe "Localized book Gen (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Gen (uk)", ->
`
expect(p.parse("1-ше. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перша книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перша книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перше книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перше книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Buttja 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Буття 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 М 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Gen 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Буг 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Бут 1:1").osis()).toEqual("Gen.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРША КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРША КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРШЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРШЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("BUTTJA 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУТТЯ 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 М 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("GEN 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУГ 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУТ 1:1").osis()).toEqual("Gen.1.1")
`
true
describe "Localized book Exod (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Exod (uk)", ->
`
expect(p.parse("2-ге. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друга книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друга книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друге книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друге книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Vyhid 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Vyȟid 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Вихід 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Exod 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 М 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Вих 1:1").osis()).toEqual("Exod.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("VYHID 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("VYȞID 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ВИХІД 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("EXOD 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 М 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ВИХ 1:1").osis()).toEqual("Exod.1.1")
`
true
describe "Localized book Bel (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Bel (uk)", ->
`
expect(p.parse("Бел і дракон 1:1").osis()).toEqual("Bel.1.1")
expect(p.parse("Bel 1:1").osis()).toEqual("Bel.1.1")
expect(p.parse("Бел 1:1").osis()).toEqual("Bel.1.1")
`
true
describe "Localized book Lev (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Lev (uk)", ->
`
expect(p.parse("3-тє. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третя книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третя книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третє книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третє книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Levyt 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Левит 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 М 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Lev 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Лев 1:1").osis()).toEqual("Lev.1.1")
p.include_apocrypha(false)
expect(p.parse("3-ТЄ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЯ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЯ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЄ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЄ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("LEVYT 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ЛЕВИТ 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 М 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("LEV 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ЛЕВ 1:1").osis()).toEqual("Lev.1.1")
`
true
describe "Localized book Num (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Num (uk)", ->
`
expect(p.parse("Четверта книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Четверта книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Cysla 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Čysla 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Числа 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Числ 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 М 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Num 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Чис 1:1").osis()).toEqual("Num.1.1")
p.include_apocrypha(false)
expect(p.parse("ЧЕТВЕРТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧЕТВЕРТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("CYSLA 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ČYSLA 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИСЛА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИСЛ 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 М 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("NUM 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИС 1:1").osis()).toEqual("Num.1.1")
`
true
describe "Localized book Sir (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Sir (uk)", ->
`
expect(p.parse("Премудрість Ісуса, сина Сирахова 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Книга Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Бен Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Еклесіаст 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Sir 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Сир 1:1").osis()).toEqual("Sir.1.1")
`
true
describe "Localized book Wis (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Wis (uk)", ->
`
expect(p.parse("Книга Премудрості Соломона 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Премудрість Соломона 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Книга Мудрости 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Мудрости 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Прем 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Wis 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Муд 1:1").osis()).toEqual("Wis.1.1")
`
true
describe "Localized book Lam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Lam (uk)", ->
`
expect(p.parse("Plac Jeremii 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plac Jeremiï 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plač Jeremii 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plač Jeremiï 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач Єреміі 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач Єремії 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Lam 1:1").osis()).toEqual("Lam.1.1")
p.include_apocrypha(false)
expect(p.parse("PLAC JEREMII 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAC JEREMIÏ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAČ JEREMII 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAČ JEREMIÏ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ ЄРЕМІІ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ ЄРЕМІЇ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("LAM 1:1").osis()).toEqual("Lam.1.1")
`
true
describe "Localized book EpJer (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: EpJer (uk)", ->
`
expect(p.parse("Послання Єреміі 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Послання Єремії 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Лист Єреміі 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Лист Єремії 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("EpJer 1:1").osis()).toEqual("EpJer.1.1")
`
true
describe "Localized book Rev (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Rev (uk)", ->
`
expect(p.parse("Об'явлення св. Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св. Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св. Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Иоан<NAME> Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Йоан<NAME> Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Ob'javlennja Ivana Bohoslova 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Ob’javlennja Ivana Bohoslova 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення <NAME> 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення <NAME> 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Одкровення <NAME> 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Відкритт<NAME> 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апока́ліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокaліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокáліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокалiпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокалíпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокаліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Одкриттє 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явл 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явл 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Rev 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об 1:1").osis()).toEqual("Rev.1.1")
p.include_apocrypha(false)
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("OB'JAVLENNJA IVANA BOHOSLOVA 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("OB’JAVLENNJA IVANA BOHOSLOVA 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОДКРОВЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ВІДКРИТТЯ ІВАНА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКА́ЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКAЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКÁЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛIПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛÍПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОДКРИТТЄ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("REV 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ 1:1").osis()).toEqual("Rev.1.1")
`
true
describe "Localized book PrMan (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PrMan (uk)", ->
`
expect(p.parse("PrMan 1:1").osis()).toEqual("PrMan.1.1")
`
true
describe "Localized book Deut (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Deut (uk)", ->
`
expect(p.parse("П'ята книга Моисеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П'ята книга Мойсеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ята книга Моисеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ята книга Мойсеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Povtorennja Zakonu 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повторення Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Второзаконня 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт. Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П. Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П.Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Deut 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Втор 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПЗак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("5 М 1:1").osis()).toEqual("Deut.1.1")
p.include_apocrypha(false)
expect(p.parse("П'ЯТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П'ЯТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ЯТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ЯТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("POVTORENNJA ZAKONU 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТОРЕННЯ ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ВТОРОЗАКОННЯ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ. ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П. ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П.ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("DEUT 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ВТОР 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("5 М 1:1").osis()).toEqual("Deut.1.1")
`
true
describe "Localized book <NAME>osh (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: <NAME>osh (uk)", ->
`
expect(p.parse("Книга Ісуса Навина 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Ісуса Навина 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Книга Єгошуі 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Книга Єгошуї 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Isus Navyn 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Ісус Навин 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єгошуі 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єгошуї 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І. Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Josh 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єг 1:1").osis()).toEqual("Josh.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ІСУСА НАВИНА 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ІСУСА НАВИНА 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("КНИГА ЄГОШУІ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("КНИГА ЄГОШУЇ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ISUS NAVYN 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ІСУС НАВИН 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГОШУІ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГОШУЇ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І. НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("JOSH 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГ 1:1").osis()).toEqual("Josh.1.1")
`
true
describe "Localized book Judg (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Judg (uk)", ->
`
expect(p.parse("Knyha Suddiv 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Книга Суддів 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Суддів 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Judg 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Суд 1:1").osis()).toEqual("Judg.1.1")
p.include_apocrypha(false)
expect(p.parse("KNYHA SUDDIV 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("КНИГА СУДДІВ 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("СУДДІВ 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("JUDG 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("СУД 1:1").osis()).toEqual("Judg.1.1")
`
true
describe "Localized book Ruth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ruth (uk)", ->
`
expect(p.parse("Книга Рут 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Ruth 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Rut 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Рут 1:1").osis()).toEqual("Ruth.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА РУТ 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("RUTH 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("RUT 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("РУТ 1:1").osis()).toEqual("Ruth.1.1")
`
true
describe "Localized book 1Esd (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Esd (uk)", ->
`
expect(p.parse("1-ше. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перша Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перша Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перше Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перше Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Езд 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1Esd 1:1").osis()).toEqual("1Esd.1.1")
`
true
describe "Localized book 2Esd (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Esd (uk)", ->
`
expect(p.parse("2-ге. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Езд 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2Esd 1:1").osis()).toEqual("2Esd.1.1")
`
true
describe "Localized book Isa (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Isa (uk)", ->
`
expect(p.parse("Книга пророка Ісаі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга пророка Ісаї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісаиі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісаиї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісайі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісайї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Isaja 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісая 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісаі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісаї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Isa 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Іс 1:1").osis()).toEqual("Isa.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ІСАІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ПРОРОКА ІСАЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАИІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАИЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАЙІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАЙЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ISAJA 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАЯ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ISA 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІС 1:1").osis()).toEqual("Isa.1.1")
`
true
describe "Localized book 2Sam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Sam (uk)", ->
`
expect(p.parse("2-ге. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Сам 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2Sam 1:1").osis()).toEqual("2Sam.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2SAM 1:1").osis()).toEqual("2Sam.1.1")
`
true
describe "Localized book 1Sam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Sam (uk)", ->
`
expect(p.parse("1-ше. книг<NAME> С<NAME> 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. книга С<NAME>ї<NAME> 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуі<NAME> 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуїл<NAME> 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Сам 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1Sam 1:1").osis()).toEqual("1Sam.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1SAM 1:1").osis()).toEqual("1Sam.1.1")
`
true
describe "Localized book 2Kgs (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Kgs (uk)", ->
`
expect(p.parse("2-ге. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Четверта Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV. Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4. Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4 Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 Цар 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2Kgs 1:1").osis()).toEqual("2Kgs.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ЧЕТВЕРТА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4 ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 ЦАР 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2KGS 1:1").osis()).toEqual("2Kgs.1.1")
`
true
describe "Localized book 1Kgs (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Kgs (uk)", ->
`
expect(p.parse("1-ше. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-тє. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Третя Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Третє Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-а. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-е. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-тє Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-а Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-е Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. Car<NAME> 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3 Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 Цар 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1Kgs 1:1").osis()).toEqual("1Kgs.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-ТЄ. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ТРЕТЯ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ТРЕТЄ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-А. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-Е. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-ТЄ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-А ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-Е ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3 ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 ЦАР 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1KGS 1:1").osis()).toEqual("1Kgs.1.1")
`
true
describe "Localized book 2Chr (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Chr (uk)", ->
`
expect(p.parse("2-ге. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хр 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2Chr 1:1").osis()).toEqual("2Chr.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХР 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2CHR 1:1").osis()).toEqual("2Chr.1.1")
`
true
describe "Localized book 1Chr (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Chr (uk)", ->
`
expect(p.parse("1-ше. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хр 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1Chr 1:1").osis()).toEqual("1Chr.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХР 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1CHR 1:1").osis()).toEqual("1Chr.1.1")
`
true
describe "Localized book Ezra (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ezra (uk)", ->
`
expect(p.parse("Книга Ездри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ezdra 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Єздри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездра 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ezra 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездр 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Єзд 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Езд 1:1").osis()).toEqual("Ezra.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("EZDRA 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЄЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДРА 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("EZRA 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДР 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЄЗД 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗД 1:1").osis()).toEqual("Ezra.1.1")
`
true
describe "Localized book Neh (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Neh (uk)", ->
`
expect(p.parse("Книга Нееміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Книга Неемії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Neemija 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неемія 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Нееміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неемії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неєміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неємії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неем 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неєм 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Neh 1:1").osis()).toEqual("Neh.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА НЕЕМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("КНИГА НЕЕМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("NEEMIJA 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІЯ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("NEH 1:1").osis()).toEqual("Neh.1.1")
`
true
describe "Localized book GkEsth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: GkEsth (uk)", ->
`
expect(p.parse("GkEsth 1:1").osis()).toEqual("GkEsth.1.1")
`
true
describe "Localized book Esth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Esth (uk)", ->
`
expect(p.parse("Книга Естер 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Книга Есфір 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Ester 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Естер 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Есфір 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Esth 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Ест 1:1").osis()).toEqual("Esth.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕСТЕР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("КНИГА ЕСФІР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ESTER 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСТЕР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСФІР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ESTH 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСТ 1:1").osis()).toEqual("Esth.1.1")
`
true
describe "Localized book Job (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Job (uk)", ->
`
expect(p.parse("Книга Іова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Книга Иова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Книга Йова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Іова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Иова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Йова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Job 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Jov 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Иов 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Йов 1:1").osis()).toEqual("Job.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ІОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("КНИГА ИОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("КНИГА ЙОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ІОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ИОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ЙОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("JOB 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("JOV 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ИОВ 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ЙОВ 1:1").osis()).toEqual("Job.1.1")
`
true
describe "Localized book Ps (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ps (uk)", ->
`
expect(p.parse("Книга Псалмів 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалти́р 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалмів 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Psalmy 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалми 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псал 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Ps 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Пс 1:1").osis()).toEqual("Ps.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПСАЛМІВ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛТИ́Р 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛМІВ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("PSALMY 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛМИ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("PS 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПС 1:1").osis()).toEqual("Ps.1.1")
`
true
describe "Localized book PrAzar (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PrAzar (uk)", ->
`
expect(p.parse("Молитва Азаріі 1:1").osis()).toEqual("PrAzar.1.1")
expect(p.parse("Молитва Азарії 1:1").osis()).toEqual("PrAzar.1.1")
expect(p.parse("PrAzar 1:1").osis()).toEqual("PrAzar.1.1")
`
true
describe "Localized book Prov (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Prov (uk)", ->
`
expect(p.parse("Книга Приповістеи Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Книга Приповістей Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Книга Приказок Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістеи соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістей соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притчі Соломона 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістеи 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістей 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Prypovisti 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповідок 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповісті 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приказки 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приказок 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притчі 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притч 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Prov 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Прип 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Пр 1:1").osis()).toEqual("Prov.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРИПОВІСТЕИ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("КНИГА ПРИПОВІСТЕЙ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("КНИГА ПРИКАЗОК СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕИ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕЙ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧІ СОЛОМОНА 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕИ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕЙ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("PRYPOVISTI 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІДОК 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТІ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИКАЗКИ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИКАЗОК 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧІ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("PROV 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИП 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПР 1:1").osis()).toEqual("Prov.1.1")
`
true
describe "Localized book Eccl (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Eccl (uk)", ->
`
expect(p.parse("Книга Екклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Книга Еклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Еклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Проповідника 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Ekklezijast 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіяста 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіяст 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Коге́лет 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Eccl 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Еккл 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екл 1:1").osis()).toEqual("Eccl.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕККЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("КНИГА ЕКЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕКЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ПРОПОВІДНИКА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("EKKLEZIJAST 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("КОГЕ́ЛЕТ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ECCL 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕКЛ 1:1").osis()).toEqual("Eccl.1.1")
`
true
describe "Localized book SgThree (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: SgThree (uk)", ->
`
expect(p.parse("Пісня трьох отроків 1:1").osis()).toEqual("SgThree.1.1")
expect(p.parse("SgThree 1:1").osis()).toEqual("SgThree.1.1")
`
true
describe "Localized book Song (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Song (uk)", ->
`
expect(p.parse("Книга Пісні Пісень Соломона 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня над піснями Соломона 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Pisnja nad pisnjamy 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня над піснями 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня Піснеи 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня Пісней 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісні Пісень 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Song 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісн 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П 1:1").osis()).toEqual("Song.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПІСНІ ПІСЕНЬ СОЛОМОНА 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ НАД ПІСНЯМИ СОЛОМОНА 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("PISNJA NAD PISNJAMY 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ НАД ПІСНЯМИ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ ПІСНЕИ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ ПІСНЕЙ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНІ ПІСЕНЬ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("SONG 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСН 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П 1:1").osis()).toEqual("Song.1.1")
`
true
describe "Localized book Jer (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jer (uk)", ->
`
expect(p.parse("Книга пророка Єреміі 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Книга пророка Єремії 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Jeremija 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єремія 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єреміі 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єремії 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єрем 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Jer 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єр 1:1").osis()).toEqual("Jer.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЄРЕМІІ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("КНИГА ПРОРОКА ЄРЕМІЇ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("JEREMIJA 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІЯ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІІ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІЇ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("JER 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄР 1:1").osis()).toEqual("Jer.1.1")
`
true
describe "Localized book Ezek (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ezek (uk)", ->
`
expect(p.parse("Книга пророка Єзекііля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Книга пророка Єзекіїля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiil' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiil’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiïl' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiïl’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііла 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііль 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїла 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїль 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Ezek 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзек 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єз 1:1").osis()).toEqual("Ezek.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЄЗЕКІІЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("КНИГА ПРОРОКА ЄЗЕКІЇЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIIL' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIIL’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIÏL' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIÏL’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛА 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛЬ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛА 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛЬ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("EZEK 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕК 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗ 1:1").osis()).toEqual("Ezek.1.1")
`
true
describe "Localized book <NAME> (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: <NAME> (uk)", ->
`
expect(p.parse("Книга пророка Даниіла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Книга пророка Даниїла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниіла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниїла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Danyil 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Danyïl 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниіл 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниїл 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Dan 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Дан 1:1").osis()).toEqual("Dan.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ДАНИІЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("КНИГА ПРОРОКА ДАНИЇЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИІЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИЇЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DANYIL 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DANYÏL 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИІЛ 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИЇЛ 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DAN 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАН 1:1").osis()).toEqual("Dan.1.1")
`
true
describe "Localized book Hos (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hos (uk)", ->
`
expect(p.parse("Книга пророка Осіі 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Книга пророка Осії 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Osija 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осія 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осіі 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осії 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Hos 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Ос 1:1").osis()).toEqual("Hos.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ОСІІ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("КНИГА ПРОРОКА ОСІЇ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("OSIJA 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІЯ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІІ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІЇ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("HOS 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОС 1:1").osis()).toEqual("Hos.1.1")
`
true
describe "Localized book Joel (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: <NAME> (uk)", ->
`
expect(p.parse("Книга пророка Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга пророка Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joel 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joil 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joïl 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоіл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоін 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїн 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоіл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоін 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїн 1:1").osis()).toEqual("Joel.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ПРОРОКА ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOEL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOIL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOÏL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇН 1:1").osis()).toEqual("Joel.1.1")
`
true
describe "Localized book Amos (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Amos (uk)", ->
`
expect(p.parse("Книга пророка Амоса 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Амоса 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Amos 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Амос 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Ам 1:1").osis()).toEqual("Amos.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АМОСА 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМОСА 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("AMOS 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМОС 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМ 1:1").osis()).toEqual("Amos.1.1")
`
true
describe "Localized book Obad (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Obad (uk)", ->
`
expect(p.parse("Книга пророка Авдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Книга пророка Овдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Ovdij 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Авдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдіи 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдій 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Obad 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Авд 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овд 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Ов 1:1").osis()).toEqual("Obad.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("КНИГА ПРОРОКА ОВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("OVDIJ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("АВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІИ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІЙ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("OBAD 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("АВД 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВД 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВ 1:1").osis()).toEqual("Obad.1.1")
`
true
describe "Localized book Jonah (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jonah (uk)", ->
`
expect(p.parse("Книга пророка Иони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Книга пророка Йони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Jonah 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Jona 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Иона 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Иони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йона 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Ион 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йон 1:1").osis()).toEqual("Jonah.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ИОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("КНИГА ПРОРОКА ЙОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("JONAH 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("JONA 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОНА 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОНА 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОН 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОН 1:1").osis()).toEqual("Jonah.1.1")
`
true
describe "Localized book Mic (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mic (uk)", ->
`
expect(p.parse("Книга пророка Михея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Книга пророка Міхея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Myhej 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Myȟej 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михеи 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михей 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Міхея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Mic 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Мих 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Міх 1:1").osis()).toEqual("Mic.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА МИХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("КНИГА ПРОРОКА МІХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MYHEJ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MYȞEJ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕИ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕЙ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МІХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MIC 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МІХ 1:1").osis()).toEqual("Mic.1.1")
`
true
describe "Localized book Nah (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Nah (uk)", ->
`
expect(p.parse("Книга пророка Наума 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Наума 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Naum 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Наум 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Nah 1:1").osis()).toEqual("Nah.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА НАУМА 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("НАУМА 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("NAUM 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("НАУМ 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("NAH 1:1").osis()).toEqual("Nah.1.1")
`
true
describe "Localized book Hab (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hab (uk)", ->
`
expect(p.parse("Книга пророка Авакума 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Авакума 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Avakum 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Авакум 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Hab 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Ав 1:1").osis()).toEqual("Hab.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АВАКУМА 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВАКУМА 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("AVAKUM 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВАКУМ 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("HAB 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВ 1:1").osis()).toEqual("Hab.1.1")
`
true
describe "Localized book Zeph (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Zeph (uk)", ->
`
expect(p.parse("Книга пророка Софоніі 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Книга пророка Софонії 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Sofonija 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софонія 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софоніі 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софонії 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Zeph 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Соф 1:1").osis()).toEqual("Zeph.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА СОФОНІІ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("КНИГА ПРОРОКА СОФОНІЇ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("SOFONIJA 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІЯ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІІ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІЇ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("ZEPH 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФ 1:1").osis()).toEqual("Zeph.1.1")
`
true
describe "Localized book Hag (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hag (uk)", ->
`
expect(p.parse("Книга пророка Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Книга Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Аггея 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Ohij 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огіи 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огій 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Hag 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Аг 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Ог 1:1").osis()).toEqual("Hag.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("КНИГА ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("АГГЕЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("OHIJ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІИ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІЙ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("HAG 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("АГ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГ 1:1").osis()).toEqual("Hag.1.1")
`
true
describe "Localized book Zech (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Zech (uk)", ->
`
expect(p.parse("Книга пророка Захарія 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Книга Захаріі 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Книга Захарії 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zaharij 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zaȟarij 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захаріи 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарій 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарія 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захаріі 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарії 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zech 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Зах 1:1").osis()).toEqual("Zech.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЗАХАРІЯ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("КНИГА ЗАХАРІІ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("КНИГА ЗАХАРІЇ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZAHARIJ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZAȞARIJ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІИ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЙ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЯ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІІ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЇ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZECH 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХ 1:1").osis()).toEqual("Zech.1.1")
`
true
describe "Localized book Mal (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mal (uk)", ->
`
expect(p.parse("Книга пророка Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга пророка Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Malahija 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Malaȟija 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахія 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Mal 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Мал 1:1").osis()).toEqual("Mal.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА ПРОРОКА МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MALAHIJA 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MALAȞIJA 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІЯ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MAL 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛ 1:1").osis()).toEqual("Mal.1.1")
`
true
describe "Localized book Matt (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Matt (uk)", ->
`
expect(p.parse("Євангелія від св. Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від св. Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Jevanhelije vid Matvija 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангелія від св Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від св Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангелія від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від Матея 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матеи 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матей 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Matt 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матв 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Мат 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Мт 1:1").osis()).toEqual("Matt.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("JEVANHELIJE VID MATVIJA 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАТЕЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТЕИ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТЕЙ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("MATT 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТВ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МТ 1:1").osis()).toEqual("Matt.1.1")
`
true
describe "Localized book 2Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Macc (uk)", ->
`
expect(p.parse("2-ге. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Мак 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2Macc 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Мк 1:1").osis()).toEqual("2Macc.1.1")
`
true
describe "Localized book 3Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 3Macc (uk)", ->
`
expect(p.parse("3-тє. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Мак 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3Macc 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Мк 1:1").osis()).toEqual("3Macc.1.1")
`
true
describe "Localized book 4Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 4Macc (uk)", ->
`
expect(p.parse("Четверта книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Мак 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4Macc 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Мк 1:1").osis()).toEqual("4Macc.1.1")
`
true
describe "Localized book 1Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Macc (uk)", ->
`
expect(p.parse("1-ше. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("П<NAME> 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("П<NAME> Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Мак 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1Macc 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Мк 1:1").osis()).toEqual("1Macc.1.1")
`
true
describe "Localized book Mark (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mark (uk)", ->
`
expect(p.parse("Євангелія від св. Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від св. Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангелія від св Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від св Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Jevanhelije vid Marka 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангелія від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Марко 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Mark 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Мк 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Мр 1:1").osis()).toEqual("Mark.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("JEVANHELIJE VID MARKA 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МАРКО 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("MARK 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МК 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МР 1:1").osis()).toEqual("Mark.1.1")
`
true
describe "Localized book <NAME> (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: <NAME> (uk)", ->
`
expect(p.parse("Євангелія від св. Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від св. Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангелія від св Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від св Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Jevanhelije vid Luky 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від Лу ки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангелія від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Luke 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Лука 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Лк 1:1").osis()).toEqual("Luke.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("JEVANHELIJE VID LUKY 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ЛУ КИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("LUKE 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛУКА 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛК 1:1").osis()).toEqual("Luke.1.1")
`
true
describe "Localized book 1John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1John (uk)", ->
`
expect(p.parse("1-ше. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Perse poslannja apostola Ivana 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Perše poslannja apostola Ivana 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Ів<NAME> 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. <NAME> 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1John 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Ів 1:1").osis()).toEqual("1John.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1JOHN 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІВ 1:1").osis()).toEqual("1John.1.1")
`
true
describe "Localized book 2John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2John (uk)", ->
`
expect(p.parse("2-ге. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Druhe poslannja apostola Ivana 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Послання до Тита 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2John 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Ів 1:1").osis()).toEqual("2John.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ПОСЛАННЯ ДО ТИТА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2JOHN 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІВ 1:1").osis()).toEqual("2John.1.1")
`
true
describe "Localized book 3John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 3John (uk)", ->
`
expect(p.parse("3-тє. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Tretje poslannja apostola Ivana 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3John 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Ів 1:1").osis()).toEqual("3John.1.1")
p.include_apocrypha(false)
expect(p.parse("3-ТЄ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("TRETJE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3JOHN 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІВ 1:1").osis()).toEqual("3John.1.1")
`
true
describe "Localized book <NAME> (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: <NAME> (uk)", ->
`
expect(p.parse("Євангелія від св. Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св. Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св. Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангелія від св Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Jevanhelije vid Ivana 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангелія від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("John 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Иоан 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Йоан 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Ів 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Ін 1:1").osis()).toEqual("John.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("JEVANHELIJE VID IVANA 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("JOHN 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ИОАН 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЙОАН 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІВ 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІН 1:1").osis()).toEqual("John.1.1")
`
true
describe "Localized book Acts (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Acts (uk)", ->
`
expect(p.parse("Dijannja svjatyh apostoliv 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Dijannja svjatyȟ apostoliv 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діяння Святих Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі святих апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії святих апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діяння 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Acts 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діян 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії 1:1").osis()).toEqual("Acts.1.1")
p.include_apocrypha(false)
expect(p.parse("DIJANNJA SVJATYH APOSTOLIV 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("DIJANNJA SVJATYȞ APOSTOLIV 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯННЯ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯННЯ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ACTS 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯН 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ 1:1").osis()).toEqual("Acts.1.1")
`
true
describe "Localized book Rom (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Rom (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання св апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Poslannja apostola Pavla do rymljan 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("До римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римляни 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римл 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Rom 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Рим 1:1").osis()).toEqual("Rom.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO RYMLJAN 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛЯНИ 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛ 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ROM 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМ 1:1").osis()).toEqual("Rom.1.1")
`
true
describe "Localized book 2Cor (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Cor (uk)", ->
`
expect(p.parse("Druhe poslannja apostola <NAME>avla do korynfjan 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Кор 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2Cor 1:1").osis()).toEqual("2Cor.1.1")
p.include_apocrypha(false)
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОР 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2COR 1:1").osis()).toEqual("2Cor.1.1")
`
true
describe "Localized book 1Cor (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Cor (uk)", ->
`
expect(p.parse("Perse poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Perše poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Кор 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1Cor 1:1").osis()).toEqual("1Cor.1.1")
p.include_apocrypha(false)
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОР 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1COR 1:1").osis()).toEqual("1Cor.1.1")
`
true
describe "Localized book Gal (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Gal (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання св апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Poslannja apostola Pavla do halativ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("По слання до Галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("До галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Галатяни 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Gal 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Гал 1:1").osis()).toEqual("Gal.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO HALATIV 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПО СЛАННЯ ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛАТЯНИ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("GAL 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛ 1:1").osis()).toEqual("Gal.1.1")
`
true
describe "Localized book Eph (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Eph (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання св апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Poslannja apostola Pavla do efesjan 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("По слан ня до Єфесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("До ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефесяни 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефес 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Eph 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Єф 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Еф 1:1").osis()).toEqual("Eph.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO EFESJAN 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПО СЛАН НЯ ДО ЄФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕСЯНИ 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕС 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("EPH 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЄФ 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФ 1:1").osis()).toEqual("Eph.1.1")
`
true
describe "Localized book Phil (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Phil (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св. апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Poslannja apostola Pavla do fylyp'jan 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Poslannja apostola Pavla do fylyp’jan 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до Філіп'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до Філіп’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("До филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("До филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип'яни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип’яни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филипяни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Phil 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филп 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Фил 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Флп 1:1").osis()).toEqual("Phil.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYP'JAN 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYP’JAN 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФІЛІП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФІЛІП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП'ЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП’ЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИПЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("PHIL 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛП 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФЛП 1:1").osis()).toEqual("Phil.1.1")
`
true
describe "Localized book Col (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Col (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання св апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Poslannja apostola Pavla do kolosjan 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання до Колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("До колоссян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колоссян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колосяни 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колос 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Col 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Кол 1:1").osis()).toEqual("Col.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO KOLOSJAN 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ДО КОЛОССЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОССЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОСЯНИ 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОС 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("COL 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛ 1:1").osis()).toEqual("Col.1.1")
`
true
describe "Localized book 2Thess (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Thess (uk)", ->
`
expect(p.parse("2-ге. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Druhe poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2Thess 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Сол 1:1").osis()).toEqual("2Thess.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2THESS 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛ 1:1").osis()).toEqual("2Thess.1.1")
`
true
describe "Localized book 1Thess (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Thess (uk)", ->
`
expect(p.parse("1-ше. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Perse poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Perše poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1Thess 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Сол 1:1").osis()).toEqual("1Thess.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1THESS 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛ 1:1").osis()).toEqual("1Thess.1.1")
`
true
describe "Localized book 2Tim (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Tim (uk)", ->
`
expect(p.parse("2-ге. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Druhe poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тим 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2Tim 1:1").osis()).toEqual("2Tim.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2TIM 1:1").osis()).toEqual("2Tim.1.1")
`
true
describe "Localized book 1Tim (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Tim (uk)", ->
`
expect(p.parse("1-ше. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Perse poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Perše poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тим 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1Tim 1:1").osis()).toEqual("1Tim.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1TIM 1:1").osis()).toEqual("1Tim.1.1")
`
true
describe "Localized book Titus (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Titus (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послання св апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Poslannja apostola Pavla do Tyta 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послання апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послан ня до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("До Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Titus 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Тит 1:1").osis()).toEqual("Titus.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO TYTA 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("TITUS 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ТИТ 1:1").osis()).toEqual("Titus.1.1")
`
true
describe "Localized book Phlm (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Phlm (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання св апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Poslannja apostola Pavla do Fylymona 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филипіиців 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филипійців 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("До Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филимон 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филим 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Phlm 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филм 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Флм 1:1").osis()).toEqual("Phlm.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYMONA 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИПІИЦІВ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИПІЙЦІВ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМОН 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("PHLM 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛМ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФЛМ 1:1").osis()).toEqual("Phlm.1.1")
`
true
describe "Localized book Heb (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Heb (uk)", ->
`
expect(p.parse("Poslannja do jevreiv 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Poslannja do jevreïv 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послан ня до Євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послан ня до Євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послання до євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послання до євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("До євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("До євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреі 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреї 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Heb 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євр 1:1").osis()).toEqual("Heb.1.1")
p.include_apocrypha(false)
expect(p.parse("POSLANNJA DO JEVREIV 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("POSLANNJA DO JEVREÏV 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕІ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕЇ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("HEB 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВР 1:1").osis()).toEqual("Heb.1.1")
`
true
describe "Localized book Jas (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jas (uk)", ->
`
expect(p.parse("Соборне послання св. апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Соборне послання св апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Poslannja apostola Jakova 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Послання апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Соборне послання Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Послання Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Яков 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Jas 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Як 1:1").osis()).toEqual("Jas.1.1")
p.include_apocrypha(false)
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("POSLANNJA APOSTOLA JAKOVA 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ПОСЛАННЯ ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯКОВ 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("JAS 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯК 1:1").osis()).toEqual("Jas.1.1")
`
true
describe "Localized book 2Pet (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Pet (uk)", ->
`
expect(p.parse("2-ге. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Druhe poslannja apostola Petra 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петр 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Пет 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Пт 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2Pet 1:1").osis()).toEqual("2Pet.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТР 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТ 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПТ 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2PET 1:1").osis()).toEqual("2Pet.1.1")
`
true
describe "Localized book 1Pet (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Pet (uk)", ->
`
expect(p.parse("1-ше. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Perse poslannja apostola Petra 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Perše poslannja apostola Petra 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петр 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Пет 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Пт 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1Pet 1:1").osis()).toEqual("1Pet.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТР 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТ 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПТ 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1PET 1:1").osis()).toEqual("1Pet.1.1")
`
true
describe "Localized book Jude (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jude (uk)", ->
`
expect(p.parse("Соборне послання св. апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Соборне послання св апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Poslannja apostola Judy 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Соборне послання Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання Іуди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Jude 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Іуд 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юда 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юд 1:1").osis()).toEqual("Jude.1.1")
p.include_apocrypha(false)
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("POSLANNJA APOSTOLA JUDY 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ ІУДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("JUDE 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ІУД 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮДА 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮД 1:1").osis()).toEqual("Jude.1.1")
`
true
describe "Localized book Tob (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Tob (uk)", ->
`
expect(p.parse("Книга Товита 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Товита 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Товит 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Tob 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Тов 1:1").osis()).toEqual("Tob.1.1")
`
true
describe "Localized book Jdt (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jdt (uk)", ->
`
expect(p.parse("Книга Юдити 1:1").osis()).toEqual("Jdt.1.1")
expect(p.parse("Юдити 1:1").osis()).toEqual("Jdt.1.1")
expect(p.parse("Jdt 1:1").osis()).toEqual("Jdt.1.1")
`
true
describe "Localized book Bar (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Bar (uk)", ->
`
expect(p.parse("Варуха 1:1").osis()).toEqual("Bar.1.1")
expect(p.parse("Bar 1:1").osis()).toEqual("Bar.1.1")
expect(p.parse("Вар 1:1").osis()).toEqual("Bar.1.1")
`
true
describe "Localized book Sus (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Sus (uk)", ->
`
expect(p.parse("Сусанна 1:1").osis()).toEqual("Sus.1.1")
expect(p.parse("Sus 1:1").osis()).toEqual("Sus.1.1")
expect(p.parse("Сус 1:1").osis()).toEqual("Sus.1.1")
`
true
describe "Miscellaneous tests", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore", book_sequence_strategy: "ignore", osis_compaction_strategy: "bc", captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should return the expected language", ->
expect(p.languages).toEqual ["uk"]
it "should handle ranges (uk)", ->
expect(p.parse("Titus 1:1 - 2").osis()).toEqual "Titus.1.1-Titus.1.2"
expect(p.parse("Matt 1-2").osis()).toEqual "Matt.1-Matt.2"
expect(p.parse("Phlm 2 - 3").osis()).toEqual "Phlm.1.2-Phlm.1.3"
expect(p.parse("Titus 1:1 до 2").osis()).toEqual "Titus.1.1-Titus.1.2"
expect(p.parse("Matt 1до2").osis()).toEqual "Matt.1-Matt.2"
expect(p.parse("Phlm 2 ДО 3").osis()).toEqual "Phlm.1.2-Phlm.1.3"
it "should handle chapters (uk)", ->
expect(p.parse("Titus 1:1, глави 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛАВИ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, глава 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛАВА 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, гл 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, розділ 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 РОЗДІЛ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, розд 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 РОЗД 6").osis()).toEqual "Matt.3.4,Matt.6"
it "should handle verses (uk)", ->
expect(p.parse("Exod 1:1 вірші 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm ВІРШІ 6").osis()).toEqual "Phlm.1.6"
expect(p.parse("Exod 1:1 вірш 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm ВІРШ 6").osis()).toEqual "Phlm.1.6"
it "should handle 'and' (uk)", ->
expect(p.parse("Exod 1:1 і 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm 2 І 6").osis()).toEqual "Phlm.1.2,Phlm.1.6"
it "should handle titles (uk)", ->
expect(p.parse("Ps 3 title, 4:2, 5:title").osis()).toEqual "Ps.3.1,Ps.4.2,Ps.5.1"
expect(p.parse("PS 3 TITLE, 4:2, 5:TITLE").osis()).toEqual "Ps.3.1,Ps.4.2,Ps.5.1"
it "should handle 'ff' (uk)", ->
expect(p.parse("Rev 3ff, 4:2ff").osis()).toEqual "Rev.3-Rev.22,Rev.4.2-Rev.4.11"
expect(p.parse("REV 3 FF, 4:2 FF").osis()).toEqual "Rev.3-Rev.22,Rev.4.2-Rev.4.11"
it "should handle translations (uk)", ->
expect(p.parse("Lev 1 (ERV)").osis_and_translations()).toEqual [["Lev.1", "ERV"]]
expect(p.parse("lev 1 erv").osis_and_translations()).toEqual [["Lev.1", "ERV"]]
it "should handle book ranges (uk)", ->
p.set_options {book_alone_strategy: "full", book_range_strategy: "include"}
expect(p.parse("Перша - Третя Івана").osis()).toEqual "1John.1-3John.1"
expect(p.parse("Перша до Третя Івана").osis()).toEqual "1John.1-3John.1"
it "should handle boundaries (uk)", ->
p.set_options {book_alone_strategy: "full"}
expect(p.parse("\u2014Matt\u2014").osis()).toEqual "Matt.1-Matt.28"
expect(p.parse("\u201cMatt 1:1\u201d").osis()).toEqual "Matt.1.1"
| true | bcv_parser = require("../../js/uk_bcv_parser.js").bcv_parser
describe "Parsing", ->
p = {}
beforeEach ->
p = new bcv_parser
p.options.osis_compaction_strategy = "b"
p.options.sequence_combination_strategy = "combine"
it "should round-trip OSIS references", ->
p.set_options osis_compaction_strategy: "bc"
books = ["Gen","Exod","Lev","Num","Deut","Josh","Judg","Ruth","1Sam","2Sam","1Kgs","2Kgs","1Chr","2Chr","Ezra","Neh","Esth","Job","Ps","Prov","Eccl","Song","Isa","Jer","Lam","Ezek","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PImos","PI:NAME:<NAME>END_PIad","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PIah","Hab","Zeph","Hag","Zech","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","PI:NAME:<NAME>END_PI","Acts","Rom","1Cor","2Cor","Gal","Eph","Phil","Col","1Thess","2Thess","1Tim","2Tim","Titus","Phlm","Heb","Jas","1Pet","2Pet","1John","2John","3John","Jude","Rev"]
for book in books
bc = book + ".1"
bcv = bc + ".1"
bcv_range = bcv + "-" + bc + ".2"
expect(p.parse(bc).osis()).toEqual bc
expect(p.parse(bcv).osis()).toEqual bcv
expect(p.parse(bcv_range).osis()).toEqual bcv_range
it "should round-trip OSIS Apocrypha references", ->
p.set_options osis_compaction_strategy: "bc", ps151_strategy: "b"
p.include_apocrypha true
books = ["Tob","Jdt","GkEsth","Wis","Sir","Bar","PrAzar","Sus","Bel","SgThree","EpJer","1Macc","2Macc","3Macc","4Macc","1Esd","2Esd","PrMan","Ps151"]
for book in books
bc = book + ".1"
bcv = bc + ".1"
bcv_range = bcv + "-" + bc + ".2"
expect(p.parse(bc).osis()).toEqual bc
expect(p.parse(bcv).osis()).toEqual bcv
expect(p.parse(bcv_range).osis()).toEqual bcv_range
p.set_options ps151_strategy: "bc"
expect(p.parse("Ps151.1").osis()).toEqual "Ps.151"
expect(p.parse("Ps151.1.1").osis()).toEqual "Ps.151.1"
expect(p.parse("Ps151.1-Ps151.2").osis()).toEqual "Ps.151.1-Ps.151.2"
p.include_apocrypha false
for book in books
bc = book + ".1"
expect(p.parse(bc).osis()).toEqual ""
it "should handle a preceding character", ->
expect(p.parse(" Gen 1").osis()).toEqual "Gen.1"
expect(p.parse("Matt5John3").osis()).toEqual "Matt.5,John.3"
expect(p.parse("1Ps 1").osis()).toEqual ""
expect(p.parse("11Sam 1").osis()).toEqual ""
describe "Localized book Gen (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Gen (uk)", ->
`
expect(p.parse("1-ше. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перша книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перша книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перше книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Перше книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ше книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-а книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-е книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I книга Моисеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I книга Мойсеева 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Buttja 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Буття 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 М 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Gen 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Буг 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("Бут 1:1").osis()).toEqual("Gen.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРША КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРША КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРШЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("ПЕРШЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-ШЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("I КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("BUTTJA 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУТТЯ 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("1 М 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("GEN 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУГ 1:1").osis()).toEqual("Gen.1.1")
expect(p.parse("БУТ 1:1").osis()).toEqual("Gen.1.1")
`
true
describe "Localized book Exod (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Exod (uk)", ->
`
expect(p.parse("2-ге. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друга книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друга книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друге книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Друге книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ге книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-а книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-е книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 книга Моисеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 книга Мойсеева 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Vyhid 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Vyȟid 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Вихід 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Exod 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 М 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("Вих 1:1").osis()).toEqual("Exod.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ДРУГЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-ГЕ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("II КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("VYHID 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("VYȞID 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ВИХІД 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("EXOD 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("2 М 1:1").osis()).toEqual("Exod.1.1")
expect(p.parse("ВИХ 1:1").osis()).toEqual("Exod.1.1")
`
true
describe "Localized book Bel (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Bel (uk)", ->
`
expect(p.parse("Бел і дракон 1:1").osis()).toEqual("Bel.1.1")
expect(p.parse("Bel 1:1").osis()).toEqual("Bel.1.1")
expect(p.parse("Бел 1:1").osis()).toEqual("Bel.1.1")
`
true
describe "Localized book Lev (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Lev (uk)", ->
`
expect(p.parse("3-тє. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третя книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третя книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третє книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Третє книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-тє книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-а книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-е книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 книга Моисеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 книга Мойсеева 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Levyt 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Левит 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 М 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Lev 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("Лев 1:1").osis()).toEqual("Lev.1.1")
p.include_apocrypha(false)
expect(p.parse("3-ТЄ. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЯ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЯ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЄ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ТРЕТЄ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-ТЄ КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-А КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3-Е КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("III КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("LEVYT 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ЛЕВИТ 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("3 М 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("LEV 1:1").osis()).toEqual("Lev.1.1")
expect(p.parse("ЛЕВ 1:1").osis()).toEqual("Lev.1.1")
`
true
describe "Localized book Num (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Num (uk)", ->
`
expect(p.parse("Четверта книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Четверта книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 книга Моисеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 книга Мойсеева 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Cysla 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Čysla 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Числа 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Числ 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 М 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Num 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("Чис 1:1").osis()).toEqual("Num.1.1")
p.include_apocrypha(false)
expect(p.parse("ЧЕТВЕРТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧЕТВЕРТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4. КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("IV КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("CYSLA 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ČYSLA 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИСЛА 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИСЛ 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("4 М 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("NUM 1:1").osis()).toEqual("Num.1.1")
expect(p.parse("ЧИС 1:1").osis()).toEqual("Num.1.1")
`
true
describe "Localized book Sir (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Sir (uk)", ->
`
expect(p.parse("Премудрість Ісуса, сина Сирахова 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Книга Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Бен Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Еклесіаст 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Сираха 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Sir 1:1").osis()).toEqual("Sir.1.1")
expect(p.parse("Сир 1:1").osis()).toEqual("Sir.1.1")
`
true
describe "Localized book Wis (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Wis (uk)", ->
`
expect(p.parse("Книга Премудрості Соломона 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Премудрість Соломона 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Книга Мудрости 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Мудрости 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Прем 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Wis 1:1").osis()).toEqual("Wis.1.1")
expect(p.parse("Муд 1:1").osis()).toEqual("Wis.1.1")
`
true
describe "Localized book Lam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Lam (uk)", ->
`
expect(p.parse("Plac Jeremii 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plac Jeremiï 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plač Jeremii 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Plač Jeremiï 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач Єреміі 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач Єремії 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Плач 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("Lam 1:1").osis()).toEqual("Lam.1.1")
p.include_apocrypha(false)
expect(p.parse("PLAC JEREMII 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAC JEREMIÏ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAČ JEREMII 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("PLAČ JEREMIÏ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ ЄРЕМІІ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ ЄРЕМІЇ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("ПЛАЧ 1:1").osis()).toEqual("Lam.1.1")
expect(p.parse("LAM 1:1").osis()).toEqual("Lam.1.1")
`
true
describe "Localized book EpJer (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: EpJer (uk)", ->
`
expect(p.parse("Послання Єреміі 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Послання Єремії 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Лист Єреміі 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("Лист Єремії 1:1").osis()).toEqual("EpJer.1.1")
expect(p.parse("EpJer 1:1").osis()).toEqual("EpJer.1.1")
`
true
describe "Localized book Rev (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Rev (uk)", ->
`
expect(p.parse("Об'явлення св. Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св. Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св. Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. ИоанPI:NAME:<NAME>END_PI Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св. ЙоанPI:NAME:<NAME>END_PI Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення св Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Івана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Иоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення св Йоана Богослова 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Ob'javlennja Ivana Bohoslova 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Ob’javlennja Ivana Bohoslova 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення PI:NAME:<NAME>END_PI 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення PI:NAME:<NAME>END_PI 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Одкровення PI:NAME:<NAME>END_PI 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ВідкриттPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апока́ліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокaліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокáліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокалiпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокалíпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Апокаліпсис 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явлення 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явлення 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Одкриттє 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об'явл 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об’явл 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Rev 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("Об 1:1").osis()).toEqual("Rev.1.1")
p.include_apocrypha(false)
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ. ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ. ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ СВ ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ИОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ СВ ЙОАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("OB'JAVLENNJA IVANA BOHOSLOVA 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("OB’JAVLENNJA IVANA BOHOSLOVA 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОДКРОВЕННЯ ІВАНА БОГОСЛОВА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ВІДКРИТТЯ ІВАНА 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКА́ЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКAЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКÁЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛIПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛÍПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("АПОКАЛІПСИС 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛЕННЯ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛЕННЯ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОДКРИТТЄ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ'ЯВЛ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ’ЯВЛ 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("REV 1:1").osis()).toEqual("Rev.1.1")
expect(p.parse("ОБ 1:1").osis()).toEqual("Rev.1.1")
`
true
describe "Localized book PrMan (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PrMan (uk)", ->
`
expect(p.parse("PrMan 1:1").osis()).toEqual("PrMan.1.1")
`
true
describe "Localized book Deut (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Deut (uk)", ->
`
expect(p.parse("П'ята книга Моисеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П'ята книга Мойсеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ята книга Моисеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ята книга Мойсеева 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Povtorennja Zakonu 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повторення Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Второзаконня 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт. Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт Закону 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П. Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П.Зак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Deut 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Втор 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПЗак 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("Повт 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("5 М 1:1").osis()).toEqual("Deut.1.1")
p.include_apocrypha(false)
expect(p.parse("П'ЯТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П'ЯТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ЯТА КНИГА МОИСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П’ЯТА КНИГА МОЙСЕЕВА 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("POVTORENNJA ZAKONU 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТОРЕННЯ ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ВТОРОЗАКОННЯ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ. ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ ЗАКОНУ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П. ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("П.ЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("DEUT 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ВТОР 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПЗАК 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("ПОВТ 1:1").osis()).toEqual("Deut.1.1")
expect(p.parse("5 М 1:1").osis()).toEqual("Deut.1.1")
`
true
describe "Localized book PI:NAME:<NAME>END_PIosh (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PI:NAME:<NAME>END_PIosh (uk)", ->
`
expect(p.parse("Книга Ісуса Навина 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Ісуса Навина 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Книга Єгошуі 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Книга Єгошуї 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Isus Navyn 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Ісус Навин 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єгошуі 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єгошуї 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І. Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Josh 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Нав 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("Єг 1:1").osis()).toEqual("Josh.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ІСУСА НАВИНА 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ІСУСА НАВИНА 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("КНИГА ЄГОШУІ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("КНИГА ЄГОШУЇ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ISUS NAVYN 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ІСУС НАВИН 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГОШУІ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГОШУЇ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І. НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("І НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("JOSH 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("НАВ 1:1").osis()).toEqual("Josh.1.1")
expect(p.parse("ЄГ 1:1").osis()).toEqual("Josh.1.1")
`
true
describe "Localized book Judg (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Judg (uk)", ->
`
expect(p.parse("Knyha Suddiv 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Книга Суддів 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Суддів 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Judg 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("Суд 1:1").osis()).toEqual("Judg.1.1")
p.include_apocrypha(false)
expect(p.parse("KNYHA SUDDIV 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("КНИГА СУДДІВ 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("СУДДІВ 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("JUDG 1:1").osis()).toEqual("Judg.1.1")
expect(p.parse("СУД 1:1").osis()).toEqual("Judg.1.1")
`
true
describe "Localized book Ruth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ruth (uk)", ->
`
expect(p.parse("Книга Рут 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Ruth 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Rut 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("Рут 1:1").osis()).toEqual("Ruth.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА РУТ 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("RUTH 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("RUT 1:1").osis()).toEqual("Ruth.1.1")
expect(p.parse("РУТ 1:1").osis()).toEqual("Ruth.1.1")
`
true
describe "Localized book 1Esd (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Esd (uk)", ->
`
expect(p.parse("1-ше. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перша Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перша Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перше Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("Перше Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-ше Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-а Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1-е Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I. Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I. Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I Ездра 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("I Ездри 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1 Езд 1:1").osis()).toEqual("1Esd.1.1")
expect(p.parse("1Esd 1:1").osis()).toEqual("1Esd.1.1")
`
true
describe "Localized book 2Esd (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Esd (uk)", ->
`
expect(p.parse("2-ге. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 книга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друга Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("Друге Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-ге Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-а Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2-е Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2. Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("II Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Ездра 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Ездри 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2 Езд 1:1").osis()).toEqual("2Esd.1.1")
expect(p.parse("2Esd 1:1").osis()).toEqual("2Esd.1.1")
`
true
describe "Localized book Isa (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Isa (uk)", ->
`
expect(p.parse("Книга пророка Ісаі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга пророка Ісаї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісаиі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісаиї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісайі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Книга Ісайї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Isaja 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісая 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісаі 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Ісаї 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Isa 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("Іс 1:1").osis()).toEqual("Isa.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ІСАІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ПРОРОКА ІСАЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАИІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАИЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАЙІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("КНИГА ІСАЙЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ISAJA 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАЯ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАІ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІСАЇ 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ISA 1:1").osis()).toEqual("Isa.1.1")
expect(p.parse("ІС 1:1").osis()).toEqual("Isa.1.1")
`
true
describe "Localized book 2Sam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Sam (uk)", ->
`
expect(p.parse("2-ге. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 книга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 книга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друга Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("Друге Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуілова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуїлова 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ге Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-а Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-е Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Samuil 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Samuïl 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуіл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Самуїл 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 Сам 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2Sam 1:1").osis()).toEqual("2Sam.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 КНИГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 КНИГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГА САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("ДРУГЕ САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУІЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУЇЛОВА 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-ГЕ САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-А САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2-Е САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2. САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("II САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 SAMUIL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 SAMUÏL 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУІЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМУЇЛ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2 САМ 1:1").osis()).toEqual("2Sam.1.1")
expect(p.parse("2SAM 1:1").osis()).toEqual("2Sam.1.1")
`
true
describe "Localized book 1Sam (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Sam (uk)", ->
`
expect(p.parse("1-ше. книгPI:NAME:<NAME>END_PI СPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. книга СPI:NAME:<NAME>END_PIїPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I книга Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I книга Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. СамуіPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. СамуїлPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перша Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("Перше Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ше Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуілова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуїлова 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-а Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-е Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Samuil 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Samuïl 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуіл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I Самуїл 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 Сам 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1Sam 1:1").osis()).toEqual("1Sam.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I КНИГА САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I КНИГА САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРША САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("ПЕРШЕ САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-ШЕ САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУІЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУЇЛОВА 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-А САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1-Е САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I. САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I SAMUIL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I SAMUÏL 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУІЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("I САМУЇЛ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1 САМ 1:1").osis()).toEqual("1Sam.1.1")
expect(p.parse("1SAM 1:1").osis()).toEqual("1Sam.1.1")
`
true
describe "Localized book 2Kgs (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Kgs (uk)", ->
`
expect(p.parse("2-ге. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Четверта Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 книга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друга царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("Друге царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ге царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-а царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-е царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV. Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4. Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 Cariv 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4 Царів 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 Цар 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2Kgs 1:1").osis()).toEqual("2Kgs.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ЧЕТВЕРТА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 КНИГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГА ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("ДРУГЕ ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-ГЕ ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-А ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2-Е ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4. ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("II ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("IV ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 CARIV 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("4 ЦАРІВ 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2 ЦАР 1:1").osis()).toEqual("2Kgs.1.1")
expect(p.parse("2KGS 1:1").osis()).toEqual("2Kgs.1.1")
`
true
describe "Localized book 1Kgs (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Kgs (uk)", ->
`
expect(p.parse("1-ше. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I книга царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-тє. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перша царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Перше царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Третя Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("Третє Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ше царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-а. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-е. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-тє Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-а царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-е царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-а Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-е Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3. Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. CarPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3 Царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I Cariv 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I царів 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 Цар 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1Kgs 1:1").osis()).toEqual("1Kgs.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I КНИГА ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-ТЄ. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРША ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ПЕРШЕ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ТРЕТЯ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("ТРЕТЄ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-ШЕ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-А. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-Е. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-ТЄ ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-А ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1-Е ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-А ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3-Е ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("III ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I. ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("3 ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I CARIV 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("I ЦАРІВ 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1 ЦАР 1:1").osis()).toEqual("1Kgs.1.1")
expect(p.parse("1KGS 1:1").osis()).toEqual("1Kgs.1.1")
`
true
describe "Localized book 2Chr (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Chr (uk)", ->
`
expect(p.parse("2-ге. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 книга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 книга хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друга Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("Друге Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ге Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Літопису 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-а Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-е Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Hroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Ȟroniky 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хроніка 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 хроніки 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хронік 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 Хр 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2Chr 1:1").osis()).toEqual("2Chr.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 КНИГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 КНИГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГА ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("ДРУГЕ ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-ГЕ ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ЛІТОПИСУ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-А ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2-Е ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 HRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ȞRONIKY 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІКА 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІКИ 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2. ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("II ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХРОНІК 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2 ХР 1:1").osis()).toEqual("2Chr.1.1")
expect(p.parse("2CHR 1:1").osis()).toEqual("2Chr.1.1")
`
true
describe "Localized book 1Chr (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Chr (uk)", ->
`
expect(p.parse("1-ше. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I книга хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I книга хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перша Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("Перше Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ше Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-а Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-е Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Літопису 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Hroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Ȟroniky 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Хроніка 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I хроніки 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I Хронік 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 Хр 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1Chr 1:1").osis()).toEqual("1Chr.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I КНИГА ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I КНИГА ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРША ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("ПЕРШЕ ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-ШЕ ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-А ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1-Е ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ЛІТОПИСУ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I HRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ȞRONIKY 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІКА 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІКИ 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I. ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("I ХРОНІК 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1 ХР 1:1").osis()).toEqual("1Chr.1.1")
expect(p.parse("1CHR 1:1").osis()).toEqual("1Chr.1.1")
`
true
describe "Localized book Ezra (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ezra (uk)", ->
`
expect(p.parse("Книга Ездри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ezdra 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Єздри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездра 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездри 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ezra 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Ездр 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Єзд 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("Езд 1:1").osis()).toEqual("Ezra.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("EZDRA 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЄЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДРА 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДРИ 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("EZRA 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗДР 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЄЗД 1:1").osis()).toEqual("Ezra.1.1")
expect(p.parse("ЕЗД 1:1").osis()).toEqual("Ezra.1.1")
`
true
describe "Localized book Neh (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Neh (uk)", ->
`
expect(p.parse("Книга Нееміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Книга Неемії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Neemija 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неемія 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Нееміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неемії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неєміі 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неємії 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неем 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Неєм 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("Neh 1:1").osis()).toEqual("Neh.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА НЕЕМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("КНИГА НЕЕМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("NEEMIJA 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІЯ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМІІ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМІЇ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЕМ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("НЕЄМ 1:1").osis()).toEqual("Neh.1.1")
expect(p.parse("NEH 1:1").osis()).toEqual("Neh.1.1")
`
true
describe "Localized book GkEsth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: GkEsth (uk)", ->
`
expect(p.parse("GkEsth 1:1").osis()).toEqual("GkEsth.1.1")
`
true
describe "Localized book Esth (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Esth (uk)", ->
`
expect(p.parse("Книга Естер 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Книга Есфір 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Ester 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Естер 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Есфір 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Esth 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("Ест 1:1").osis()).toEqual("Esth.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕСТЕР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("КНИГА ЕСФІР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ESTER 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСТЕР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСФІР 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ESTH 1:1").osis()).toEqual("Esth.1.1")
expect(p.parse("ЕСТ 1:1").osis()).toEqual("Esth.1.1")
`
true
describe "Localized book Job (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Job (uk)", ->
`
expect(p.parse("Книга Іова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Книга Иова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Книга Йова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Іова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Иова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Йова 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Job 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Jov 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Иов 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("Йов 1:1").osis()).toEqual("Job.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ІОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("КНИГА ИОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("КНИГА ЙОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ІОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ИОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ЙОВА 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("JOB 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("JOV 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ИОВ 1:1").osis()).toEqual("Job.1.1")
expect(p.parse("ЙОВ 1:1").osis()).toEqual("Job.1.1")
`
true
describe "Localized book Ps (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ps (uk)", ->
`
expect(p.parse("Книга Псалмів 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалти́р 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалмів 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Psalmy 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псалми 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Псал 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Ps 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("Пс 1:1").osis()).toEqual("Ps.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПСАЛМІВ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛТИ́Р 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛМІВ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("PSALMY 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛМИ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПСАЛ 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("PS 1:1").osis()).toEqual("Ps.1.1")
expect(p.parse("ПС 1:1").osis()).toEqual("Ps.1.1")
`
true
describe "Localized book PrAzar (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PrAzar (uk)", ->
`
expect(p.parse("Молитва Азаріі 1:1").osis()).toEqual("PrAzar.1.1")
expect(p.parse("Молитва Азарії 1:1").osis()).toEqual("PrAzar.1.1")
expect(p.parse("PrAzar 1:1").osis()).toEqual("PrAzar.1.1")
`
true
describe "Localized book Prov (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Prov (uk)", ->
`
expect(p.parse("Книга Приповістеи Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Книга Приповістей Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Книга Приказок Соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістеи соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістей соломонових 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притчі Соломона 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістеи 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповістей 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Prypovisti 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповідок 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приповісті 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приказки 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Приказок 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притчі 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Притч 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Prov 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Прип 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("Пр 1:1").osis()).toEqual("Prov.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРИПОВІСТЕИ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("КНИГА ПРИПОВІСТЕЙ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("КНИГА ПРИКАЗОК СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕИ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕЙ СОЛОМОНОВИХ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧІ СОЛОМОНА 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕИ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТЕЙ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("PRYPOVISTI 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІДОК 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИПОВІСТІ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИКАЗКИ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИКАЗОК 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧІ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИТЧ 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("PROV 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПРИП 1:1").osis()).toEqual("Prov.1.1")
expect(p.parse("ПР 1:1").osis()).toEqual("Prov.1.1")
`
true
describe "Localized book Eccl (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Eccl (uk)", ->
`
expect(p.parse("Книга Екклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Книга Еклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Еклезіястова 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Проповідника 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Ekklezijast 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіяста 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екклезіяст 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Коге́лет 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Eccl 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Еккл 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("Екл 1:1").osis()).toEqual("Eccl.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ЕККЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("КНИГА ЕКЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕКЛЕЗІЯСТОВА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ПРОПОВІДНИКА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("EKKLEZIJAST 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТА 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛЕЗІЯСТ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("КОГЕ́ЛЕТ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ECCL 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕККЛ 1:1").osis()).toEqual("Eccl.1.1")
expect(p.parse("ЕКЛ 1:1").osis()).toEqual("Eccl.1.1")
`
true
describe "Localized book SgThree (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: SgThree (uk)", ->
`
expect(p.parse("Пісня трьох отроків 1:1").osis()).toEqual("SgThree.1.1")
expect(p.parse("SgThree 1:1").osis()).toEqual("SgThree.1.1")
`
true
describe "Localized book Song (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Song (uk)", ->
`
expect(p.parse("Книга Пісні Пісень Соломона 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня над піснями Соломона 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Pisnja nad pisnjamy 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня над піснями 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня Піснеи 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісня Пісней 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісні Пісень 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Song 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("Пісн 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П 1:1").osis()).toEqual("Song.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПІСНІ ПІСЕНЬ СОЛОМОНА 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ НАД ПІСНЯМИ СОЛОМОНА 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("PISNJA NAD PISNJAMY 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ НАД ПІСНЯМИ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ ПІСНЕИ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНЯ ПІСНЕЙ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСНІ ПІСЕНЬ 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("SONG 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П. 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П. П 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("ПІСН 1:1").osis()).toEqual("Song.1.1")
expect(p.parse("П П 1:1").osis()).toEqual("Song.1.1")
`
true
describe "Localized book Jer (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jer (uk)", ->
`
expect(p.parse("Книга пророка Єреміі 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Книга пророка Єремії 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Jeremija 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єремія 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єреміі 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єремії 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єрем 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Jer 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("Єр 1:1").osis()).toEqual("Jer.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЄРЕМІІ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("КНИГА ПРОРОКА ЄРЕМІЇ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("JEREMIJA 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІЯ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІІ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМІЇ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄРЕМ 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("JER 1:1").osis()).toEqual("Jer.1.1")
expect(p.parse("ЄР 1:1").osis()).toEqual("Jer.1.1")
`
true
describe "Localized book Ezek (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Ezek (uk)", ->
`
expect(p.parse("Книга пророка Єзекііля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Книга пророка Єзекіїля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiil' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiil’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiïl' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Jezekiïl’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііла 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііль 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекііля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїла 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїль 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзекіїля 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Ezek 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єзек 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("Єз 1:1").osis()).toEqual("Ezek.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЄЗЕКІІЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("КНИГА ПРОРОКА ЄЗЕКІЇЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIIL' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIIL’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIÏL' 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("JEZEKIÏL’ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛА 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛЬ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІІЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛА 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛЬ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕКІЇЛЯ 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("EZEK 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗЕК 1:1").osis()).toEqual("Ezek.1.1")
expect(p.parse("ЄЗ 1:1").osis()).toEqual("Ezek.1.1")
`
true
describe "Localized book PI:NAME:<NAME>END_PI (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PI:NAME:<NAME>END_PI (uk)", ->
`
expect(p.parse("Книга пророка Даниіла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Книга пророка Даниїла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниіла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниїла 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Danyil 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Danyïl 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниіл 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Даниїл 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Dan 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("Дан 1:1").osis()).toEqual("Dan.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ДАНИІЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("КНИГА ПРОРОКА ДАНИЇЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИІЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИЇЛА 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DANYIL 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DANYÏL 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИІЛ 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАНИЇЛ 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("DAN 1:1").osis()).toEqual("Dan.1.1")
expect(p.parse("ДАН 1:1").osis()).toEqual("Dan.1.1")
`
true
describe "Localized book Hos (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hos (uk)", ->
`
expect(p.parse("Книга пророка Осіі 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Книга пророка Осії 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Osija 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осія 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осіі 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Осії 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Hos 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("Ос 1:1").osis()).toEqual("Hos.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ОСІІ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("КНИГА ПРОРОКА ОСІЇ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("OSIJA 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІЯ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІІ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОСІЇ 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("HOS 1:1").osis()).toEqual("Hos.1.1")
expect(p.parse("ОС 1:1").osis()).toEqual("Hos.1.1")
`
true
describe "Localized book Joel (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PI:NAME:<NAME>END_PI (uk)", ->
`
expect(p.parse("Книга пророка Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга пророка Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Книга Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоіла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїла 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joel 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joil 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Joïl 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоіл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоін 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Иоїн 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоіл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоін 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїл 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("Йоїн 1:1").osis()).toEqual("Joel.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ПРОРОКА ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("КНИГА ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇЛА 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOEL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOIL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("JOÏL 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОІН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ИОЇН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОІН 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇЛ 1:1").osis()).toEqual("Joel.1.1")
expect(p.parse("ЙОЇН 1:1").osis()).toEqual("Joel.1.1")
`
true
describe "Localized book Amos (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Amos (uk)", ->
`
expect(p.parse("Книга пророка Амоса 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Амоса 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Amos 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Амос 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("Ам 1:1").osis()).toEqual("Amos.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АМОСА 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМОСА 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("AMOS 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМОС 1:1").osis()).toEqual("Amos.1.1")
expect(p.parse("АМ 1:1").osis()).toEqual("Amos.1.1")
`
true
describe "Localized book Obad (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Obad (uk)", ->
`
expect(p.parse("Книга пророка Авдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Книга пророка Овдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Ovdij 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Авдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдіи 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдій 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овдія 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Obad 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Авд 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Овд 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("Ов 1:1").osis()).toEqual("Obad.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("КНИГА ПРОРОКА ОВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("OVDIJ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("АВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІИ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІЙ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВДІЯ 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("OBAD 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("АВД 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВД 1:1").osis()).toEqual("Obad.1.1")
expect(p.parse("ОВ 1:1").osis()).toEqual("Obad.1.1")
`
true
describe "Localized book Jonah (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jonah (uk)", ->
`
expect(p.parse("Книга пророка Иони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Книга пророка Йони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Jonah 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Jona 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Иона 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Иони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йона 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йони 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Ион 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("Йон 1:1").osis()).toEqual("Jonah.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ИОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("КНИГА ПРОРОКА ЙОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("JONAH 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("JONA 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОНА 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОНА 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОНИ 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ИОН 1:1").osis()).toEqual("Jonah.1.1")
expect(p.parse("ЙОН 1:1").osis()).toEqual("Jonah.1.1")
`
true
describe "Localized book Mic (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mic (uk)", ->
`
expect(p.parse("Книга пророка Михея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Книга пророка Міхея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Myhej 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Myȟej 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михеи 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михей 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Михея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Міхея 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Mic 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Мих 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("Міх 1:1").osis()).toEqual("Mic.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА МИХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("КНИГА ПРОРОКА МІХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MYHEJ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MYȞEJ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕИ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕЙ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МІХЕЯ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("MIC 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МИХ 1:1").osis()).toEqual("Mic.1.1")
expect(p.parse("МІХ 1:1").osis()).toEqual("Mic.1.1")
`
true
describe "Localized book Nah (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Nah (uk)", ->
`
expect(p.parse("Книга пророка Наума 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Наума 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Naum 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Наум 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("Nah 1:1").osis()).toEqual("Nah.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА НАУМА 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("НАУМА 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("NAUM 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("НАУМ 1:1").osis()).toEqual("Nah.1.1")
expect(p.parse("NAH 1:1").osis()).toEqual("Nah.1.1")
`
true
describe "Localized book Hab (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hab (uk)", ->
`
expect(p.parse("Книга пророка Авакума 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Авакума 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Avakum 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Авакум 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Hab 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("Ав 1:1").osis()).toEqual("Hab.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА АВАКУМА 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВАКУМА 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("AVAKUM 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВАКУМ 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("HAB 1:1").osis()).toEqual("Hab.1.1")
expect(p.parse("АВ 1:1").osis()).toEqual("Hab.1.1")
`
true
describe "Localized book Zeph (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Zeph (uk)", ->
`
expect(p.parse("Книга пророка Софоніі 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Книга пророка Софонії 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Sofonija 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софонія 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софоніі 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Софонії 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Zeph 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("Соф 1:1").osis()).toEqual("Zeph.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА СОФОНІІ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("КНИГА ПРОРОКА СОФОНІЇ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("SOFONIJA 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІЯ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІІ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФОНІЇ 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("ZEPH 1:1").osis()).toEqual("Zeph.1.1")
expect(p.parse("СОФ 1:1").osis()).toEqual("Zeph.1.1")
`
true
describe "Localized book Hag (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Hag (uk)", ->
`
expect(p.parse("Книга пророка Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Книга Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Аггея 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Ohij 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огіи 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огій 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Огія 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Hag 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Аг 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("Ог 1:1").osis()).toEqual("Hag.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("КНИГА ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("АГГЕЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("OHIJ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІИ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІЙ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГІЯ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("HAG 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("АГ 1:1").osis()).toEqual("Hag.1.1")
expect(p.parse("ОГ 1:1").osis()).toEqual("Hag.1.1")
`
true
describe "Localized book Zech (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Zech (uk)", ->
`
expect(p.parse("Книга пророка Захарія 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Книга Захаріі 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Книга Захарії 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zaharij 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zaȟarij 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захаріи 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарій 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарія 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захаріі 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Захарії 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Zech 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("Зах 1:1").osis()).toEqual("Zech.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА ЗАХАРІЯ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("КНИГА ЗАХАРІІ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("КНИГА ЗАХАРІЇ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZAHARIJ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZAȞARIJ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІИ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЙ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЯ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІІ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХАРІЇ 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ZECH 1:1").osis()).toEqual("Zech.1.1")
expect(p.parse("ЗАХ 1:1").osis()).toEqual("Zech.1.1")
`
true
describe "Localized book Mal (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mal (uk)", ->
`
expect(p.parse("Книга пророка Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга пророка Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Книга Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Malahija 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Malaȟija 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахія 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахіі 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Малахії 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Mal 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("Мал 1:1").osis()).toEqual("Mal.1.1")
p.include_apocrypha(false)
expect(p.parse("КНИГА ПРОРОКА МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА ПРОРОКА МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("КНИГА МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MALAHIJA 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MALAȞIJA 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІЯ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІІ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛАХІЇ 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("MAL 1:1").osis()).toEqual("Mal.1.1")
expect(p.parse("МАЛ 1:1").osis()).toEqual("Mal.1.1")
`
true
describe "Localized book Matt (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Matt (uk)", ->
`
expect(p.parse("Євангелія від св. Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від св. Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Jevanhelije vid Matvija 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангелія від св Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від св Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангелія від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Євангеліє від Матея 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Від Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матвія 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матеи 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матей 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Matt 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Матв 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Мат 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("Мт 1:1").osis()).toEqual("Matt.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("JEVANHELIJE VID MATVIJA 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАТЕЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("ВІД МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТВІЯ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТЕИ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТЕЙ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("MATT 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТВ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МАТ 1:1").osis()).toEqual("Matt.1.1")
expect(p.parse("МТ 1:1").osis()).toEqual("Matt.1.1")
`
true
describe "Localized book 2Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Macc (uk)", ->
`
expect(p.parse("2-ге. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 книга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 книга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друга Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("Друге Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-ге Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-а Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2-е Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2. Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("II Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Макавеів 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Макавеїв 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Мак 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2Macc 1:1").osis()).toEqual("2Macc.1.1")
expect(p.parse("2 Мк 1:1").osis()).toEqual("2Macc.1.1")
`
true
describe "Localized book 3Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 3Macc (uk)", ->
`
expect(p.parse("3-тє. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 книга Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 книга Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третя Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("Третє Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-тє Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-а Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3-е Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("III Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3. Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Макавеів 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Макавеїв 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Мак 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3Macc 1:1").osis()).toEqual("3Macc.1.1")
expect(p.parse("3 Мк 1:1").osis()).toEqual("3Macc.1.1")
`
true
describe "Localized book 4Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 4Macc (uk)", ->
`
expect(p.parse("Четверта книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("Четверта Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 книга Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 книга Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV. Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4. Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("IV Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Макавеів 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Макавеїв 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Мак 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4Macc 1:1").osis()).toEqual("4Macc.1.1")
expect(p.parse("4 Мк 1:1").osis()).toEqual("4Macc.1.1")
`
true
describe "Localized book 1Macc (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Macc (uk)", ->
`
expect(p.parse("1-ше. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перша книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I книга Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I книга Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("ПPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("ПPI:NAME:<NAME>END_PI Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("Перше Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-ше Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-а Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1-е Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I. Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I Макавеів 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("I Макавеїв 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Мак 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1Macc 1:1").osis()).toEqual("1Macc.1.1")
expect(p.parse("1 Мк 1:1").osis()).toEqual("1Macc.1.1")
`
true
describe "Localized book Mark (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Mark (uk)", ->
`
expect(p.parse("Євангелія від св. Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від св. Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангелія від св Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від св Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Jevanhelije vid Marka 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангелія від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Євангеліє від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Від Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Марка 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Марко 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Mark 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Мк 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("Мр 1:1").osis()).toEqual("Mark.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("JEVANHELIJE VID MARKA 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("ВІД МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МАРКА 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МАРКО 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("MARK 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МК 1:1").osis()).toEqual("Mark.1.1")
expect(p.parse("МР 1:1").osis()).toEqual("Mark.1.1")
`
true
describe "Localized book PI:NAME:<NAME>END_PI (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PI:NAME:<NAME>END_PI (uk)", ->
`
expect(p.parse("Євангелія від св. Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від св. Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангелія від св Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від св Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Jevanhelije vid Luky 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від Лу ки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангелія від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Євангеліє від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Від Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Luke 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Лука 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Луки 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("Лк 1:1").osis()).toEqual("Luke.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("JEVANHELIJE VID LUKY 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ЛУ КИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ВІД ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("LUKE 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛУКА 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛУКИ 1:1").osis()).toEqual("Luke.1.1")
expect(p.parse("ЛК 1:1").osis()).toEqual("Luke.1.1")
`
true
describe "Localized book 1John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1John (uk)", ->
`
expect(p.parse("1-ше. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I соборне послання св. апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I соборне послання св апостола Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Perse poslannja apostola Ivana 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Perše poslannja apostola Ivana 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I послання апостола Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Послання Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перша Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("Перше Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е. Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ше Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-а Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-е Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Иоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Йоаново 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІвPI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Іоанна 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. PI:NAME:<NAME>END_PI 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I Івана 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1John 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 Ів 1:1").osis()).toEqual("1John.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРША ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("ПЕРШЕ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-ШЕ ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-А ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1-Е ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ИОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ЙОАНОВО 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ІОАННА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I. ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("I ІВАНА 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1JOHN 1:1").osis()).toEqual("1John.1.1")
expect(p.parse("1 ІВ 1:1").osis()).toEqual("1John.1.1")
`
true
describe "Localized book 2John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2John (uk)", ->
`
expect(p.parse("2-ге. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 соборне послання св апостола Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Druhe poslannja apostola Ivana 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 послання апостола Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Послання Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Послання до Тита 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друга Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("Друге Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ге Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Иоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Йоаново 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-а Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-е Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Іоанна 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Івана 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2John 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 Ів 1:1").osis()).toEqual("2John.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ПОСЛАННЯ ДО ТИТА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГА ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("ДРУГЕ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-ГЕ ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ИОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ЙОАНОВО 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-А ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2-Е ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІОАННА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2. ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("II ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІВАНА 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2JOHN 1:1").osis()).toEqual("2John.1.1")
expect(p.parse("2 ІВ 1:1").osis()).toEqual("2John.1.1")
`
true
describe "Localized book 3John (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 3John (uk)", ->
`
expect(p.parse("3-тє. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 соборне послання св. апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 соборне послання св апостола Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Tretje poslannja apostola Ivana 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 послання апостола Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Послання Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третя Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("Третє Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-тє Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Иоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Йоаново 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-а Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-е Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Іоанна 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Івана 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3John 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 Ів 1:1").osis()).toEqual("3John.1.1")
p.include_apocrypha(false)
expect(p.parse("3-ТЄ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("TRETJE POSLANNJA APOSTOLA IVANA 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ПОСЛАННЯ АПОСТОЛА ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ПОСЛАННЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЯ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("ТРЕТЄ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-ТЄ ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ИОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ЙОАНОВО 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-А ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3-Е ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("III ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІОАННА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3. ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІВАНА 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3JOHN 1:1").osis()).toEqual("3John.1.1")
expect(p.parse("3 ІВ 1:1").osis()).toEqual("3John.1.1")
`
true
describe "Localized book PI:NAME:<NAME>END_PI (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: PI:NAME:<NAME>END_PI (uk)", ->
`
expect(p.parse("Євангелія від св. Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св. Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св. Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангелія від св Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від св Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Jevanhelije vid Ivana 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангелія від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Євангеліє від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Від Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Івана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Иоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Йоана 1:1").osis()).toEqual("John.1.1")
expect(p.parse("John 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Иоан 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Йоан 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Ів 1:1").osis()).toEqual("John.1.1")
expect(p.parse("Ін 1:1").osis()).toEqual("John.1.1")
p.include_apocrypha(false)
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ. ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ. ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД СВ ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД СВ ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("JEVANHELIJE VID IVANA 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЯ ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЄВАНГЕЛІЄ ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ВІД ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІВАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ИОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЙОАНА 1:1").osis()).toEqual("John.1.1")
expect(p.parse("JOHN 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ИОАН 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ЙОАН 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІВ 1:1").osis()).toEqual("John.1.1")
expect(p.parse("ІН 1:1").osis()).toEqual("John.1.1")
`
true
describe "Localized book Acts (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Acts (uk)", ->
`
expect(p.parse("Dijannja svjatyh apostoliv 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Dijannja svjatyȟ apostoliv 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діяння Святих Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі святих апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії святих апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії Апостолів 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діяння 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Acts 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діян 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Діі 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("Дії 1:1").osis()).toEqual("Acts.1.1")
p.include_apocrypha(false)
expect(p.parse("DIJANNJA SVJATYH APOSTOLIV 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("DIJANNJA SVJATYȞ APOSTOLIV 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯННЯ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ СВЯТИХ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ АПОСТОЛІВ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯННЯ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ACTS 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЯН 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІІ 1:1").osis()).toEqual("Acts.1.1")
expect(p.parse("ДІЇ 1:1").osis()).toEqual("Acts.1.1")
`
true
describe "Localized book Rom (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Rom (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання св апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Poslannja apostola Pavla do rymljan 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання апостола Павла до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Послання до римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("До римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римляни 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римлян 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Римл 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Rom 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("Рим 1:1").osis()).toEqual("Rom.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO RYMLJAN 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ПОСЛАННЯ ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ДО РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛЯНИ 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛЯН 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМЛ 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("ROM 1:1").osis()).toEqual("Rom.1.1")
expect(p.parse("РИМ 1:1").osis()).toEqual("Rom.1.1")
`
true
describe "Localized book 2Cor (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Cor (uk)", ->
`
expect(p.parse("Druhe poslannja apostola PI:NAME:<NAME>END_PIavla do korynfjan 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 послання апостола Павла до коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Послання до Коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друга коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("Друге коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 до коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ге коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-а коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-е коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Коринтяни 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Коринфян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 коринтян 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 Кор 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2Cor 1:1").osis()).toEqual("2Cor.1.1")
p.include_apocrypha(false)
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГА КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("ДРУГЕ КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 ДО КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-ГЕ КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-А КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2-Е КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНТЯНИ 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2. КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("II КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНФЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОРИНТЯН 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2 КОР 1:1").osis()).toEqual("2Cor.1.1")
expect(p.parse("2COR 1:1").osis()).toEqual("2Cor.1.1")
`
true
describe "Localized book 1Cor (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Cor (uk)", ->
`
expect(p.parse("Perse poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Perše poslannja apostola Pavla do korynfjan 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I послання апостола Павла до коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Послання до Коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перша коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("Перше коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ше коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I до коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-а коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-е коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Коринтяни 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I Коринфян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I коринтян 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 Кор 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1Cor 1:1").osis()).toEqual("1Cor.1.1")
p.include_apocrypha(false)
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO KORYNFJAN 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ПОСЛАННЯ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРША КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("ПЕРШЕ КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-ШЕ КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I ДО КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-А КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1-Е КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНТЯНИ 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I. КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНФЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("I КОРИНТЯН 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1 КОР 1:1").osis()).toEqual("1Cor.1.1")
expect(p.parse("1COR 1:1").osis()).toEqual("1Cor.1.1")
`
true
describe "Localized book Gal (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Gal (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання св апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Poslannja apostola Pavla do halativ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання апостола Павла до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("По слання до Галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Послання до галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("До галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Галатяни 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Галатів 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Gal 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("Гал 1:1").osis()).toEqual("Gal.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO HALATIV 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПО СЛАННЯ ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ПОСЛАННЯ ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ДО ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛАТЯНИ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛАТІВ 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("GAL 1:1").osis()).toEqual("Gal.1.1")
expect(p.parse("ГАЛ 1:1").osis()).toEqual("Gal.1.1")
`
true
describe "Localized book Eph (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Eph (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання св апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Poslannja apostola Pavla do efesjan 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання апостола Павла до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("По слан ня до Єфесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Послання до ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("До ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефесяни 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефесян 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Ефес 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Eph 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Єф 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("Еф 1:1").osis()).toEqual("Eph.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO EFESJAN 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПО СЛАН НЯ ДО ЄФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ДО ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕСЯНИ 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕСЯН 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФЕС 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("EPH 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЄФ 1:1").osis()).toEqual("Eph.1.1")
expect(p.parse("ЕФ 1:1").osis()).toEqual("Eph.1.1")
`
true
describe "Localized book Phil (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Phil (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св. апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання св апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Poslannja apostola Pavla do fylyp'jan 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Poslannja apostola Pavla do fylyp’jan 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання апостола Павла до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання апостола Павла до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до Філіп'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до Філіп’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Послання до филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("До филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("До филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип'яни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип’яни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип'ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филипяни 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филип’ян 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Phil 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Филп 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Фил 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("Флп 1:1").osis()).toEqual("Phil.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYP'JAN 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYP’JAN 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФІЛІП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФІЛІП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ДО ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ДО ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП'ЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП’ЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП'ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИПЯНИ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛИП’ЯН 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("PHIL 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛП 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФИЛ 1:1").osis()).toEqual("Phil.1.1")
expect(p.parse("ФЛП 1:1").osis()).toEqual("Phil.1.1")
`
true
describe "Localized book Col (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Col (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання св апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Poslannja apostola Pavla do kolosjan 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання апостола Павла до колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Послання до Колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("До колоссян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колоссян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колосяни 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колосян 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Колос 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Col 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("Кол 1:1").osis()).toEqual("Col.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO KOLOSJAN 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ПОСЛАННЯ ДО КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("ДО КОЛОССЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОССЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОСЯНИ 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОСЯН 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛОС 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("COL 1:1").osis()).toEqual("Col.1.1")
expect(p.parse("КОЛ 1:1").osis()).toEqual("Col.1.1")
`
true
describe "Localized book 2Thess (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Thess (uk)", ->
`
expect(p.parse("2-ге. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Druhe poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання св. апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання св апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання апостола Павла до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до салонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до салонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 послання до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 фессалонікіиців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 фессалонікійців 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друга Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("Друге Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 до солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ге Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-а Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-е Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Солуньці 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Солунян 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2Thess 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 Сол 1:1").osis()).toEqual("2Thess.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГА СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("ДРУГЕ СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 ДО СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-ГЕ СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-А СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2-Е СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛУНЬЦІ 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2. СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("II СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛУНЯН 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2THESS 1:1").osis()).toEqual("2Thess.1.1")
expect(p.parse("2 СОЛ 1:1").osis()).toEqual("2Thess.1.1")
`
true
describe "Localized book 1Thess (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Thess (uk)", ->
`
expect(p.parse("1-ше. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Perse poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Perše poslannja apostola Pavla do solunjan 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання св. апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання св апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання апостола Павла до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до салонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до салонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I послання до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I фессалонікіиців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I фессалонікійців 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перша Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("Перше Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ше Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I до солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-а Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-е Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I Солуньці 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I Солунян 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1Thess 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 Сол 1:1").osis()).toEqual("1Thess.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO SOLUNJAN 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО САЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО САЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ПОСЛАННЯ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ФЕССАЛОНІКІИЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ФЕССАЛОНІКІЙЦІВ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРША СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("ПЕРШЕ СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-ШЕ СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I ДО СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-А СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1-Е СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I СОЛУНЬЦІ 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I. СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("I СОЛУНЯН 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1THESS 1:1").osis()).toEqual("1Thess.1.1")
expect(p.parse("1 СОЛ 1:1").osis()).toEqual("1Thess.1.1")
`
true
describe "Localized book 2Tim (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Tim (uk)", ->
`
expect(p.parse("2-ге. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Druhe poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання св апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання апостола Павла до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання до Тимотея 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання до Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 послання Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друга Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("Друге Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ге Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-а Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-е Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимофія 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимотеи 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимотей 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тимофію 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 Тим 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2Tim 1:1").osis()).toEqual("2Tim.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГА ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("ДРУГЕ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-ГЕ ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-А ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2-Е ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОФІЯ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2. ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("II ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОТЕИ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОТЕЙ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМОФІЮ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2 ТИМ 1:1").osis()).toEqual("2Tim.1.1")
expect(p.parse("2TIM 1:1").osis()).toEqual("2Tim.1.1")
`
true
describe "Localized book 1Tim (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Tim (uk)", ->
`
expect(p.parse("1-ше. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Perse poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Perše poslannja apostola Pavla do Tymofija 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання св. апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання св апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання апостола Павла до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання до Тимотея 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання до Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I послання Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перша Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("Перше Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ше Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-а Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-е Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимофія 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимотеи 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимотей 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I Тимофію 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 Тим 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1Tim 1:1").osis()).toEqual("1Tim.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PAVLA DO TYMOFIJA 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ТИМОТЕЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ДО ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ПОСЛАННЯ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРША ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("ПЕРШЕ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-ШЕ ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-А ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1-Е ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОФІЯ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I. ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОТЕИ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОТЕЙ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("I ТИМОФІЮ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1 ТИМ 1:1").osis()).toEqual("1Tim.1.1")
expect(p.parse("1TIM 1:1").osis()).toEqual("1Tim.1.1")
`
true
describe "Localized book Titus (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Titus (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послання св апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Poslannja apostola Pavla do Tyta 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послання апостола Павла до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Послан ня до Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("До Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Titus 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Тита 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("Тит 1:1").osis()).toEqual("Titus.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO TYTA 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ДО ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("TITUS 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ТИТА 1:1").osis()).toEqual("Titus.1.1")
expect(p.parse("ТИТ 1:1").osis()).toEqual("Titus.1.1")
`
true
describe "Localized book Phlm (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Phlm (uk)", ->
`
expect(p.parse("Послання св. апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання св апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Poslannja apostola Pavla do Fylymona 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання апостола Павла до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филипіиців 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филипійців 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Послання до Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("До Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филимона 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филимон 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филим 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Phlm 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Филм 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("Флм 1:1").osis()).toEqual("Phlm.1.1")
p.include_apocrypha(false)
expect(p.parse("ПОСЛАННЯ СВ. АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ СВ АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("POSLANNJA APOSTOLA PAVLA DO FYLYMONA 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ПАВЛА ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИПІИЦІВ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИПІЙЦІВ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ПОСЛАННЯ ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ДО ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМОНА 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМОН 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛИМ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("PHLM 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФИЛМ 1:1").osis()).toEqual("Phlm.1.1")
expect(p.parse("ФЛМ 1:1").osis()).toEqual("Phlm.1.1")
`
true
describe "Localized book Heb (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Heb (uk)", ->
`
expect(p.parse("Poslannja do jevreiv 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Poslannja do jevreïv 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послан ня до Євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послан ня до Євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послання до євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Послання до євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("До євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("До євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреів 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреїв 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреі 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євреї 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Heb 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("Євр 1:1").osis()).toEqual("Heb.1.1")
p.include_apocrypha(false)
expect(p.parse("POSLANNJA DO JEVREIV 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("POSLANNJA DO JEVREÏV 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАН НЯ ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ПОСЛАННЯ ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ДО ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ДО ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕІВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕЇВ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕІ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВРЕЇ 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("HEB 1:1").osis()).toEqual("Heb.1.1")
expect(p.parse("ЄВР 1:1").osis()).toEqual("Heb.1.1")
`
true
describe "Localized book Jas (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jas (uk)", ->
`
expect(p.parse("Соборне послання св. апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Соборне послання св апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Poslannja apostola Jakova 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Послання апостола Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Соборне послання Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Послання Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Якова 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Яков 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Jas 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("Як 1:1").osis()).toEqual("Jas.1.1")
p.include_apocrypha(false)
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("POSLANNJA APOSTOLA JAKOVA 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ПОСЛАННЯ ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯКОВА 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯКОВ 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("JAS 1:1").osis()).toEqual("Jas.1.1")
expect(p.parse("ЯК 1:1").osis()).toEqual("Jas.1.1")
`
true
describe "Localized book 2Pet (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 2Pet (uk)", ->
`
expect(p.parse("2-ге. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання св. апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання св апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Druhe poslannja apostola Petra 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 послання апостола Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 соборне послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 послання Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друга Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("Друге Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ге Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петрово 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-а Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-е Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петра 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Петр 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Пет 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 Пт 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2Pet 1:1").osis()).toEqual("2Pet.1.1")
p.include_apocrypha(false)
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("DRUHE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГА ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("ДРУГЕ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-ГЕ ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТРОВО 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-А ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2-Е ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2. ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("II ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТРА 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТР 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПЕТ 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2 ПТ 1:1").osis()).toEqual("2Pet.1.1")
expect(p.parse("2PET 1:1").osis()).toEqual("2Pet.1.1")
`
true
describe "Localized book 1Pet (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: 1Pet (uk)", ->
`
expect(p.parse("1-ше. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання св. апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання св апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Perse poslannja apostola Petra 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Perše poslannja apostola Petra 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I послання апостола Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I соборне послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I послання Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перша Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("Перше Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ше Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-а Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-е Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I Петрово 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I Петра 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Петр 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Пет 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 Пт 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1Pet 1:1").osis()).toEqual("1Pet.1.1")
p.include_apocrypha(false)
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("PERSE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("PERŠE POSLANNJA APOSTOLA PETRA 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПОСЛАННЯ АПОСТОЛА ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I СОБОРНЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПОСЛАННЯ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРША ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("ПЕРШЕ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-ШЕ ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-А ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1-Е ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПЕТРОВО 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I. ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("I ПЕТРА 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТР 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПЕТ 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1 ПТ 1:1").osis()).toEqual("1Pet.1.1")
expect(p.parse("1PET 1:1").osis()).toEqual("1Pet.1.1")
`
true
describe "Localized book Jude (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jude (uk)", ->
`
expect(p.parse("Соборне послання св. апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Соборне послання св апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Poslannja apostola Judy 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання апостола Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Соборне послання Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання Іуди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Послання Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Jude 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Іуд 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юда 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юди 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("Юд 1:1").osis()).toEqual("Jude.1.1")
p.include_apocrypha(false)
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ. АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ СВ АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("POSLANNJA APOSTOLA JUDY 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ АПОСТОЛА ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("СОБОРНЕ ПОСЛАННЯ ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ ІУДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ПОСЛАННЯ ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("JUDE 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ІУД 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮДА 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮДИ 1:1").osis()).toEqual("Jude.1.1")
expect(p.parse("ЮД 1:1").osis()).toEqual("Jude.1.1")
`
true
describe "Localized book Tob (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Tob (uk)", ->
`
expect(p.parse("Книга Товита 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Товита 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Товит 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Tob 1:1").osis()).toEqual("Tob.1.1")
expect(p.parse("Тов 1:1").osis()).toEqual("Tob.1.1")
`
true
describe "Localized book Jdt (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Jdt (uk)", ->
`
expect(p.parse("Книга Юдити 1:1").osis()).toEqual("Jdt.1.1")
expect(p.parse("Юдити 1:1").osis()).toEqual("Jdt.1.1")
expect(p.parse("Jdt 1:1").osis()).toEqual("Jdt.1.1")
`
true
describe "Localized book Bar (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Bar (uk)", ->
`
expect(p.parse("Варуха 1:1").osis()).toEqual("Bar.1.1")
expect(p.parse("Bar 1:1").osis()).toEqual("Bar.1.1")
expect(p.parse("Вар 1:1").osis()).toEqual("Bar.1.1")
`
true
describe "Localized book Sus (uk)", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore",book_sequence_strategy: "ignore",osis_compaction_strategy: "bc",captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should handle book: Sus (uk)", ->
`
expect(p.parse("Сусанна 1:1").osis()).toEqual("Sus.1.1")
expect(p.parse("Sus 1:1").osis()).toEqual("Sus.1.1")
expect(p.parse("Сус 1:1").osis()).toEqual("Sus.1.1")
`
true
describe "Miscellaneous tests", ->
p = {}
beforeEach ->
p = new bcv_parser
p.set_options book_alone_strategy: "ignore", book_sequence_strategy: "ignore", osis_compaction_strategy: "bc", captive_end_digits_strategy: "delete"
p.include_apocrypha true
it "should return the expected language", ->
expect(p.languages).toEqual ["uk"]
it "should handle ranges (uk)", ->
expect(p.parse("Titus 1:1 - 2").osis()).toEqual "Titus.1.1-Titus.1.2"
expect(p.parse("Matt 1-2").osis()).toEqual "Matt.1-Matt.2"
expect(p.parse("Phlm 2 - 3").osis()).toEqual "Phlm.1.2-Phlm.1.3"
expect(p.parse("Titus 1:1 до 2").osis()).toEqual "Titus.1.1-Titus.1.2"
expect(p.parse("Matt 1до2").osis()).toEqual "Matt.1-Matt.2"
expect(p.parse("Phlm 2 ДО 3").osis()).toEqual "Phlm.1.2-Phlm.1.3"
it "should handle chapters (uk)", ->
expect(p.parse("Titus 1:1, глави 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛАВИ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, глава 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛАВА 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, гл 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 ГЛ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, розділ 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 РОЗДІЛ 6").osis()).toEqual "Matt.3.4,Matt.6"
expect(p.parse("Titus 1:1, розд 2").osis()).toEqual "Titus.1.1,Titus.2"
expect(p.parse("Matt 3:4 РОЗД 6").osis()).toEqual "Matt.3.4,Matt.6"
it "should handle verses (uk)", ->
expect(p.parse("Exod 1:1 вірші 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm ВІРШІ 6").osis()).toEqual "Phlm.1.6"
expect(p.parse("Exod 1:1 вірш 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm ВІРШ 6").osis()).toEqual "Phlm.1.6"
it "should handle 'and' (uk)", ->
expect(p.parse("Exod 1:1 і 3").osis()).toEqual "Exod.1.1,Exod.1.3"
expect(p.parse("Phlm 2 І 6").osis()).toEqual "Phlm.1.2,Phlm.1.6"
it "should handle titles (uk)", ->
expect(p.parse("Ps 3 title, 4:2, 5:title").osis()).toEqual "Ps.3.1,Ps.4.2,Ps.5.1"
expect(p.parse("PS 3 TITLE, 4:2, 5:TITLE").osis()).toEqual "Ps.3.1,Ps.4.2,Ps.5.1"
it "should handle 'ff' (uk)", ->
expect(p.parse("Rev 3ff, 4:2ff").osis()).toEqual "Rev.3-Rev.22,Rev.4.2-Rev.4.11"
expect(p.parse("REV 3 FF, 4:2 FF").osis()).toEqual "Rev.3-Rev.22,Rev.4.2-Rev.4.11"
it "should handle translations (uk)", ->
expect(p.parse("Lev 1 (ERV)").osis_and_translations()).toEqual [["Lev.1", "ERV"]]
expect(p.parse("lev 1 erv").osis_and_translations()).toEqual [["Lev.1", "ERV"]]
it "should handle book ranges (uk)", ->
p.set_options {book_alone_strategy: "full", book_range_strategy: "include"}
expect(p.parse("Перша - Третя Івана").osis()).toEqual "1John.1-3John.1"
expect(p.parse("Перша до Третя Івана").osis()).toEqual "1John.1-3John.1"
it "should handle boundaries (uk)", ->
p.set_options {book_alone_strategy: "full"}
expect(p.parse("\u2014Matt\u2014").osis()).toEqual "Matt.1-Matt.28"
expect(p.parse("\u201cMatt 1:1\u201d").osis()).toEqual "Matt.1.1"
|
[
{
"context": " \"hello!\"\n# hubot orly - \"yarly\"\n#\n# Author:\n# tombell\n\nlastmessage = \"\"\nsayings =\n phrasing: [\n \"ar",
"end": 180,
"score": 0.9997053146362305,
"start": 173,
"tag": "USERNAME",
"value": "tombell"
},
{
"context": "asing! First! Boom!\"\n ]\n dan... | node_modules/hubot-archer-quotes/src/archer-quotes.coffee | mikelovskij/sauron2 | 0 | # Description:
# Say Hi to Hubot.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot hello - "hello!"
# hubot orly - "yarly"
#
# Author:
# tombell
lastmessage = ""
sayings =
phrasing: [
"are we not saying phrasing anymore?",
"phrasing?",
"phrasing!",
"On my tits! Whaaat"
"HEY, PHRASING!",
"Goddammit, how are we not doing phrasing?!",
"Um, phrasing?",
"Phrasing, Mother!",
"Ha ha, phrasing.",
"Phrasing! First! Boom!"
]
dangerZone: [
"call Kenny Loggins... 'cuz you're in the DANGER ZONE!",
"Danger Zone!",
"Paging Dr. Loggins",
"The zone will be one of danger?",
"https://www.youtube.com/watch?v=siwpn14IE7E",
"https://www.youtube.com/watch?v=58QOBqAWNzE"
]
blucher: [
"http://giphy.com/gifs/young-mel-brooks-frankenstein-rHWQc2jRLoKoE",
"IHIHIHIHIHIHIHIHIHIHIHI",
"https://www.youtube.com/watch?v=zdIID_TGwhM"
]
module.exports = (robot) ->
robot.brain.data.phrasings ?= []
unless process.env.HUBOT_LESS_ARCHER
# TODO read this from an environment variable
robot.hear /comes|vengo|veniamo|venite|vien|dentro|take it slow|swallow|long ride|happy ending|comin |coming|came |hard/i, (msg) ->
msg.send msg.random sayings.phrasing
robot.hear /danger|zone|zona|pericolo|pericoloso|paura|loggin|logins|obsess|life insurance/i, (msg) ->
msg.send msg.random sayings.dangerZone
robot.hear /blucher/i, (msg) ->
msg.send msg.random sayings.blucher
robot.hear /ocelot/i, (msg) ->
msg.send "I've never seen an ocelot!"
robot.hear /karate/i, (msg) ->
msg.send "Karate? the Dane Cook of martial arts?"
robot.hear /call girl|prostituta|squillo|ragazza/i, (msg) ->
msg.send "No Cyril, when they're dead, they're just hookers"
robot.hear /telephone|phone sex/i, (msg) ->
msg.send "does internet porn know you're cheating on it?"
robot.hear /ruse/i, (msg) ->
msg.send "a ruse? brrring brrring ... hi, it's the 1930's, can we have our words and clothes and shitty airplane back?"
robot.hear /temperature|thermostat|termostato|tempertatur/i, (msg) ->
msg.send "the thermostats are becoming sentient!"
robot.hear /archer/i, (msg) ->
cheerio = require('cheerio')
robot.http('https://en.wikiquote.org/wiki/Archer_%28TV_series%29').get() (error, result, body) ->
if error
msg.send "Encountered an error :( #{error}"
return
$ = cheerio.load(body)
choices = $('dl').map (i, el) ->
$(this).text()
msg.send msg.random choices
robot.hear /(.*)/i, (msg) ->
previousmessage = lastmessage
lastmessage = msg.match[1]
if msg.match[1].match(/phrasing/i)
robot.brain.data.phrasings.push previousmessage
msg.send "Ok, mi ricorderò che il \"#{previousmessage}\" è ambiguamente sessuale"
if new RegExp('^(' + robot.brain.data.phrasings.join('|') + ')$').test(msg.match[1])
msg.send msg.random sayings.phrasing
| 137311 | # Description:
# Say Hi to Hubot.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot hello - "hello!"
# hubot orly - "yarly"
#
# Author:
# tombell
lastmessage = ""
sayings =
phrasing: [
"are we not saying phrasing anymore?",
"phrasing?",
"phrasing!",
"On my tits! Whaaat"
"HEY, PHRASING!",
"Goddammit, how are we not doing phrasing?!",
"Um, phrasing?",
"Phrasing, Mother!",
"Ha ha, phrasing.",
"Phrasing! First! Boom!"
]
dangerZone: [
"call <NAME>... 'cuz you're in the DANGER ZONE!",
"Danger Zone!",
"Paging Dr. <NAME>",
"The zone will be one of danger?",
"https://www.youtube.com/watch?v=siwpn14IE7E",
"https://www.youtube.com/watch?v=58QOBqAWNzE"
]
blucher: [
"http://giphy.com/gifs/young-mel-brooks-frankenstein-rHWQc2jRLoKoE",
"IHIHIHIHIHIHIHIHIHIHIHI",
"https://www.youtube.com/watch?v=zdIID_TGwhM"
]
module.exports = (robot) ->
robot.brain.data.phrasings ?= []
unless process.env.HUBOT_LESS_ARCHER
# TODO read this from an environment variable
robot.hear /comes|vengo|veniamo|venite|vien|dentro|take it slow|swallow|long ride|happy ending|comin |coming|came |hard/i, (msg) ->
msg.send msg.random sayings.phrasing
robot.hear /danger|zone|zona|pericolo|pericoloso|paura|loggin|logins|obsess|life insurance/i, (msg) ->
msg.send msg.random sayings.dangerZone
robot.hear /blucher/i, (msg) ->
msg.send msg.random sayings.blucher
robot.hear /ocelot/i, (msg) ->
msg.send "I've never seen an ocelot!"
robot.hear /karate/i, (msg) ->
msg.send "Karate? the Dane Cook of martial arts?"
robot.hear /call girl|prostituta|squillo|ragazza/i, (msg) ->
msg.send "No Cyril, when they're dead, they're just hookers"
robot.hear /telephone|phone sex/i, (msg) ->
msg.send "does internet porn know you're cheating on it?"
robot.hear /ruse/i, (msg) ->
msg.send "a ruse? brrring brrring ... hi, it's the 1930's, can we have our words and clothes and shitty airplane back?"
robot.hear /temperature|thermostat|termostato|tempertatur/i, (msg) ->
msg.send "the thermostats are becoming sentient!"
robot.hear /archer/i, (msg) ->
cheerio = require('cheerio')
robot.http('https://en.wikiquote.org/wiki/Archer_%28TV_series%29').get() (error, result, body) ->
if error
msg.send "Encountered an error :( #{error}"
return
$ = cheerio.load(body)
choices = $('dl').map (i, el) ->
$(this).text()
msg.send msg.random choices
robot.hear /(.*)/i, (msg) ->
previousmessage = lastmessage
lastmessage = msg.match[1]
if msg.match[1].match(/phrasing/i)
robot.brain.data.phrasings.push previousmessage
msg.send "Ok, mi ricorderò che il \"#{previousmessage}\" è ambiguamente sessuale"
if new RegExp('^(' + robot.brain.data.phrasings.join('|') + ')$').test(msg.match[1])
msg.send msg.random sayings.phrasing
| true | # Description:
# Say Hi to Hubot.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot hello - "hello!"
# hubot orly - "yarly"
#
# Author:
# tombell
lastmessage = ""
sayings =
phrasing: [
"are we not saying phrasing anymore?",
"phrasing?",
"phrasing!",
"On my tits! Whaaat"
"HEY, PHRASING!",
"Goddammit, how are we not doing phrasing?!",
"Um, phrasing?",
"Phrasing, Mother!",
"Ha ha, phrasing.",
"Phrasing! First! Boom!"
]
dangerZone: [
"call PI:NAME:<NAME>END_PI... 'cuz you're in the DANGER ZONE!",
"Danger Zone!",
"Paging Dr. PI:NAME:<NAME>END_PI",
"The zone will be one of danger?",
"https://www.youtube.com/watch?v=siwpn14IE7E",
"https://www.youtube.com/watch?v=58QOBqAWNzE"
]
blucher: [
"http://giphy.com/gifs/young-mel-brooks-frankenstein-rHWQc2jRLoKoE",
"IHIHIHIHIHIHIHIHIHIHIHI",
"https://www.youtube.com/watch?v=zdIID_TGwhM"
]
module.exports = (robot) ->
robot.brain.data.phrasings ?= []
unless process.env.HUBOT_LESS_ARCHER
# TODO read this from an environment variable
robot.hear /comes|vengo|veniamo|venite|vien|dentro|take it slow|swallow|long ride|happy ending|comin |coming|came |hard/i, (msg) ->
msg.send msg.random sayings.phrasing
robot.hear /danger|zone|zona|pericolo|pericoloso|paura|loggin|logins|obsess|life insurance/i, (msg) ->
msg.send msg.random sayings.dangerZone
robot.hear /blucher/i, (msg) ->
msg.send msg.random sayings.blucher
robot.hear /ocelot/i, (msg) ->
msg.send "I've never seen an ocelot!"
robot.hear /karate/i, (msg) ->
msg.send "Karate? the Dane Cook of martial arts?"
robot.hear /call girl|prostituta|squillo|ragazza/i, (msg) ->
msg.send "No Cyril, when they're dead, they're just hookers"
robot.hear /telephone|phone sex/i, (msg) ->
msg.send "does internet porn know you're cheating on it?"
robot.hear /ruse/i, (msg) ->
msg.send "a ruse? brrring brrring ... hi, it's the 1930's, can we have our words and clothes and shitty airplane back?"
robot.hear /temperature|thermostat|termostato|tempertatur/i, (msg) ->
msg.send "the thermostats are becoming sentient!"
robot.hear /archer/i, (msg) ->
cheerio = require('cheerio')
robot.http('https://en.wikiquote.org/wiki/Archer_%28TV_series%29').get() (error, result, body) ->
if error
msg.send "Encountered an error :( #{error}"
return
$ = cheerio.load(body)
choices = $('dl').map (i, el) ->
$(this).text()
msg.send msg.random choices
robot.hear /(.*)/i, (msg) ->
previousmessage = lastmessage
lastmessage = msg.match[1]
if msg.match[1].match(/phrasing/i)
robot.brain.data.phrasings.push previousmessage
msg.send "Ok, mi ricorderò che il \"#{previousmessage}\" è ambiguamente sessuale"
if new RegExp('^(' + robot.brain.data.phrasings.join('|') + ')$').test(msg.match[1])
msg.send msg.random sayings.phrasing
|
[
{
"context": "('[name=\"sign-out__email\"]').val()\n password: $form.find('[name=\"sign-out__pass\"]').val()\n full_name:",
"end": 1049,
"score": 0.8004988431930542,
"start": 1039,
"tag": "PASSWORD",
"value": "$form.find"
},
{
"context": "mail\"]').val()\n password: $f... | resources/themes/lets_cook/assets/coffee/auth.coffee | DDiimmkkaass/lets-cook | 0 | $(document).on "ready", () ->
$(document).on 'submit', '.sign-in__form', (e) ->
e.preventDefault()
$form = $(this)
data =
_token: $form.find('[name="_token"]').val()
email: $form.find('[name="sign-in__mail"]').val()
password: $form.find('[name="sign-in__pass"]').val()
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
success: (response) =>
$('.sign-in__close').click()
if response.status == 'success'
popUp(lang_success, response.message, () ->
setTimeout () ->
window.location.reload()
, 1000
)
else
popUp(lang_error, response.message)
return false
$(document).on 'submit', '.sign-out__form', (e) ->
e.preventDefault()
$form = $(this)
$button = $form.find('[name="sign-out__submit"]')
data =
_token: $form.find('[name="_token"]').val()
email: $form.find('[name="sign-out__email"]').val()
password: $form.find('[name="sign-out__pass"]').val()
full_name: $form.find('[name="sign-out__name"]').val()
phone: $form.find('[name="sign-out__phone"]').val()
additional_phone: $form.find('[name="sign-out__other-phone"]').val()
gender: $form.find('[name="sign-out__radio"]:checked').val()
birthday: $form.find('[name="sign-out__birthday"]').val()
source: $form.find('[name="sign-out__select"]').val()
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
beforeSend: () =>
$button.attr('disabled', 'disabled')
error: (response) =>
Form.processFormSubmitError(response, $form)
$button.removeAttr('disabled')
success: (response) =>
$button.removeAttr('disabled')
if response.status == 'success'
$('.sign-out__close').click()
popUp(lang_success, response.message)
return false
$(document).on 'submit', '.restore__form', (e) ->
e.preventDefault()
$form = $(this)
data = Form.getFormData($form)
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
success: (response) =>
$('.restore__close').click()
if response.status == 'success'
popUp(lang_success, response.message)
$form.find('[name="email"]').val('')
else
popUp(lang_error, response.message)
return false | 58188 | $(document).on "ready", () ->
$(document).on 'submit', '.sign-in__form', (e) ->
e.preventDefault()
$form = $(this)
data =
_token: $form.find('[name="_token"]').val()
email: $form.find('[name="sign-in__mail"]').val()
password: $form.find('[name="sign-in__pass"]').val()
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
success: (response) =>
$('.sign-in__close').click()
if response.status == 'success'
popUp(lang_success, response.message, () ->
setTimeout () ->
window.location.reload()
, 1000
)
else
popUp(lang_error, response.message)
return false
$(document).on 'submit', '.sign-out__form', (e) ->
e.preventDefault()
$form = $(this)
$button = $form.find('[name="sign-out__submit"]')
data =
_token: $form.find('[name="_token"]').val()
email: $form.find('[name="sign-out__email"]').val()
password: <PASSWORD>('[name="<PASSWORD>"]').val()
full_name: $form.find('[name="sign-out__name"]').val()
phone: $form.find('[name="sign-out__phone"]').val()
additional_phone: $form.find('[name="sign-out__other-phone"]').val()
gender: $form.find('[name="sign-out__radio"]:checked').val()
birthday: $form.find('[name="sign-out__birthday"]').val()
source: $form.find('[name="sign-out__select"]').val()
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
beforeSend: () =>
$button.attr('disabled', 'disabled')
error: (response) =>
Form.processFormSubmitError(response, $form)
$button.removeAttr('disabled')
success: (response) =>
$button.removeAttr('disabled')
if response.status == 'success'
$('.sign-out__close').click()
popUp(lang_success, response.message)
return false
$(document).on 'submit', '.restore__form', (e) ->
e.preventDefault()
$form = $(this)
data = Form.getFormData($form)
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
success: (response) =>
$('.restore__close').click()
if response.status == 'success'
popUp(lang_success, response.message)
$form.find('[name="email"]').val('')
else
popUp(lang_error, response.message)
return false | true | $(document).on "ready", () ->
$(document).on 'submit', '.sign-in__form', (e) ->
e.preventDefault()
$form = $(this)
data =
_token: $form.find('[name="_token"]').val()
email: $form.find('[name="sign-in__mail"]').val()
password: $form.find('[name="sign-in__pass"]').val()
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
success: (response) =>
$('.sign-in__close').click()
if response.status == 'success'
popUp(lang_success, response.message, () ->
setTimeout () ->
window.location.reload()
, 1000
)
else
popUp(lang_error, response.message)
return false
$(document).on 'submit', '.sign-out__form', (e) ->
e.preventDefault()
$form = $(this)
$button = $form.find('[name="sign-out__submit"]')
data =
_token: $form.find('[name="_token"]').val()
email: $form.find('[name="sign-out__email"]').val()
password: PI:PASSWORD:<PASSWORD>END_PI('[name="PI:PASSWORD:<PASSWORD>END_PI"]').val()
full_name: $form.find('[name="sign-out__name"]').val()
phone: $form.find('[name="sign-out__phone"]').val()
additional_phone: $form.find('[name="sign-out__other-phone"]').val()
gender: $form.find('[name="sign-out__radio"]:checked').val()
birthday: $form.find('[name="sign-out__birthday"]').val()
source: $form.find('[name="sign-out__select"]').val()
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
beforeSend: () =>
$button.attr('disabled', 'disabled')
error: (response) =>
Form.processFormSubmitError(response, $form)
$button.removeAttr('disabled')
success: (response) =>
$button.removeAttr('disabled')
if response.status == 'success'
$('.sign-out__close').click()
popUp(lang_success, response.message)
return false
$(document).on 'submit', '.restore__form', (e) ->
e.preventDefault()
$form = $(this)
data = Form.getFormData($form)
$.ajax
url: $form.attr('action')
type: "post"
dataType: 'json'
data: data
success: (response) =>
$('.restore__close').click()
if response.status == 'success'
popUp(lang_success, response.message)
$form.find('[name="email"]').val('')
else
popUp(lang_error, response.message)
return false |
[
{
"context": " res) ->\n email = req.body.email\n password = req.body.password\n systemId = req.systemId\n output = {}\n\n ",
"end": 776,
"score": 0.9990115165710449,
"start": 759,
"tag": "PASSWORD",
"value": "req.body.password"
},
{
"context": " {message: err}\n ... | server/controllers/user.coffee | GoIncremental/gi-security | 0 | _ = require 'underscore'
gi = require 'gi-util'
logger = gi.common
module.exports = (model, crudControllerFactory) ->
crud = crudControllerFactory(model)
isUsernameAvailable = (req, res) ->
systemId = req.systemId
email = req.query.username
if email?
model.findOneBy 'email', email, systemId, (err, user) ->
if err?
if err is "Cannot find User"
res.json 200, {available: true}
else
res.json 500, {message: 'error searching by email: ' + err}
else if (not user)
res.json 200, {available: true}
else
res.json 200, {available: false}
else
res.json 200, {available: false}
verify = (req, res) ->
email = req.body.email
password = req.body.password
systemId = req.systemId
output = {}
if email? and password? and systemId?
model.findOneBy 'email', email, systemId, (err, user) ->
if err or (not user)
res.json 200, {valid: false}
else
model.comparePassword user, password, (err, isValid) ->
if err or (not isValid)
res.json 200, {valid: false}
else
output = user.toJSON()
delete output._id
delete output.systemId
delete output.userIds
delete output.password
output.valid = true
res.json 200, output
else
res.status(400).end("Required data not supplied")
showMe = (req, res) ->
model.findById req.user._id, req.systemId, (err, user) ->
if err
res.json 404, {message: err}
else
user.password = null
delete user.password
res.json 200, user
updateMe = (req, res) ->
#first check that the user we want to update is the user
#making the request
if req.user._id is not req.body._id
res.json 401
else
req.body.systemId = req.systemId
model.update req.user._id, req.body, (err, user) ->
if err
res.json 404
else
user.password = null
delete user.password
res.json 200, user
destroyMe = (req, res) ->
model.destroy req.user._id, req.systemId, (err) ->
if err
res.json 404
else
res.json 200
generateAPISecretForMe = (req, res) ->
if req.user._id is not req.body._id
res.json 401
else
model.resetAPISecret req.user._id, req.systemId, (err) ->
if err
res.json 404
else
res.json 200
stripPasswords = (res) ->
if _.isArray res.giResult
_.each res.giResult, (r) ->
r.obj.password = null
delete r.obj.password
r.obj.confirm = null
delete r.obj.confirm
res.json res.giResultCode, res.giResult
else
res.giResult.password = null
delete res.giResult.password
res.giResult.confirm = null
delete res.giResult.confirm
res.json 200, res.giResult
index = (req, res) ->
crud.index req, res, () ->
_.each res.giResult, (u) ->
u.password = null
delete u.password
res.json 200, res.giResult
findById = (req, res) ->
crud.show req, res, () ->
stripPasswords res
create = (req, res) ->
crud.create req, res, () ->
stripPasswords res
update = (req, res) ->
crud.update req, res, () ->
stripPasswords res
checkResetToken = (req, res) ->
if req.body.token?
model.findOneBy 'token', req.body.token, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user
res.json 404, {message: "invalid token"}
else
res.json 200, {message: "token ok"}
else
res.json 200, {isValid: false}
resetPassword = (req, res) ->
if req.body.token?
model.findOneBy 'token', req.body.token, req.systemId, (err, u) ->
if err
res.json 500, {message: err}
else if not u
res.json 404, {message: "invalid token"}
else
user = u.toObject()
updateObj =
password: req.body.password
systemId: req.systemId
$unset:
token: ""
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
msg =
message: "password reset sucesfully"
email: user.email
res.json 200, msg
else
#look for a user with the specified e-mail
#generate a random token
model.findOneBy 'email', req.body.email, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user?
res.json 404, {message: "Could not find account for that e-mail"}
else
model.generateToken (err, token) ->
if err
res.json 500, {message: err}
else if not token
res.json 500, {message: "could not generate reset token"}
else
updateObj =
token: token
systemId: req.systemId
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
resetObj =
host: req.protocol + "://" + req.host
email: user.email
token: token
model.sendResetInstructions resetObj, (err) ->
if err
res.json 500, {message: err}
else
msg = "password reset instructions sent"
res.json 200, {message: msg}
getResetToken = (req, res) ->
if req.body.email?
model.findOneBy 'email', req.body.email, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user?
res.json 404, {message: "Could not find account for that e-mail"}
else
model.generateToken (err, token) ->
if err
res.json 500, {message: err}
else if not token
res.json 500, {message: "could not generate reset token"}
else
updateObj =
token: token
systemId: req.systemId
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
resetObj =
host: req.protocol + "://" + req.host
email: user.email
token: token
_id: user._id
res.json 200, resetObj
else
res.json 500, { message:"No email passed." }
exports = gi.common.extend {}, crud
exports.index = index
exports.show = findById
exports.create = create
exports.update = update
exports.showMe = showMe
exports.updateMe = updateMe
exports.destroyMe = destroyMe
exports.generateAPISecretForMe = generateAPISecretForMe
exports.resetPassword = resetPassword
exports.getResetToken = getResetToken
exports.checkResetToken = checkResetToken
exports.verify = verify
exports.isUsernameAvailable = isUsernameAvailable
exports
| 97259 | _ = require 'underscore'
gi = require 'gi-util'
logger = gi.common
module.exports = (model, crudControllerFactory) ->
crud = crudControllerFactory(model)
isUsernameAvailable = (req, res) ->
systemId = req.systemId
email = req.query.username
if email?
model.findOneBy 'email', email, systemId, (err, user) ->
if err?
if err is "Cannot find User"
res.json 200, {available: true}
else
res.json 500, {message: 'error searching by email: ' + err}
else if (not user)
res.json 200, {available: true}
else
res.json 200, {available: false}
else
res.json 200, {available: false}
verify = (req, res) ->
email = req.body.email
password = <PASSWORD>
systemId = req.systemId
output = {}
if email? and password? and systemId?
model.findOneBy 'email', email, systemId, (err, user) ->
if err or (not user)
res.json 200, {valid: false}
else
model.comparePassword user, password, (err, isValid) ->
if err or (not isValid)
res.json 200, {valid: false}
else
output = user.toJSON()
delete output._id
delete output.systemId
delete output.userIds
delete output.password
output.valid = true
res.json 200, output
else
res.status(400).end("Required data not supplied")
showMe = (req, res) ->
model.findById req.user._id, req.systemId, (err, user) ->
if err
res.json 404, {message: err}
else
user.password = <PASSWORD>
delete user.password
res.json 200, user
updateMe = (req, res) ->
#first check that the user we want to update is the user
#making the request
if req.user._id is not req.body._id
res.json 401
else
req.body.systemId = req.systemId
model.update req.user._id, req.body, (err, user) ->
if err
res.json 404
else
user.password = <PASSWORD>
delete user.password
res.json 200, user
destroyMe = (req, res) ->
model.destroy req.user._id, req.systemId, (err) ->
if err
res.json 404
else
res.json 200
generateAPISecretForMe = (req, res) ->
if req.user._id is not req.body._id
res.json 401
else
model.resetAPISecret req.user._id, req.systemId, (err) ->
if err
res.json 404
else
res.json 200
stripPasswords = (res) ->
if _.isArray res.giResult
_.each res.giResult, (r) ->
r.obj.password = <PASSWORD>
delete r.obj.password
r.obj.confirm = null
delete r.obj.confirm
res.json res.giResultCode, res.giResult
else
res.giResult.password = <PASSWORD>
delete res.giResult.password
res.giResult.confirm = null
delete res.giResult.confirm
res.json 200, res.giResult
index = (req, res) ->
crud.index req, res, () ->
_.each res.giResult, (u) ->
u.password = <PASSWORD>
delete u.password
res.json 200, res.giResult
findById = (req, res) ->
crud.show req, res, () ->
stripPasswords res
create = (req, res) ->
crud.create req, res, () ->
stripPasswords res
update = (req, res) ->
crud.update req, res, () ->
stripPasswords res
checkResetToken = (req, res) ->
if req.body.token?
model.findOneBy 'token', req.body.token, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user
res.json 404, {message: "invalid token"}
else
res.json 200, {message: "token ok"}
else
res.json 200, {isValid: false}
resetPassword = (req, res) ->
if req.body.token?
model.findOneBy 'token', req.body.token, req.systemId, (err, u) ->
if err
res.json 500, {message: err}
else if not u
res.json 404, {message: "invalid token"}
else
user = u.toObject()
updateObj =
password: <PASSWORD>
systemId: req.systemId
$unset:
token: ""
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
msg =
message: "password reset sucesfully"
email: user.email
res.json 200, msg
else
#look for a user with the specified e-mail
#generate a random token
model.findOneBy 'email', req.body.email, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user?
res.json 404, {message: "Could not find account for that e-mail"}
else
model.generateToken (err, token) ->
if err
res.json 500, {message: err}
else if not token
res.json 500, {message: "could not generate reset token"}
else
updateObj =
token: token
systemId: req.systemId
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
resetObj =
host: req.protocol + "://" + req.host
email: user.email
token: token
model.sendResetInstructions resetObj, (err) ->
if err
res.json 500, {message: err}
else
msg = "password reset instructions sent"
res.json 200, {message: msg}
getResetToken = (req, res) ->
if req.body.email?
model.findOneBy 'email', req.body.email, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user?
res.json 404, {message: "Could not find account for that e-mail"}
else
model.generateToken (err, token) ->
if err
res.json 500, {message: err}
else if not token
res.json 500, {message: "could not generate reset token"}
else
updateObj =
token: <PASSWORD>
systemId: req.systemId
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
resetObj =
host: req.protocol + "://" + req.host
email: user.email
token: <PASSWORD>
_id: user._id
res.json 200, resetObj
else
res.json 500, { message:"No email passed." }
exports = gi.common.extend {}, crud
exports.index = index
exports.show = findById
exports.create = create
exports.update = update
exports.showMe = showMe
exports.updateMe = updateMe
exports.destroyMe = destroyMe
exports.generateAPISecretForMe = generateAPISecretForMe
exports.resetPassword = resetPassword
exports.getResetToken = getResetToken
exports.checkResetToken = checkResetToken
exports.verify = verify
exports.isUsernameAvailable = isUsernameAvailable
exports
| true | _ = require 'underscore'
gi = require 'gi-util'
logger = gi.common
module.exports = (model, crudControllerFactory) ->
crud = crudControllerFactory(model)
isUsernameAvailable = (req, res) ->
systemId = req.systemId
email = req.query.username
if email?
model.findOneBy 'email', email, systemId, (err, user) ->
if err?
if err is "Cannot find User"
res.json 200, {available: true}
else
res.json 500, {message: 'error searching by email: ' + err}
else if (not user)
res.json 200, {available: true}
else
res.json 200, {available: false}
else
res.json 200, {available: false}
verify = (req, res) ->
email = req.body.email
password = PI:PASSWORD:<PASSWORD>END_PI
systemId = req.systemId
output = {}
if email? and password? and systemId?
model.findOneBy 'email', email, systemId, (err, user) ->
if err or (not user)
res.json 200, {valid: false}
else
model.comparePassword user, password, (err, isValid) ->
if err or (not isValid)
res.json 200, {valid: false}
else
output = user.toJSON()
delete output._id
delete output.systemId
delete output.userIds
delete output.password
output.valid = true
res.json 200, output
else
res.status(400).end("Required data not supplied")
showMe = (req, res) ->
model.findById req.user._id, req.systemId, (err, user) ->
if err
res.json 404, {message: err}
else
user.password = PI:PASSWORD:<PASSWORD>END_PI
delete user.password
res.json 200, user
updateMe = (req, res) ->
#first check that the user we want to update is the user
#making the request
if req.user._id is not req.body._id
res.json 401
else
req.body.systemId = req.systemId
model.update req.user._id, req.body, (err, user) ->
if err
res.json 404
else
user.password = PI:PASSWORD:<PASSWORD>END_PI
delete user.password
res.json 200, user
destroyMe = (req, res) ->
model.destroy req.user._id, req.systemId, (err) ->
if err
res.json 404
else
res.json 200
generateAPISecretForMe = (req, res) ->
if req.user._id is not req.body._id
res.json 401
else
model.resetAPISecret req.user._id, req.systemId, (err) ->
if err
res.json 404
else
res.json 200
stripPasswords = (res) ->
if _.isArray res.giResult
_.each res.giResult, (r) ->
r.obj.password = PI:PASSWORD:<PASSWORD>END_PI
delete r.obj.password
r.obj.confirm = null
delete r.obj.confirm
res.json res.giResultCode, res.giResult
else
res.giResult.password = PI:PASSWORD:<PASSWORD>END_PI
delete res.giResult.password
res.giResult.confirm = null
delete res.giResult.confirm
res.json 200, res.giResult
index = (req, res) ->
crud.index req, res, () ->
_.each res.giResult, (u) ->
u.password = PI:PASSWORD:<PASSWORD>END_PI
delete u.password
res.json 200, res.giResult
findById = (req, res) ->
crud.show req, res, () ->
stripPasswords res
create = (req, res) ->
crud.create req, res, () ->
stripPasswords res
update = (req, res) ->
crud.update req, res, () ->
stripPasswords res
checkResetToken = (req, res) ->
if req.body.token?
model.findOneBy 'token', req.body.token, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user
res.json 404, {message: "invalid token"}
else
res.json 200, {message: "token ok"}
else
res.json 200, {isValid: false}
resetPassword = (req, res) ->
if req.body.token?
model.findOneBy 'token', req.body.token, req.systemId, (err, u) ->
if err
res.json 500, {message: err}
else if not u
res.json 404, {message: "invalid token"}
else
user = u.toObject()
updateObj =
password: PI:PASSWORD:<PASSWORD>END_PI
systemId: req.systemId
$unset:
token: ""
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
msg =
message: "password reset sucesfully"
email: user.email
res.json 200, msg
else
#look for a user with the specified e-mail
#generate a random token
model.findOneBy 'email', req.body.email, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user?
res.json 404, {message: "Could not find account for that e-mail"}
else
model.generateToken (err, token) ->
if err
res.json 500, {message: err}
else if not token
res.json 500, {message: "could not generate reset token"}
else
updateObj =
token: token
systemId: req.systemId
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
resetObj =
host: req.protocol + "://" + req.host
email: user.email
token: token
model.sendResetInstructions resetObj, (err) ->
if err
res.json 500, {message: err}
else
msg = "password reset instructions sent"
res.json 200, {message: msg}
getResetToken = (req, res) ->
if req.body.email?
model.findOneBy 'email', req.body.email, req.systemId, (err, user) ->
if err
res.json 500, {message: err}
else if not user?
res.json 404, {message: "Could not find account for that e-mail"}
else
model.generateToken (err, token) ->
if err
res.json 500, {message: err}
else if not token
res.json 500, {message: "could not generate reset token"}
else
updateObj =
token: PI:PASSWORD:<PASSWORD>END_PI
systemId: req.systemId
model.update user._id, updateObj, (err, obj) ->
if err
res.json 500, {message: "error saving token to user " + err}
else
resetObj =
host: req.protocol + "://" + req.host
email: user.email
token: PI:PASSWORD:<PASSWORD>END_PI
_id: user._id
res.json 200, resetObj
else
res.json 500, { message:"No email passed." }
exports = gi.common.extend {}, crud
exports.index = index
exports.show = findById
exports.create = create
exports.update = update
exports.showMe = showMe
exports.updateMe = updateMe
exports.destroyMe = destroyMe
exports.generateAPISecretForMe = generateAPISecretForMe
exports.resetPassword = resetPassword
exports.getResetToken = getResetToken
exports.checkResetToken = checkResetToken
exports.verify = verify
exports.isUsernameAvailable = isUsernameAvailable
exports
|
[
{
"context": "rty\n#\n# Commands:\n# house party\n#\n# Author:\n# sagasu\n\nhouseParty = [\n \"this is how my last party l",
"end": 110,
"score": 0.6212261915206909,
"start": 107,
"tag": "USERNAME",
"value": "sag"
},
{
"context": "#\n# Commands:\n# house party\n#\n# Author:\... | src/party.coffee | sagasu/hubot-houseparty | 0 | # Description:
# react when someone mentions house party
#
# Commands:
# house party
#
# Author:
# sagasu
houseParty = [
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/1.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/2.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/3.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/4.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/5.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/6.jpg?raw=true"
]
module.exports = (robot) ->
robot.hear /house party/i, (msg) ->
msg.send msg.random houseParty
| 157475 | # Description:
# react when someone mentions house party
#
# Commands:
# house party
#
# Author:
# sag<NAME>
houseParty = [
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/1.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/2.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/3.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/4.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/5.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/6.jpg?raw=true"
]
module.exports = (robot) ->
robot.hear /house party/i, (msg) ->
msg.send msg.random houseParty
| true | # Description:
# react when someone mentions house party
#
# Commands:
# house party
#
# Author:
# sagPI:NAME:<NAME>END_PI
houseParty = [
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/1.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/2.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/3.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/4.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/5.jpg?raw=true",
"this is how my last party looked like: https://github.com/sagasu/hubot-houseparty/blob/master/img/6.jpg?raw=true"
]
module.exports = (robot) ->
robot.hear /house party/i, (msg) ->
msg.send msg.random houseParty
|
[
{
"context": " productType: productType\n productBrand: \"Calvin Klein\"\n imageUrl: (e.querySelector(\"img\").getAtt",
"end": 913,
"score": 0.9989370107650757,
"start": 901,
"tag": "NAME",
"value": "Calvin Klein"
}
] | private/indexer/calvin_klein.coffee | wangjohn/shopperling | 1 | casper = require('casper').create(
clientScripts: ["../../client/lib/jquery.js"]
waitTimeout: 10000
)
fs = require('fs')
LINKS = [{productType: "sweaters", url: "http://www.calvinklein.com/shop/en/ck/search/womens-sweaters"},
{productType: "tops", url: "http://www.calvinklein.com/shop/en/ck/search/womens-knits-tops"}]
BASE_URL = "http://www.calvinklein.com"
DATA_STORAGE_FILENAME = "../data/calvin_klein.json"
data = []
#casper.on 'remote.message', (msg) ->
# @echo("REMOTE: " + msg)
writeData = (data) ->
currentFile = require('system').args[3]
fs.write(DATA_STORAGE_FILENAME, data, "w")
evaluateData = (casper, productType) ->
casper.then ->
result = @evaluate (productType, baseUrl) ->
productContainers = document.querySelectorAll(".product_image.product")
Array::map.call productContainers, (e) ->
productType: productType
productBrand: "Calvin Klein"
imageUrl: (e.querySelector("img").getAttribute("data-src"))
productUrl: (e.querySelector("a.productThumbnail").getAttribute("href"))
productName: $.trim(e.querySelector(".productInfo .title a").innerHTML)
, { productType: productType, baseUrl: BASE_URL }
data = data.concat(result)
populateData = (casper) ->
linkCounter = 0
while linkCounter < LINKS.length
casper.thenOpen(LINKS[linkCounter].url)
casper.waitForSelector("#four-grid")
evaluateData(casper, LINKS[linkCounter].productType)
linkCounter += 1
getExtraInformation = (casper, dataObject) ->
unless (/(13496756|14423249)/.test(dataObject.productUrl))
casper.thenOpen(dataObject.productUrl)
casper.then ->
@echo dataObject.productUrl
casper.waitForSelector("#product")
casper.then ->
newInfo = @evaluate ->
extraInfo: document.querySelector("#product .hidden-phone .description").innerHTML
productPrice: (parseInt($.trim(document.querySelector(".product_list span.price:last-of-type").innerHTML).slice(1), 10) * 100)
@echo newInfo.productPrice
dataObject.extraInformation = newInfo.extraInfo
dataObject.productPrice = newInfo.productPrice
scrape = (casper) ->
casper.start()
populateData(casper)
casper.then ->
@echo data.length
@echo "GETTING EXTRA INFORMATION"
for datum in data
getExtraInformation(casper, datum)
casper.then ->
jsonData = JSON.stringify(data)
writeData(jsonData)
@echo jsonData
casper.then ->
@exit()
casper.run()
scrape(casper)
| 161585 | casper = require('casper').create(
clientScripts: ["../../client/lib/jquery.js"]
waitTimeout: 10000
)
fs = require('fs')
LINKS = [{productType: "sweaters", url: "http://www.calvinklein.com/shop/en/ck/search/womens-sweaters"},
{productType: "tops", url: "http://www.calvinklein.com/shop/en/ck/search/womens-knits-tops"}]
BASE_URL = "http://www.calvinklein.com"
DATA_STORAGE_FILENAME = "../data/calvin_klein.json"
data = []
#casper.on 'remote.message', (msg) ->
# @echo("REMOTE: " + msg)
writeData = (data) ->
currentFile = require('system').args[3]
fs.write(DATA_STORAGE_FILENAME, data, "w")
evaluateData = (casper, productType) ->
casper.then ->
result = @evaluate (productType, baseUrl) ->
productContainers = document.querySelectorAll(".product_image.product")
Array::map.call productContainers, (e) ->
productType: productType
productBrand: "<NAME>"
imageUrl: (e.querySelector("img").getAttribute("data-src"))
productUrl: (e.querySelector("a.productThumbnail").getAttribute("href"))
productName: $.trim(e.querySelector(".productInfo .title a").innerHTML)
, { productType: productType, baseUrl: BASE_URL }
data = data.concat(result)
populateData = (casper) ->
linkCounter = 0
while linkCounter < LINKS.length
casper.thenOpen(LINKS[linkCounter].url)
casper.waitForSelector("#four-grid")
evaluateData(casper, LINKS[linkCounter].productType)
linkCounter += 1
getExtraInformation = (casper, dataObject) ->
unless (/(13496756|14423249)/.test(dataObject.productUrl))
casper.thenOpen(dataObject.productUrl)
casper.then ->
@echo dataObject.productUrl
casper.waitForSelector("#product")
casper.then ->
newInfo = @evaluate ->
extraInfo: document.querySelector("#product .hidden-phone .description").innerHTML
productPrice: (parseInt($.trim(document.querySelector(".product_list span.price:last-of-type").innerHTML).slice(1), 10) * 100)
@echo newInfo.productPrice
dataObject.extraInformation = newInfo.extraInfo
dataObject.productPrice = newInfo.productPrice
scrape = (casper) ->
casper.start()
populateData(casper)
casper.then ->
@echo data.length
@echo "GETTING EXTRA INFORMATION"
for datum in data
getExtraInformation(casper, datum)
casper.then ->
jsonData = JSON.stringify(data)
writeData(jsonData)
@echo jsonData
casper.then ->
@exit()
casper.run()
scrape(casper)
| true | casper = require('casper').create(
clientScripts: ["../../client/lib/jquery.js"]
waitTimeout: 10000
)
fs = require('fs')
LINKS = [{productType: "sweaters", url: "http://www.calvinklein.com/shop/en/ck/search/womens-sweaters"},
{productType: "tops", url: "http://www.calvinklein.com/shop/en/ck/search/womens-knits-tops"}]
BASE_URL = "http://www.calvinklein.com"
DATA_STORAGE_FILENAME = "../data/calvin_klein.json"
data = []
#casper.on 'remote.message', (msg) ->
# @echo("REMOTE: " + msg)
writeData = (data) ->
currentFile = require('system').args[3]
fs.write(DATA_STORAGE_FILENAME, data, "w")
evaluateData = (casper, productType) ->
casper.then ->
result = @evaluate (productType, baseUrl) ->
productContainers = document.querySelectorAll(".product_image.product")
Array::map.call productContainers, (e) ->
productType: productType
productBrand: "PI:NAME:<NAME>END_PI"
imageUrl: (e.querySelector("img").getAttribute("data-src"))
productUrl: (e.querySelector("a.productThumbnail").getAttribute("href"))
productName: $.trim(e.querySelector(".productInfo .title a").innerHTML)
, { productType: productType, baseUrl: BASE_URL }
data = data.concat(result)
populateData = (casper) ->
linkCounter = 0
while linkCounter < LINKS.length
casper.thenOpen(LINKS[linkCounter].url)
casper.waitForSelector("#four-grid")
evaluateData(casper, LINKS[linkCounter].productType)
linkCounter += 1
getExtraInformation = (casper, dataObject) ->
unless (/(13496756|14423249)/.test(dataObject.productUrl))
casper.thenOpen(dataObject.productUrl)
casper.then ->
@echo dataObject.productUrl
casper.waitForSelector("#product")
casper.then ->
newInfo = @evaluate ->
extraInfo: document.querySelector("#product .hidden-phone .description").innerHTML
productPrice: (parseInt($.trim(document.querySelector(".product_list span.price:last-of-type").innerHTML).slice(1), 10) * 100)
@echo newInfo.productPrice
dataObject.extraInformation = newInfo.extraInfo
dataObject.productPrice = newInfo.productPrice
scrape = (casper) ->
casper.start()
populateData(casper)
casper.then ->
@echo data.length
@echo "GETTING EXTRA INFORMATION"
for datum in data
getExtraInformation(casper, datum)
casper.then ->
jsonData = JSON.stringify(data)
writeData(jsonData)
@echo jsonData
casper.then ->
@exit()
casper.run()
scrape(casper)
|
[
{
"context": "please replace this with your own id\n secret: \"c67378e5e2d1f349397eb15f34e7f889\" # please replace this with your own secret\n\n @g",
"end": 170,
"score": 0.9997437596321106,
"start": 138,
"tag": "KEY",
"value": "c67378e5e2d1f349397eb15f34e7f889"
},
{
"context": "... | lib/configuration.coffee | tyrchen/teamspark | 21 | if Meteor.isServer
@weibo_service =
service: "weibo"
clientId: "2737982731" # please replace this with your own id
secret: "c67378e5e2d1f349397eb15f34e7f889" # please replace this with your own secret
@github_service =
service: "github"
clientId: "70316cc48b0cc9a6fa32"
secret: "c30d604147e1d26e3b06d49e7b63281bcaa26375"
if Meteor.isClient
Meteor.startup ->
filepicker.setKey 'An2MQKIF1S7i1SF2xa3e0z' #Please change this to your own filepicker.io api key (you will have 5000 files per month for free) | 104828 | if Meteor.isServer
@weibo_service =
service: "weibo"
clientId: "2737982731" # please replace this with your own id
secret: "<KEY>" # please replace this with your own secret
@github_service =
service: "github"
clientId: "70316cc48b0cc9a6fa32"
secret: "<KEY>"
if Meteor.isClient
Meteor.startup ->
filepicker.setKey '<KEY>' #Please change this to your own filepicker.io api key (you will have 5000 files per month for free) | true | if Meteor.isServer
@weibo_service =
service: "weibo"
clientId: "2737982731" # please replace this with your own id
secret: "PI:KEY:<KEY>END_PI" # please replace this with your own secret
@github_service =
service: "github"
clientId: "70316cc48b0cc9a6fa32"
secret: "PI:KEY:<KEY>END_PI"
if Meteor.isClient
Meteor.startup ->
filepicker.setKey 'PI:KEY:<KEY>END_PI' #Please change this to your own filepicker.io api key (you will have 5000 files per month for free) |
[
{
"context": "###\n backbone-http.js 0.5.5\n Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-http\n Lic",
"end": 58,
"score": 0.9992840886116028,
"start": 50,
"tag": "NAME",
"value": "Vidigami"
},
{
"context": " Copyright (c) 2013 Vidigami - https://github.com/v... | src/index.coffee | michaelBenin/backbone-http | 1 | ###
backbone-http.js 0.5.5
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-http
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Backbone.js, Underscore.js, Moment.js, Inflection.js, BackboneORM, and Superagent.
###
# ensure the client symbols are resolved
if window? and require.shim
require.shim([
{symbol: '_', path: 'lodash', alias: 'underscore', optional: true}, {symbol: '_', path: 'underscore'}
{symbol: 'Backbone', path: 'backbone'}
{symbol: 'moment', path: 'moment'}
# {symbol: 'inflection', path: 'inflection'} # burned in
{symbol: 'stream', path: 'stream', optional: true} # stream is large so it is optional on the client
{symbol: 'BackboneORM', path: 'backbone-orm'}
{symbol: 'superagent', path: 'superagent'}
])
module.exports =
sync: require './sync'
# re-expose modules
modules:
'backbone-orm': bborm = require 'backbone-orm'
'superagent': require 'superagent'
for path in ['url', 'querystring', 'lru-cache', 'underscore', 'backbone', 'moment', 'inflection', 'stream']
module.exports.modules[path] = bborm.modules[path]
| 55419 | ###
backbone-http.js 0.5.5
Copyright (c) 2013 <NAME> - https://github.com/vidigami/backbone-http
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Backbone.js, Underscore.js, Moment.js, Inflection.js, BackboneORM, and Superagent.
###
# ensure the client symbols are resolved
if window? and require.shim
require.shim([
{symbol: '_', path: 'lodash', alias: 'underscore', optional: true}, {symbol: '_', path: 'underscore'}
{symbol: 'Backbone', path: 'backbone'}
{symbol: 'moment', path: 'moment'}
# {symbol: 'inflection', path: 'inflection'} # burned in
{symbol: 'stream', path: 'stream', optional: true} # stream is large so it is optional on the client
{symbol: 'BackboneORM', path: 'backbone-orm'}
{symbol: 'superagent', path: 'superagent'}
])
module.exports =
sync: require './sync'
# re-expose modules
modules:
'backbone-orm': bborm = require 'backbone-orm'
'superagent': require 'superagent'
for path in ['url', 'querystring', 'lru-cache', 'underscore', 'backbone', 'moment', 'inflection', 'stream']
module.exports.modules[path] = bborm.modules[path]
| true | ###
backbone-http.js 0.5.5
Copyright (c) 2013 PI:NAME:<NAME>END_PI - https://github.com/vidigami/backbone-http
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Backbone.js, Underscore.js, Moment.js, Inflection.js, BackboneORM, and Superagent.
###
# ensure the client symbols are resolved
if window? and require.shim
require.shim([
{symbol: '_', path: 'lodash', alias: 'underscore', optional: true}, {symbol: '_', path: 'underscore'}
{symbol: 'Backbone', path: 'backbone'}
{symbol: 'moment', path: 'moment'}
# {symbol: 'inflection', path: 'inflection'} # burned in
{symbol: 'stream', path: 'stream', optional: true} # stream is large so it is optional on the client
{symbol: 'BackboneORM', path: 'backbone-orm'}
{symbol: 'superagent', path: 'superagent'}
])
module.exports =
sync: require './sync'
# re-expose modules
modules:
'backbone-orm': bborm = require 'backbone-orm'
'superagent': require 'superagent'
for path in ['url', 'querystring', 'lru-cache', 'underscore', 'backbone', 'moment', 'inflection', 'stream']
module.exports.modules[path] = bborm.modules[path]
|
[
{
"context": "hen keys present)\n i = 1\n loop\n key = \"ZNAME#{i}\"\n break unless header.contains(key)\n \n ",
"end": 1551,
"score": 0.9990522265434265,
"start": 1541,
"tag": "KEY",
"value": "ZNAME#{i}\""
}
] | src/compressed-image.coffee | astrojs/fitsjs | 57 |
class CompressedImage extends BinaryTable
@include ImageUtils
@extend Decompress
# Predefined random number generator from http://arxiv.org/pdf/1201.1336v1.pdf
# This is the same method used by fpack when dithering images during compression.
@randomGenerator: ->
a = 16807
m = 2147483647
seed = 1
random = new Float32Array(10000)
for i in [0..9999]
temp = a * seed
seed = temp - m * parseInt(temp / m)
random[i] = seed / m
return random
# Store random look up table on class.
@randomSequence = @randomGenerator()
constructor: (header, data) ->
super
# Get compression values
@zcmptype = header.get("ZCMPTYPE")
@zbitpix = header.get("ZBITPIX")
@znaxis = header.get("ZNAXIS")
@zblank = header.get("ZBLANK")
@blank = header.get("BLANK")
@zdither = header.get('ZDITHER0') or 0
@ztile = []
for i in [1..@znaxis]
ztile = if header.contains("ZTILE#{i}") then header.get("ZTILE#{i}") else if i is 1 then header.get("ZNAXIS1") else 1
@ztile.push ztile
@width = header.get("ZNAXIS1")
@height = header.get("ZNAXIS2") or 1
# Storage for compression algorithm parameters
@algorithmParameters = {}
# Set default parameters
if @zcmptype is 'RICE_1'
@algorithmParameters["BLOCKSIZE"] = 32
@algorithmParameters["BYTEPIX"] = 4
# Get compression algorithm parameters (override defaults when keys present)
i = 1
loop
key = "ZNAME#{i}"
break unless header.contains(key)
value = "ZVAL#{i}"
@algorithmParameters[ header.get(key) ] = header.get(value)
i += 1
@zmaskcmp = header.get("ZMASKCMP")
@zquantiz = header.get("ZQUANTIZ") or "LINEAR_SCALING"
@bzero = header.get("BZERO") or 0
@bscale = header.get("BSCALE") or 1
_getRows: (buffer, nRows) ->
# Set up view and offset
view = new DataView(buffer)
offset = 0
# Set up storage for frame
arr = new Float32Array(@width * @height)
# Read each row (tile)
while nRows--
# Storage for current row
row = {}
for accessor, index in @accessors
# Read value from each column in current row
[value, offset] = accessor(view, offset)
row[ @columns[index] ] = value
# Get array from column with returned values
# TODO: Check that data is returned correctly when UNCOMPRESSED_DATA or GZIP_COMPRESSED_DATA present
data = row['COMPRESSED_DATA'] or row['UNCOMPRESSED_DATA'] or row['GZIP_COMPRESSED_DATA']
blank = row['ZBLANK'] or @zblank
scale = row['ZSCALE'] or @bscale
zero = row['ZZERO'] or @bzero
# Set initial seeds using tile number and ZDITHER0 (assuming row by row tiling)
nTile = @height - nRows
seed0 = nTile + @zdither - 1
seed1 = (seed0 - 1) % 10000
# Set initial index in random sequence
rIndex = parseInt(@constructor.randomSequence[seed1] * 500)
for value, index in data
# Get the pixel index
i = (nTile - 1) * @width + index
if value is -2147483647
arr[i] = NaN
else if value is -2147483646
arr[i] = 0
else
r = @constructor.randomSequence[rIndex]
arr[i] = (value - r + 0.5) * scale + zero
# Update the random index
rIndex += 1
if rIndex is 10000
seed1 = (seed1 + 1) % 10000
rIndex = parseInt(@randomSequence[seed1] * 500)
return arr
# Even though compressed images are represented as a binary table
# the API should expose the same method as images.
# TODO: Support compressed data cubes
getFrame: (nFrame, callback, opts) ->
# Check if heap in memory
if @heap
@frame = nFrame or @frame
# TODO: Row parameters should be adjusted when working with data cubes
@getRows(0, @rows, callback, opts)
else
# Get blob representing heap
heapBlob = @blob.slice(@length, @length + @heapLength)
# Create file reader
reader = new FileReader()
reader.onloadend = (e) =>
@heap = e.target.result
# Call function again
@getFrame(nFrame, callback, opts)
reader.readAsArrayBuffer(heapBlob)
@astro.FITS.CompressedImage = CompressedImage | 170205 |
class CompressedImage extends BinaryTable
@include ImageUtils
@extend Decompress
# Predefined random number generator from http://arxiv.org/pdf/1201.1336v1.pdf
# This is the same method used by fpack when dithering images during compression.
@randomGenerator: ->
a = 16807
m = 2147483647
seed = 1
random = new Float32Array(10000)
for i in [0..9999]
temp = a * seed
seed = temp - m * parseInt(temp / m)
random[i] = seed / m
return random
# Store random look up table on class.
@randomSequence = @randomGenerator()
constructor: (header, data) ->
super
# Get compression values
@zcmptype = header.get("ZCMPTYPE")
@zbitpix = header.get("ZBITPIX")
@znaxis = header.get("ZNAXIS")
@zblank = header.get("ZBLANK")
@blank = header.get("BLANK")
@zdither = header.get('ZDITHER0') or 0
@ztile = []
for i in [1..@znaxis]
ztile = if header.contains("ZTILE#{i}") then header.get("ZTILE#{i}") else if i is 1 then header.get("ZNAXIS1") else 1
@ztile.push ztile
@width = header.get("ZNAXIS1")
@height = header.get("ZNAXIS2") or 1
# Storage for compression algorithm parameters
@algorithmParameters = {}
# Set default parameters
if @zcmptype is 'RICE_1'
@algorithmParameters["BLOCKSIZE"] = 32
@algorithmParameters["BYTEPIX"] = 4
# Get compression algorithm parameters (override defaults when keys present)
i = 1
loop
key = "<KEY>
break unless header.contains(key)
value = "ZVAL#{i}"
@algorithmParameters[ header.get(key) ] = header.get(value)
i += 1
@zmaskcmp = header.get("ZMASKCMP")
@zquantiz = header.get("ZQUANTIZ") or "LINEAR_SCALING"
@bzero = header.get("BZERO") or 0
@bscale = header.get("BSCALE") or 1
_getRows: (buffer, nRows) ->
# Set up view and offset
view = new DataView(buffer)
offset = 0
# Set up storage for frame
arr = new Float32Array(@width * @height)
# Read each row (tile)
while nRows--
# Storage for current row
row = {}
for accessor, index in @accessors
# Read value from each column in current row
[value, offset] = accessor(view, offset)
row[ @columns[index] ] = value
# Get array from column with returned values
# TODO: Check that data is returned correctly when UNCOMPRESSED_DATA or GZIP_COMPRESSED_DATA present
data = row['COMPRESSED_DATA'] or row['UNCOMPRESSED_DATA'] or row['GZIP_COMPRESSED_DATA']
blank = row['ZBLANK'] or @zblank
scale = row['ZSCALE'] or @bscale
zero = row['ZZERO'] or @bzero
# Set initial seeds using tile number and ZDITHER0 (assuming row by row tiling)
nTile = @height - nRows
seed0 = nTile + @zdither - 1
seed1 = (seed0 - 1) % 10000
# Set initial index in random sequence
rIndex = parseInt(@constructor.randomSequence[seed1] * 500)
for value, index in data
# Get the pixel index
i = (nTile - 1) * @width + index
if value is -2147483647
arr[i] = NaN
else if value is -2147483646
arr[i] = 0
else
r = @constructor.randomSequence[rIndex]
arr[i] = (value - r + 0.5) * scale + zero
# Update the random index
rIndex += 1
if rIndex is 10000
seed1 = (seed1 + 1) % 10000
rIndex = parseInt(@randomSequence[seed1] * 500)
return arr
# Even though compressed images are represented as a binary table
# the API should expose the same method as images.
# TODO: Support compressed data cubes
getFrame: (nFrame, callback, opts) ->
# Check if heap in memory
if @heap
@frame = nFrame or @frame
# TODO: Row parameters should be adjusted when working with data cubes
@getRows(0, @rows, callback, opts)
else
# Get blob representing heap
heapBlob = @blob.slice(@length, @length + @heapLength)
# Create file reader
reader = new FileReader()
reader.onloadend = (e) =>
@heap = e.target.result
# Call function again
@getFrame(nFrame, callback, opts)
reader.readAsArrayBuffer(heapBlob)
@astro.FITS.CompressedImage = CompressedImage | true |
class CompressedImage extends BinaryTable
@include ImageUtils
@extend Decompress
# Predefined random number generator from http://arxiv.org/pdf/1201.1336v1.pdf
# This is the same method used by fpack when dithering images during compression.
@randomGenerator: ->
a = 16807
m = 2147483647
seed = 1
random = new Float32Array(10000)
for i in [0..9999]
temp = a * seed
seed = temp - m * parseInt(temp / m)
random[i] = seed / m
return random
# Store random look up table on class.
@randomSequence = @randomGenerator()
constructor: (header, data) ->
super
# Get compression values
@zcmptype = header.get("ZCMPTYPE")
@zbitpix = header.get("ZBITPIX")
@znaxis = header.get("ZNAXIS")
@zblank = header.get("ZBLANK")
@blank = header.get("BLANK")
@zdither = header.get('ZDITHER0') or 0
@ztile = []
for i in [1..@znaxis]
ztile = if header.contains("ZTILE#{i}") then header.get("ZTILE#{i}") else if i is 1 then header.get("ZNAXIS1") else 1
@ztile.push ztile
@width = header.get("ZNAXIS1")
@height = header.get("ZNAXIS2") or 1
# Storage for compression algorithm parameters
@algorithmParameters = {}
# Set default parameters
if @zcmptype is 'RICE_1'
@algorithmParameters["BLOCKSIZE"] = 32
@algorithmParameters["BYTEPIX"] = 4
# Get compression algorithm parameters (override defaults when keys present)
i = 1
loop
key = "PI:KEY:<KEY>END_PI
break unless header.contains(key)
value = "ZVAL#{i}"
@algorithmParameters[ header.get(key) ] = header.get(value)
i += 1
@zmaskcmp = header.get("ZMASKCMP")
@zquantiz = header.get("ZQUANTIZ") or "LINEAR_SCALING"
@bzero = header.get("BZERO") or 0
@bscale = header.get("BSCALE") or 1
_getRows: (buffer, nRows) ->
# Set up view and offset
view = new DataView(buffer)
offset = 0
# Set up storage for frame
arr = new Float32Array(@width * @height)
# Read each row (tile)
while nRows--
# Storage for current row
row = {}
for accessor, index in @accessors
# Read value from each column in current row
[value, offset] = accessor(view, offset)
row[ @columns[index] ] = value
# Get array from column with returned values
# TODO: Check that data is returned correctly when UNCOMPRESSED_DATA or GZIP_COMPRESSED_DATA present
data = row['COMPRESSED_DATA'] or row['UNCOMPRESSED_DATA'] or row['GZIP_COMPRESSED_DATA']
blank = row['ZBLANK'] or @zblank
scale = row['ZSCALE'] or @bscale
zero = row['ZZERO'] or @bzero
# Set initial seeds using tile number and ZDITHER0 (assuming row by row tiling)
nTile = @height - nRows
seed0 = nTile + @zdither - 1
seed1 = (seed0 - 1) % 10000
# Set initial index in random sequence
rIndex = parseInt(@constructor.randomSequence[seed1] * 500)
for value, index in data
# Get the pixel index
i = (nTile - 1) * @width + index
if value is -2147483647
arr[i] = NaN
else if value is -2147483646
arr[i] = 0
else
r = @constructor.randomSequence[rIndex]
arr[i] = (value - r + 0.5) * scale + zero
# Update the random index
rIndex += 1
if rIndex is 10000
seed1 = (seed1 + 1) % 10000
rIndex = parseInt(@randomSequence[seed1] * 500)
return arr
# Even though compressed images are represented as a binary table
# the API should expose the same method as images.
# TODO: Support compressed data cubes
getFrame: (nFrame, callback, opts) ->
# Check if heap in memory
if @heap
@frame = nFrame or @frame
# TODO: Row parameters should be adjusted when working with data cubes
@getRows(0, @rows, callback, opts)
else
# Get blob representing heap
heapBlob = @blob.slice(@length, @length + @heapLength)
# Create file reader
reader = new FileReader()
reader.onloadend = (e) =>
@heap = e.target.result
# Call function again
@getFrame(nFrame, callback, opts)
reader.readAsArrayBuffer(heapBlob)
@astro.FITS.CompressedImage = CompressedImage |
[
{
"context": "sMissingHeaderWarning = true\n im\n\nCHANNEL_KEY = 'retailerA'\n\nuniqueId = (prefix) ->\n _.uniqueId \"#{prefix}#",
"end": 1038,
"score": 0.9416084885597229,
"start": 1029,
"tag": "KEY",
"value": "retailerA"
}
] | src/spec/integration/categoryOrderHint.spec.coffee | daern91/sphere-node-product-csv-sync | 0 | _ = require 'underscore'
_.mixin require('underscore-mixins')
{Import, Export} = require '../../lib/main'
Config = require '../../config'
TestHelpers = require './testhelpers'
Promise = require 'bluebird'
fs = Promise.promisifyAll require('fs')
{ client_id, client_secret, project_key } = Config.config
authConfig = {
host: 'https://auth.sphere.io'
projectKey: project_key
credentials: {
clientId: client_id
clientSecret: client_secret
}
}
httpConfig = { host: 'https://api.sphere.io' }
userAgentConfig = {}
defaultProduct = (productTypeId, categoryId) ->
name:
en: 'test product'
productType:
typeId: 'product-type'
id: productTypeId
slug:
en: TestHelpers.uniqueId 'slug-'
categories: [
typeId: 'category'
id: categoryId
]
masterVariant: {}
createImporter = ->
im = new Import {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
}
im.allowRemovalOfVariants = true
im.suppressMissingHeaderWarning = true
im
CHANNEL_KEY = 'retailerA'
uniqueId = (prefix) ->
_.uniqueId "#{prefix}#{new Date().getTime()}_"
newCategory = (name = 'Category name', externalId = 'externalCategoryId') ->
name:
en: name
slug:
en: uniqueId 'c'
externalId: externalId
prepareCategoryAndProduct = (done) ->
jasmine.getEnv().defaultTimeoutInterval = 120000 # 2mins
@export = new Export {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
}
@importer = createImporter()
@importer.suppressMissingHeaderWarning = true
@client = @importer.client
console.log 'create a category to work with'
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory()
}
@client.execute request
.then (results) =>
@category = results.body
console.log "Created #{results.length} categories"
@productType = TestHelpers.mockProductType()
TestHelpers.setupProductType(@client, @productType, null, project_key)
.then (result) =>
@productType = result
# Check if channel exists
service = TestHelpers.createService(project_key, 'channels')
request = {
uri: service
.where("key=\"#{CHANNEL_KEY}\"")
.build()
method: 'GET'
}
@client.execute request
.then (result) =>
# Create the channel if it doesn't exist else ignore
if (!result.body.total)
service = TestHelpers.createService(project_key, 'channels')
request = {
uri: service.build()
method: 'POST'
body:
key: CHANNEL_KEY
roles: ['InventorySupply']
}
@client.execute request
.then -> done()
.catch (error) -> done(_.prettify(error))
describe 'categoryOrderHints', ->
describe 'Import', ->
beforeEach prepareCategoryAndProduct
afterEach (done) ->
console.log 'About to delete all categories'
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'GET'
}
@client.process request, (payload) =>
console.log "Deleting #{payload.body.count} categories"
Promise.map payload.body.results, (category) =>
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service
.byId(category.id)
.withVersion(category.version)
.build()
method: 'DELETE'
}
@client.execute request
.then (results) =>
console.log "Deleted #{results.length} categories"
console.log "Delete all the created products"
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'GET'
}
@client.process request, (payload) =>
console.log "Deleting #{payload.body.count} products"
Promise.map payload.body.results, (product) =>
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service
.byId(product.id)
.withVersion(product.version)
.build()
method: 'DELETE'
}
@client.execute request
.then (results) ->
console.log "Deleted #{results.length} products"
done()
.catch (error) -> done(_.prettify(error))
, 90000 # 90secs
it 'should add categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.id}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an external category id', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},externalCategoryId:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an category name', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.name.en}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an category slug', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.slug.en}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should remove categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {}
done()
.catch (err) -> done _.prettify(err)
it 'should change categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.externalId}: 0.9
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.9'}
done()
.catch (err) -> done _.prettify(err)
it 'should add another categoryOrderHint', (done) ->
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory('Second category', 'externalId2')
}
@client.execute request
.then (result) =>
@newCategory = result.body
productDraft = _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
productDraft.categories.push
typeId: 'category'
id: @newCategory.id
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: productDraft
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@newCategory.externalId}: 0.8
"""
im = createImporter(
continueOnProblems: true
)
im.mergeCategoryOrderHints = true
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
product = result.body.masterData.staged
expect(product.categoryOrderHints).toEqual
"#{@category.id}": '0.5',
"#{@newCategory.id}": '0.8'
done()
.catch (err) -> done _.prettify(err)
it 'should add another categoryOrderHint when matching by SKU', (done) ->
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory('Second category', 'externalId2')
}
@client.execute request
.then (result) =>
@newCategory = result.body
productDraft = _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
productDraft.masterVariant.sku = '123'
productDraft.categories.push
typeId: 'category'
id: @newCategory.id
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: productDraft
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,sku,categoryOrderHints
#{@productType.id},#{@product.masterData.staged.masterVariant.sku},#{@newCategory.externalId}: 0.8
"""
im = createImporter(
continueOnProblems: true
)
im.mergeCategoryOrderHints = true
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
product = result.body.masterData.staged
expect(product.categoryOrderHints).toEqual
"#{@category.id}": '0.5',
"#{@newCategory.id}": '0.8'
done()
.catch (err) -> done _.prettify(err)
describe 'Export', ->
beforeEach prepareCategoryAndProduct
it 'should export categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then =>
template =
"""
productType,id,variantId,categoryOrderHints
"""
file = '/tmp/output.csv'
expectedCSV =
"""
productType,id,variantId,categoryOrderHints
#{@productType.name},#{@product.id},#{@product.lastVariantId},#{@category.id}:0.5
"""
@export.exportDefault(template, file)
.then (result) ->
expect(result).toBe 'Export done.'
fs.readFileAsync file, {encoding: 'utf8'}
.then (content) ->
expect(content).toBe expectedCSV
done()
.catch (err) -> done _.prettify(err)
it 'should export categoryOrderHints with category externalId', (done) ->
customExport = new Export {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
categoryOrderHintBy: 'externalId'
}
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then =>
template =
"""
productType,id,variantId,categoryOrderHints
"""
file = '/tmp/output.csv'
expectedCSV =
"""
productType,id,variantId,categoryOrderHints
#{@productType.name},#{@product.id},#{@product.lastVariantId},#{@category.externalId}:0.5
"""
customExport.exportDefault(template, file)
.then (result) ->
expect(result).toBe 'Export done.'
fs.readFileAsync file, {encoding: 'utf8'}
.then (content) ->
expect(content).toBe expectedCSV
done()
.catch (err) -> done _.prettify(err)
| 202835 | _ = require 'underscore'
_.mixin require('underscore-mixins')
{Import, Export} = require '../../lib/main'
Config = require '../../config'
TestHelpers = require './testhelpers'
Promise = require 'bluebird'
fs = Promise.promisifyAll require('fs')
{ client_id, client_secret, project_key } = Config.config
authConfig = {
host: 'https://auth.sphere.io'
projectKey: project_key
credentials: {
clientId: client_id
clientSecret: client_secret
}
}
httpConfig = { host: 'https://api.sphere.io' }
userAgentConfig = {}
defaultProduct = (productTypeId, categoryId) ->
name:
en: 'test product'
productType:
typeId: 'product-type'
id: productTypeId
slug:
en: TestHelpers.uniqueId 'slug-'
categories: [
typeId: 'category'
id: categoryId
]
masterVariant: {}
createImporter = ->
im = new Import {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
}
im.allowRemovalOfVariants = true
im.suppressMissingHeaderWarning = true
im
CHANNEL_KEY = '<KEY>'
uniqueId = (prefix) ->
_.uniqueId "#{prefix}#{new Date().getTime()}_"
newCategory = (name = 'Category name', externalId = 'externalCategoryId') ->
name:
en: name
slug:
en: uniqueId 'c'
externalId: externalId
prepareCategoryAndProduct = (done) ->
jasmine.getEnv().defaultTimeoutInterval = 120000 # 2mins
@export = new Export {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
}
@importer = createImporter()
@importer.suppressMissingHeaderWarning = true
@client = @importer.client
console.log 'create a category to work with'
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory()
}
@client.execute request
.then (results) =>
@category = results.body
console.log "Created #{results.length} categories"
@productType = TestHelpers.mockProductType()
TestHelpers.setupProductType(@client, @productType, null, project_key)
.then (result) =>
@productType = result
# Check if channel exists
service = TestHelpers.createService(project_key, 'channels')
request = {
uri: service
.where("key=\"#{CHANNEL_KEY}\"")
.build()
method: 'GET'
}
@client.execute request
.then (result) =>
# Create the channel if it doesn't exist else ignore
if (!result.body.total)
service = TestHelpers.createService(project_key, 'channels')
request = {
uri: service.build()
method: 'POST'
body:
key: CHANNEL_KEY
roles: ['InventorySupply']
}
@client.execute request
.then -> done()
.catch (error) -> done(_.prettify(error))
describe 'categoryOrderHints', ->
describe 'Import', ->
beforeEach prepareCategoryAndProduct
afterEach (done) ->
console.log 'About to delete all categories'
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'GET'
}
@client.process request, (payload) =>
console.log "Deleting #{payload.body.count} categories"
Promise.map payload.body.results, (category) =>
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service
.byId(category.id)
.withVersion(category.version)
.build()
method: 'DELETE'
}
@client.execute request
.then (results) =>
console.log "Deleted #{results.length} categories"
console.log "Delete all the created products"
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'GET'
}
@client.process request, (payload) =>
console.log "Deleting #{payload.body.count} products"
Promise.map payload.body.results, (product) =>
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service
.byId(product.id)
.withVersion(product.version)
.build()
method: 'DELETE'
}
@client.execute request
.then (results) ->
console.log "Deleted #{results.length} products"
done()
.catch (error) -> done(_.prettify(error))
, 90000 # 90secs
it 'should add categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.id}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an external category id', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},externalCategoryId:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an category name', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.name.en}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an category slug', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.slug.en}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should remove categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {}
done()
.catch (err) -> done _.prettify(err)
it 'should change categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.externalId}: 0.9
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.9'}
done()
.catch (err) -> done _.prettify(err)
it 'should add another categoryOrderHint', (done) ->
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory('Second category', 'externalId2')
}
@client.execute request
.then (result) =>
@newCategory = result.body
productDraft = _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
productDraft.categories.push
typeId: 'category'
id: @newCategory.id
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: productDraft
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@newCategory.externalId}: 0.8
"""
im = createImporter(
continueOnProblems: true
)
im.mergeCategoryOrderHints = true
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
product = result.body.masterData.staged
expect(product.categoryOrderHints).toEqual
"#{@category.id}": '0.5',
"#{@newCategory.id}": '0.8'
done()
.catch (err) -> done _.prettify(err)
it 'should add another categoryOrderHint when matching by SKU', (done) ->
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory('Second category', 'externalId2')
}
@client.execute request
.then (result) =>
@newCategory = result.body
productDraft = _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
productDraft.masterVariant.sku = '123'
productDraft.categories.push
typeId: 'category'
id: @newCategory.id
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: productDraft
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,sku,categoryOrderHints
#{@productType.id},#{@product.masterData.staged.masterVariant.sku},#{@newCategory.externalId}: 0.8
"""
im = createImporter(
continueOnProblems: true
)
im.mergeCategoryOrderHints = true
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
product = result.body.masterData.staged
expect(product.categoryOrderHints).toEqual
"#{@category.id}": '0.5',
"#{@newCategory.id}": '0.8'
done()
.catch (err) -> done _.prettify(err)
describe 'Export', ->
beforeEach prepareCategoryAndProduct
it 'should export categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then =>
template =
"""
productType,id,variantId,categoryOrderHints
"""
file = '/tmp/output.csv'
expectedCSV =
"""
productType,id,variantId,categoryOrderHints
#{@productType.name},#{@product.id},#{@product.lastVariantId},#{@category.id}:0.5
"""
@export.exportDefault(template, file)
.then (result) ->
expect(result).toBe 'Export done.'
fs.readFileAsync file, {encoding: 'utf8'}
.then (content) ->
expect(content).toBe expectedCSV
done()
.catch (err) -> done _.prettify(err)
it 'should export categoryOrderHints with category externalId', (done) ->
customExport = new Export {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
categoryOrderHintBy: 'externalId'
}
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then =>
template =
"""
productType,id,variantId,categoryOrderHints
"""
file = '/tmp/output.csv'
expectedCSV =
"""
productType,id,variantId,categoryOrderHints
#{@productType.name},#{@product.id},#{@product.lastVariantId},#{@category.externalId}:0.5
"""
customExport.exportDefault(template, file)
.then (result) ->
expect(result).toBe 'Export done.'
fs.readFileAsync file, {encoding: 'utf8'}
.then (content) ->
expect(content).toBe expectedCSV
done()
.catch (err) -> done _.prettify(err)
| true | _ = require 'underscore'
_.mixin require('underscore-mixins')
{Import, Export} = require '../../lib/main'
Config = require '../../config'
TestHelpers = require './testhelpers'
Promise = require 'bluebird'
fs = Promise.promisifyAll require('fs')
{ client_id, client_secret, project_key } = Config.config
authConfig = {
host: 'https://auth.sphere.io'
projectKey: project_key
credentials: {
clientId: client_id
clientSecret: client_secret
}
}
httpConfig = { host: 'https://api.sphere.io' }
userAgentConfig = {}
defaultProduct = (productTypeId, categoryId) ->
name:
en: 'test product'
productType:
typeId: 'product-type'
id: productTypeId
slug:
en: TestHelpers.uniqueId 'slug-'
categories: [
typeId: 'category'
id: categoryId
]
masterVariant: {}
createImporter = ->
im = new Import {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
}
im.allowRemovalOfVariants = true
im.suppressMissingHeaderWarning = true
im
CHANNEL_KEY = 'PI:KEY:<KEY>END_PI'
uniqueId = (prefix) ->
_.uniqueId "#{prefix}#{new Date().getTime()}_"
newCategory = (name = 'Category name', externalId = 'externalCategoryId') ->
name:
en: name
slug:
en: uniqueId 'c'
externalId: externalId
prepareCategoryAndProduct = (done) ->
jasmine.getEnv().defaultTimeoutInterval = 120000 # 2mins
@export = new Export {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
}
@importer = createImporter()
@importer.suppressMissingHeaderWarning = true
@client = @importer.client
console.log 'create a category to work with'
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory()
}
@client.execute request
.then (results) =>
@category = results.body
console.log "Created #{results.length} categories"
@productType = TestHelpers.mockProductType()
TestHelpers.setupProductType(@client, @productType, null, project_key)
.then (result) =>
@productType = result
# Check if channel exists
service = TestHelpers.createService(project_key, 'channels')
request = {
uri: service
.where("key=\"#{CHANNEL_KEY}\"")
.build()
method: 'GET'
}
@client.execute request
.then (result) =>
# Create the channel if it doesn't exist else ignore
if (!result.body.total)
service = TestHelpers.createService(project_key, 'channels')
request = {
uri: service.build()
method: 'POST'
body:
key: CHANNEL_KEY
roles: ['InventorySupply']
}
@client.execute request
.then -> done()
.catch (error) -> done(_.prettify(error))
describe 'categoryOrderHints', ->
describe 'Import', ->
beforeEach prepareCategoryAndProduct
afterEach (done) ->
console.log 'About to delete all categories'
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'GET'
}
@client.process request, (payload) =>
console.log "Deleting #{payload.body.count} categories"
Promise.map payload.body.results, (category) =>
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service
.byId(category.id)
.withVersion(category.version)
.build()
method: 'DELETE'
}
@client.execute request
.then (results) =>
console.log "Deleted #{results.length} categories"
console.log "Delete all the created products"
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'GET'
}
@client.process request, (payload) =>
console.log "Deleting #{payload.body.count} products"
Promise.map payload.body.results, (product) =>
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service
.byId(product.id)
.withVersion(product.version)
.build()
method: 'DELETE'
}
@client.execute request
.then (results) ->
console.log "Deleted #{results.length} products"
done()
.catch (error) -> done(_.prettify(error))
, 90000 # 90secs
it 'should add categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.id}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an external category id', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},externalCategoryId:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an category name', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.name.en}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should add categoryOrderHints when using an category slug', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: defaultProduct(@productType.id, @category.id)
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.slug.en}:0.5
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.5'}
done()
.catch (err) -> done _.prettify(err)
it 'should remove categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {}
done()
.catch (err) -> done _.prettify(err)
it 'should change categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,slug,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@product.slug},#{@category.externalId}: 0.9
"""
im = createImporter(
continueOnProblems: true
)
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
expect(result.body.masterData.staged.categoryOrderHints).toEqual {"#{@category.id}": '0.9'}
done()
.catch (err) -> done _.prettify(err)
it 'should add another categoryOrderHint', (done) ->
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory('Second category', 'externalId2')
}
@client.execute request
.then (result) =>
@newCategory = result.body
productDraft = _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
productDraft.categories.push
typeId: 'category'
id: @newCategory.id
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: productDraft
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,id,version,categoryOrderHints
#{@productType.id},#{@product.id},#{@product.version},#{@newCategory.externalId}: 0.8
"""
im = createImporter(
continueOnProblems: true
)
im.mergeCategoryOrderHints = true
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
product = result.body.masterData.staged
expect(product.categoryOrderHints).toEqual
"#{@category.id}": '0.5',
"#{@newCategory.id}": '0.8'
done()
.catch (err) -> done _.prettify(err)
it 'should add another categoryOrderHint when matching by SKU', (done) ->
service = TestHelpers.createService(project_key, 'categories')
request = {
uri: service.build()
method: 'POST'
body: newCategory('Second category', 'externalId2')
}
@client.execute request
.then (result) =>
@newCategory = result.body
productDraft = _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
productDraft.masterVariant.sku = '123'
productDraft.categories.push
typeId: 'category'
id: @newCategory.id
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: productDraft
}
@client.execute request
.then (result) =>
@product = result.body
csv =
"""
productType,sku,categoryOrderHints
#{@productType.id},#{@product.masterData.staged.masterVariant.sku},#{@newCategory.externalId}: 0.8
"""
im = createImporter(
continueOnProblems: true
)
im.mergeCategoryOrderHints = true
im.import(csv)
.then (result) =>
expect(result[0]).toBe '[row 2] Product updated.'
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then (result) =>
product = result.body.masterData.staged
expect(product.categoryOrderHints).toEqual
"#{@category.id}": '0.5',
"#{@newCategory.id}": '0.8'
done()
.catch (err) -> done _.prettify(err)
describe 'Export', ->
beforeEach prepareCategoryAndProduct
it 'should export categoryOrderHints', (done) ->
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then =>
template =
"""
productType,id,variantId,categoryOrderHints
"""
file = '/tmp/output.csv'
expectedCSV =
"""
productType,id,variantId,categoryOrderHints
#{@productType.name},#{@product.id},#{@product.lastVariantId},#{@category.id}:0.5
"""
@export.exportDefault(template, file)
.then (result) ->
expect(result).toBe 'Export done.'
fs.readFileAsync file, {encoding: 'utf8'}
.then (content) ->
expect(content).toBe expectedCSV
done()
.catch (err) -> done _.prettify(err)
it 'should export categoryOrderHints with category externalId', (done) ->
customExport = new Export {
authConfig: authConfig
httpConfig: httpConfig
userAgentConfig: userAgentConfig
categoryOrderHintBy: 'externalId'
}
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.build()
method: 'POST'
body: _.extend {}, defaultProduct(@productType.id, @category.id),
categoryOrderHints:
"#{@category.id}": '0.5'
}
@client.execute request
.then (result) =>
@product = result.body
service = TestHelpers.createService(project_key, 'products')
request = {
uri: service.byId(@product.id).build()
method: 'GET'
}
@client.execute request
.then =>
template =
"""
productType,id,variantId,categoryOrderHints
"""
file = '/tmp/output.csv'
expectedCSV =
"""
productType,id,variantId,categoryOrderHints
#{@productType.name},#{@product.id},#{@product.lastVariantId},#{@category.externalId}:0.5
"""
customExport.exportDefault(template, file)
.then (result) ->
expect(result).toBe 'Export done.'
fs.readFileAsync file, {encoding: 'utf8'}
.then (content) ->
expect(content).toBe expectedCSV
done()
.catch (err) -> done _.prettify(err)
|
[
{
"context": "ssertion')\n fakeToken = { userId: 'acct:hey@joe'}\n userSetter = fakeAnnotator.plugins.Auth",
"end": 1446,
"score": 0.6521413922309875,
"start": 1442,
"tag": "PASSWORD",
"value": "@joe"
},
{
"context": "h.user', ->\n assert.equal(auth.user, 'acct:h... | tests/js/auth-service-test.coffee | Treora/h | 0 | assert = chai.assert
sinon.assert.expose assert, prefix: null
describe 'h', ->
fakeAnnotator = null
fakeIdentity = null
sandbox = null
beforeEach module('h')
beforeEach module ($provide) ->
sandbox = sinon.sandbox.create()
fakeAnnotator = {
plugins: {
Auth:{
withToken: sandbox.spy()
destroy: sandbox.spy()
element: {removeData: sandbox.spy()}
}
Permissions: {
destroy: sandbox.spy()
setUser: sandbox.spy()
}
}
options: {}
socialView: {name: 'none'}
addPlugin: sandbox.spy()
}
fakeIdentity ={
watch: sandbox.spy()
request: sandbox.spy()
}
$provide.value 'annotator', fakeAnnotator
$provide.value 'identity', fakeIdentity
return
afterEach ->
sandbox.restore()
describe 'auth service', ->
$http = null
auth = null
beforeEach inject (_$http_, _auth_) ->
$http = _$http_
auth = _auth_
it 'watches the identity service for identity change events', ->
assert.calledOnce(fakeIdentity.watch)
it 'sets the user to null when the identity has been checked', ->
{onready} = fakeIdentity.watch.args[0][0]
onready()
assert.isNull(auth.user)
describe 'at login', ->
beforeEach ->
{onlogin} = fakeIdentity.watch.args[0][0]
onlogin('test-assertion')
fakeToken = { userId: 'acct:hey@joe'}
userSetter = fakeAnnotator.plugins.Auth.withToken.args[0][0]
userSetter(fakeToken)
it 'sets auth.user', ->
assert.equal(auth.user, 'acct:hey@joe')
it 'sets the token header as a default header', ->
token = $http.defaults.headers.common['X-Annotator-Auth-Token']
assert.equal(token, 'test-assertion')
describe 'at logout', ->
authPlugin = null
beforeEach ->
{onlogout} = fakeIdentity.watch.args[0][0]
auth.user = 'acct:hey@joe'
authPlugin = fakeAnnotator.plugins.Auth
onlogout()
it 'destroys the plugin', ->
assert.called(authPlugin.destroy)
it 'sets auth.user to null', ->
assert.equal(auth.user, null)
it 'unsets the token header', ->
token = $http.defaults.headers.common['X-Annotator-Auth-Token']
assert.isUndefined(token)
| 81782 | assert = chai.assert
sinon.assert.expose assert, prefix: null
describe 'h', ->
fakeAnnotator = null
fakeIdentity = null
sandbox = null
beforeEach module('h')
beforeEach module ($provide) ->
sandbox = sinon.sandbox.create()
fakeAnnotator = {
plugins: {
Auth:{
withToken: sandbox.spy()
destroy: sandbox.spy()
element: {removeData: sandbox.spy()}
}
Permissions: {
destroy: sandbox.spy()
setUser: sandbox.spy()
}
}
options: {}
socialView: {name: 'none'}
addPlugin: sandbox.spy()
}
fakeIdentity ={
watch: sandbox.spy()
request: sandbox.spy()
}
$provide.value 'annotator', fakeAnnotator
$provide.value 'identity', fakeIdentity
return
afterEach ->
sandbox.restore()
describe 'auth service', ->
$http = null
auth = null
beforeEach inject (_$http_, _auth_) ->
$http = _$http_
auth = _auth_
it 'watches the identity service for identity change events', ->
assert.calledOnce(fakeIdentity.watch)
it 'sets the user to null when the identity has been checked', ->
{onready} = fakeIdentity.watch.args[0][0]
onready()
assert.isNull(auth.user)
describe 'at login', ->
beforeEach ->
{onlogin} = fakeIdentity.watch.args[0][0]
onlogin('test-assertion')
fakeToken = { userId: 'acct:hey<PASSWORD>'}
userSetter = fakeAnnotator.plugins.Auth.withToken.args[0][0]
userSetter(fakeToken)
it 'sets auth.user', ->
assert.equal(auth.user, 'acct:hey@jo<PASSWORD>')
it 'sets the token header as a default header', ->
token = $http.defaults.headers.common['X-Annotator-Auth-Token']
assert.equal(token, 'test-assertion')
describe 'at logout', ->
authPlugin = null
beforeEach ->
{onlogout} = fakeIdentity.watch.args[0][0]
auth.user = 'acct:hey@joe'
authPlugin = fakeAnnotator.plugins.Auth
onlogout()
it 'destroys the plugin', ->
assert.called(authPlugin.destroy)
it 'sets auth.user to null', ->
assert.equal(auth.user, null)
it 'unsets the token header', ->
token = $http.defaults.headers.common['X-Annotator-Auth-Token']
assert.isUndefined(token)
| true | assert = chai.assert
sinon.assert.expose assert, prefix: null
describe 'h', ->
fakeAnnotator = null
fakeIdentity = null
sandbox = null
beforeEach module('h')
beforeEach module ($provide) ->
sandbox = sinon.sandbox.create()
fakeAnnotator = {
plugins: {
Auth:{
withToken: sandbox.spy()
destroy: sandbox.spy()
element: {removeData: sandbox.spy()}
}
Permissions: {
destroy: sandbox.spy()
setUser: sandbox.spy()
}
}
options: {}
socialView: {name: 'none'}
addPlugin: sandbox.spy()
}
fakeIdentity ={
watch: sandbox.spy()
request: sandbox.spy()
}
$provide.value 'annotator', fakeAnnotator
$provide.value 'identity', fakeIdentity
return
afterEach ->
sandbox.restore()
describe 'auth service', ->
$http = null
auth = null
beforeEach inject (_$http_, _auth_) ->
$http = _$http_
auth = _auth_
it 'watches the identity service for identity change events', ->
assert.calledOnce(fakeIdentity.watch)
it 'sets the user to null when the identity has been checked', ->
{onready} = fakeIdentity.watch.args[0][0]
onready()
assert.isNull(auth.user)
describe 'at login', ->
beforeEach ->
{onlogin} = fakeIdentity.watch.args[0][0]
onlogin('test-assertion')
fakeToken = { userId: 'acct:heyPI:PASSWORD:<PASSWORD>END_PI'}
userSetter = fakeAnnotator.plugins.Auth.withToken.args[0][0]
userSetter(fakeToken)
it 'sets auth.user', ->
assert.equal(auth.user, 'acct:hey@joPI:PASSWORD:<PASSWORD>END_PI')
it 'sets the token header as a default header', ->
token = $http.defaults.headers.common['X-Annotator-Auth-Token']
assert.equal(token, 'test-assertion')
describe 'at logout', ->
authPlugin = null
beforeEach ->
{onlogout} = fakeIdentity.watch.args[0][0]
auth.user = 'acct:hey@joe'
authPlugin = fakeAnnotator.plugins.Auth
onlogout()
it 'destroys the plugin', ->
assert.called(authPlugin.destroy)
it 'sets auth.user to null', ->
assert.equal(auth.user, null)
it 'unsets the token header', ->
token = $http.defaults.headers.common['X-Annotator-Auth-Token']
assert.isUndefined(token)
|
[
{
"context": "=================================\n# Copyright 2014 Hatio, Lab.\n# Licensed under The MIT License\n# http://o",
"end": 67,
"score": 0.7478528022766113,
"start": 62,
"tag": "NAME",
"value": "Hatio"
}
] | src/spec/SpecContentEditLayer.coffee | heartyoh/infopik | 0 | # ==========================================
# Copyright 2014 Hatio, Lab.
# Licensed under The MIT License
# http://opensource.org/licenses/MIT
# ==========================================
define [
'dou'
'KineticJS'
'../command/CommandPropertyChange'
'./SpecContentEditLayerExportable'
], (
dou
kin
CommandPropertyChange
exportable
) ->
"use strict"
view_factory = (attributes) ->
stage = @getView().getStage()
offset = attributes.offset || {x:0, y:0}
layer = new kin.Layer(attributes)
background = new kin.Rect
name: 'background for ruler-layer'
draggable: true
listening: true
x: 0
y: 0
width: Math.min(stage.width() + offset.x, stage.width())
height: Math.min(stage.height() + offset.y, stage.height())
stroke: attributes.stroke
fill: 'cyan'
opacity: 0.1
# id: undefined
layer.getBackground = -> background
layer.getOriginOffset = -> offset
layer.add background
layer
model_initialize = ->
onadded = (container, component, index, e) ->
onremoved = (container, component, e) ->
onchangemodel = (after, before, e) ->
model = e.listener
if before
model.remove before
before.dispose()
model.add after if after
onchangeselections = (after, before, added, removed) ->
controller = this
console.log 'selection-changed', after[0], controller.getAttachedModel(after[0]) if after.length > 0
onchange = (component, before, after) ->
node = component.getViews()[0]
node.setAttrs after
node.getLayer().batchDraw()
_stuckBackgroundPosition = (layer) ->
layerOffset = layer.offset()
layerOriginOffset = layer.getOriginOffset()
layer.getBackground().position
x: layerOffset.x - layerOriginOffset.x
y: layerOffset.y - layerOriginOffset.y
_mousePointOnEvent = (layer, e) ->
scale = layer.getStage().scale()
{
x: Math.round(e.offsetX / scale.x) # e.clientX
y: Math.round(e.offsetY / scale.y) # e.clientY
}
ondragstart = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
background = layer.getBackground()
node = e.targetNode
controller.selectionManager.select(node)
return if node and node isnt background
@layerOffsetOnStart = layer.offset()
@mousePointOnStart = _mousePointOnEvent(layer, e)
offset =
x: @mousePointOnStart.x + @layerOffsetOnStart.x
y: @mousePointOnStart.y + @layerOffsetOnStart.y
@selectbox = new kin.Rect
stroke: 'black'
strokeWidth: 1
dash: [3, 3]
layer.add @selectbox
@selectbox.setAttrs offset
_stuckBackgroundPosition layer
layer.draw();
e.cancelBubble = true
ondragmove = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
background = layer.getBackground()
node = e.targetNode
return if node and node isnt background
mousePointCurrent = _mousePointOnEvent(layer, e)
moveDelta =
x: mousePointCurrent.x - @mousePointOnStart.x
y: mousePointCurrent.y - @mousePointOnStart.y
@selectbox.setAttrs
width: moveDelta.x
height: moveDelta.y
_stuckBackgroundPosition layer
layer.batchDraw();
e.cancelBubble = true
ondragend = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
dragview = e.targetNode
dragmodel = controller.getAttachedModel(dragview)
if dragmodel
cmd = new CommandPropertyChange
changes: [
component: dragmodel
before:
x: dragmodel.get('x')
y: dragmodel.get('y')
after:
x: dragview.x()
y: dragview.y()
]
controller.execute(cmd)
# ...
layer = @listener
background = layer.getBackground()
return if e.targetNode and e.targetNode isnt background
# mousePointCurrent = _mousePointOnEvent(layer, e)
# moveDelta =
# x: mousePointCurrent.x - @mousePointOnStart.x
# y: mousePointCurrent.y - @mousePointOnStart.y
@selectbox.remove()
delete @selectbox
_stuckBackgroundPosition layer
layer.draw();
e.cancelBubble = true
onclick = (e) ->
node = e.targetNode
@context.selectionManager.select(node)
onresize = (e) ->
layer = @listener
background = layer.getBackground()
background.setSize(e.after)
layer.batchDraw()
onchangeoffset = (e) ->
layer = @listener
_stuckBackgroundPosition(layer)
model_event_map =
'(root)' :
'(root)' :
'change-model' : onchangemodel
'change-selections' : onchangeselections
'(self)' :
'(self)' :
'added' : onadded
'removed' : onremoved
'(all)' :
'change' : onchange
view_event_map =
'(self)' :
dragstart : ondragstart
dragmove : ondragmove
dragend : ondragend
click : onclick
'change-offset': onchangeoffset
'(root)' :
resize : onresize
{
type: 'content-edit-layer'
name: 'content-edit-layer'
containable: true
container_type: 'layer'
description: 'Selection Edit Layer Specification'
defaults: {
listening: true
draggable: false
}
model_event_map: model_event_map
view_event_map: view_event_map
model_initialize_fn: model_initialize
view_factory_fn: view_factory
toolbox_image: 'images/toolbox_content_edit_layer.png'
exportable: exportable
}
| 17482 | # ==========================================
# Copyright 2014 <NAME>, Lab.
# Licensed under The MIT License
# http://opensource.org/licenses/MIT
# ==========================================
define [
'dou'
'KineticJS'
'../command/CommandPropertyChange'
'./SpecContentEditLayerExportable'
], (
dou
kin
CommandPropertyChange
exportable
) ->
"use strict"
view_factory = (attributes) ->
stage = @getView().getStage()
offset = attributes.offset || {x:0, y:0}
layer = new kin.Layer(attributes)
background = new kin.Rect
name: 'background for ruler-layer'
draggable: true
listening: true
x: 0
y: 0
width: Math.min(stage.width() + offset.x, stage.width())
height: Math.min(stage.height() + offset.y, stage.height())
stroke: attributes.stroke
fill: 'cyan'
opacity: 0.1
# id: undefined
layer.getBackground = -> background
layer.getOriginOffset = -> offset
layer.add background
layer
model_initialize = ->
onadded = (container, component, index, e) ->
onremoved = (container, component, e) ->
onchangemodel = (after, before, e) ->
model = e.listener
if before
model.remove before
before.dispose()
model.add after if after
onchangeselections = (after, before, added, removed) ->
controller = this
console.log 'selection-changed', after[0], controller.getAttachedModel(after[0]) if after.length > 0
onchange = (component, before, after) ->
node = component.getViews()[0]
node.setAttrs after
node.getLayer().batchDraw()
_stuckBackgroundPosition = (layer) ->
layerOffset = layer.offset()
layerOriginOffset = layer.getOriginOffset()
layer.getBackground().position
x: layerOffset.x - layerOriginOffset.x
y: layerOffset.y - layerOriginOffset.y
_mousePointOnEvent = (layer, e) ->
scale = layer.getStage().scale()
{
x: Math.round(e.offsetX / scale.x) # e.clientX
y: Math.round(e.offsetY / scale.y) # e.clientY
}
ondragstart = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
background = layer.getBackground()
node = e.targetNode
controller.selectionManager.select(node)
return if node and node isnt background
@layerOffsetOnStart = layer.offset()
@mousePointOnStart = _mousePointOnEvent(layer, e)
offset =
x: @mousePointOnStart.x + @layerOffsetOnStart.x
y: @mousePointOnStart.y + @layerOffsetOnStart.y
@selectbox = new kin.Rect
stroke: 'black'
strokeWidth: 1
dash: [3, 3]
layer.add @selectbox
@selectbox.setAttrs offset
_stuckBackgroundPosition layer
layer.draw();
e.cancelBubble = true
ondragmove = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
background = layer.getBackground()
node = e.targetNode
return if node and node isnt background
mousePointCurrent = _mousePointOnEvent(layer, e)
moveDelta =
x: mousePointCurrent.x - @mousePointOnStart.x
y: mousePointCurrent.y - @mousePointOnStart.y
@selectbox.setAttrs
width: moveDelta.x
height: moveDelta.y
_stuckBackgroundPosition layer
layer.batchDraw();
e.cancelBubble = true
ondragend = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
dragview = e.targetNode
dragmodel = controller.getAttachedModel(dragview)
if dragmodel
cmd = new CommandPropertyChange
changes: [
component: dragmodel
before:
x: dragmodel.get('x')
y: dragmodel.get('y')
after:
x: dragview.x()
y: dragview.y()
]
controller.execute(cmd)
# ...
layer = @listener
background = layer.getBackground()
return if e.targetNode and e.targetNode isnt background
# mousePointCurrent = _mousePointOnEvent(layer, e)
# moveDelta =
# x: mousePointCurrent.x - @mousePointOnStart.x
# y: mousePointCurrent.y - @mousePointOnStart.y
@selectbox.remove()
delete @selectbox
_stuckBackgroundPosition layer
layer.draw();
e.cancelBubble = true
onclick = (e) ->
node = e.targetNode
@context.selectionManager.select(node)
onresize = (e) ->
layer = @listener
background = layer.getBackground()
background.setSize(e.after)
layer.batchDraw()
onchangeoffset = (e) ->
layer = @listener
_stuckBackgroundPosition(layer)
model_event_map =
'(root)' :
'(root)' :
'change-model' : onchangemodel
'change-selections' : onchangeselections
'(self)' :
'(self)' :
'added' : onadded
'removed' : onremoved
'(all)' :
'change' : onchange
view_event_map =
'(self)' :
dragstart : ondragstart
dragmove : ondragmove
dragend : ondragend
click : onclick
'change-offset': onchangeoffset
'(root)' :
resize : onresize
{
type: 'content-edit-layer'
name: 'content-edit-layer'
containable: true
container_type: 'layer'
description: 'Selection Edit Layer Specification'
defaults: {
listening: true
draggable: false
}
model_event_map: model_event_map
view_event_map: view_event_map
model_initialize_fn: model_initialize
view_factory_fn: view_factory
toolbox_image: 'images/toolbox_content_edit_layer.png'
exportable: exportable
}
| true | # ==========================================
# Copyright 2014 PI:NAME:<NAME>END_PI, Lab.
# Licensed under The MIT License
# http://opensource.org/licenses/MIT
# ==========================================
define [
'dou'
'KineticJS'
'../command/CommandPropertyChange'
'./SpecContentEditLayerExportable'
], (
dou
kin
CommandPropertyChange
exportable
) ->
"use strict"
view_factory = (attributes) ->
stage = @getView().getStage()
offset = attributes.offset || {x:0, y:0}
layer = new kin.Layer(attributes)
background = new kin.Rect
name: 'background for ruler-layer'
draggable: true
listening: true
x: 0
y: 0
width: Math.min(stage.width() + offset.x, stage.width())
height: Math.min(stage.height() + offset.y, stage.height())
stroke: attributes.stroke
fill: 'cyan'
opacity: 0.1
# id: undefined
layer.getBackground = -> background
layer.getOriginOffset = -> offset
layer.add background
layer
model_initialize = ->
onadded = (container, component, index, e) ->
onremoved = (container, component, e) ->
onchangemodel = (after, before, e) ->
model = e.listener
if before
model.remove before
before.dispose()
model.add after if after
onchangeselections = (after, before, added, removed) ->
controller = this
console.log 'selection-changed', after[0], controller.getAttachedModel(after[0]) if after.length > 0
onchange = (component, before, after) ->
node = component.getViews()[0]
node.setAttrs after
node.getLayer().batchDraw()
_stuckBackgroundPosition = (layer) ->
layerOffset = layer.offset()
layerOriginOffset = layer.getOriginOffset()
layer.getBackground().position
x: layerOffset.x - layerOriginOffset.x
y: layerOffset.y - layerOriginOffset.y
_mousePointOnEvent = (layer, e) ->
scale = layer.getStage().scale()
{
x: Math.round(e.offsetX / scale.x) # e.clientX
y: Math.round(e.offsetY / scale.y) # e.clientY
}
ondragstart = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
background = layer.getBackground()
node = e.targetNode
controller.selectionManager.select(node)
return if node and node isnt background
@layerOffsetOnStart = layer.offset()
@mousePointOnStart = _mousePointOnEvent(layer, e)
offset =
x: @mousePointOnStart.x + @layerOffsetOnStart.x
y: @mousePointOnStart.y + @layerOffsetOnStart.y
@selectbox = new kin.Rect
stroke: 'black'
strokeWidth: 1
dash: [3, 3]
layer.add @selectbox
@selectbox.setAttrs offset
_stuckBackgroundPosition layer
layer.draw();
e.cancelBubble = true
ondragmove = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
background = layer.getBackground()
node = e.targetNode
return if node and node isnt background
mousePointCurrent = _mousePointOnEvent(layer, e)
moveDelta =
x: mousePointCurrent.x - @mousePointOnStart.x
y: mousePointCurrent.y - @mousePointOnStart.y
@selectbox.setAttrs
width: moveDelta.x
height: moveDelta.y
_stuckBackgroundPosition layer
layer.batchDraw();
e.cancelBubble = true
ondragend = (e) ->
controller = @context
layer = @listener
model = controller.getAttachedModel(layer)
dragview = e.targetNode
dragmodel = controller.getAttachedModel(dragview)
if dragmodel
cmd = new CommandPropertyChange
changes: [
component: dragmodel
before:
x: dragmodel.get('x')
y: dragmodel.get('y')
after:
x: dragview.x()
y: dragview.y()
]
controller.execute(cmd)
# ...
layer = @listener
background = layer.getBackground()
return if e.targetNode and e.targetNode isnt background
# mousePointCurrent = _mousePointOnEvent(layer, e)
# moveDelta =
# x: mousePointCurrent.x - @mousePointOnStart.x
# y: mousePointCurrent.y - @mousePointOnStart.y
@selectbox.remove()
delete @selectbox
_stuckBackgroundPosition layer
layer.draw();
e.cancelBubble = true
onclick = (e) ->
node = e.targetNode
@context.selectionManager.select(node)
onresize = (e) ->
layer = @listener
background = layer.getBackground()
background.setSize(e.after)
layer.batchDraw()
onchangeoffset = (e) ->
layer = @listener
_stuckBackgroundPosition(layer)
model_event_map =
'(root)' :
'(root)' :
'change-model' : onchangemodel
'change-selections' : onchangeselections
'(self)' :
'(self)' :
'added' : onadded
'removed' : onremoved
'(all)' :
'change' : onchange
view_event_map =
'(self)' :
dragstart : ondragstart
dragmove : ondragmove
dragend : ondragend
click : onclick
'change-offset': onchangeoffset
'(root)' :
resize : onresize
{
type: 'content-edit-layer'
name: 'content-edit-layer'
containable: true
container_type: 'layer'
description: 'Selection Edit Layer Specification'
defaults: {
listening: true
draggable: false
}
model_event_map: model_event_map
view_event_map: view_event_map
model_initialize_fn: model_initialize
view_factory_fn: view_factory
toolbox_image: 'images/toolbox_content_edit_layer.png'
exportable: exportable
}
|
[
{
"context": " School Boys\"},\n {title: \"Trust You\", artist: \"Yuna Ito\", background: \"assets/images/snsd.jpg\"}\n ]\n\n ac",
"end": 270,
"score": 0.7631795406341553,
"start": 262,
"tag": "NAME",
"value": "Yuna Ito"
}
] | tests/dummy/app/controllers/tiles.coffee | simwms/simwms-assets | 0 | `import Ember from 'ember'`
TilesController = Ember.Controller.extend
tiles: [
{title: "Echo", artist: "GigaP", background: "assets/images/ahegao.jpg"},
{title: "From Dusk 'Til Dawn", artist: "Abington School Boys"},
{title: "Trust You", artist: "Yuna Ito", background: "assets/images/snsd.jpg"}
]
actions:
star: (tile) ->
alert "you tried to star #{tile.title} - #{tile.artist}"
click: (tile) ->
alert "tile clicked #{tile.title} - #{tile.artist}"
`export default TilesController` | 225898 | `import Ember from 'ember'`
TilesController = Ember.Controller.extend
tiles: [
{title: "Echo", artist: "GigaP", background: "assets/images/ahegao.jpg"},
{title: "From Dusk 'Til Dawn", artist: "Abington School Boys"},
{title: "Trust You", artist: "<NAME>", background: "assets/images/snsd.jpg"}
]
actions:
star: (tile) ->
alert "you tried to star #{tile.title} - #{tile.artist}"
click: (tile) ->
alert "tile clicked #{tile.title} - #{tile.artist}"
`export default TilesController` | true | `import Ember from 'ember'`
TilesController = Ember.Controller.extend
tiles: [
{title: "Echo", artist: "GigaP", background: "assets/images/ahegao.jpg"},
{title: "From Dusk 'Til Dawn", artist: "Abington School Boys"},
{title: "Trust You", artist: "PI:NAME:<NAME>END_PI", background: "assets/images/snsd.jpg"}
]
actions:
star: (tile) ->
alert "you tried to star #{tile.title} - #{tile.artist}"
click: (tile) ->
alert "tile clicked #{tile.title} - #{tile.artist}"
`export default TilesController` |
[
{
"context": " @sut = new MeshbluXMPP uuid: 'uuid', token: 'token', hostname: 'localhost', port: 5222\n @sut.co",
"end": 631,
"score": 0.6586863398551941,
"start": 626,
"tag": "KEY",
"value": "token"
},
{
"context": "message',\n type: 'normal'\n to: 'uuid@m... | test/on-message-spec.coffee | octoblu/node-meshblu-xmpp | 1 | _ = require 'lodash'
ltx = require 'ltx'
xmpp = require 'node-xmpp-server'
xml2js = require('xml2js').parseString
MeshbluXMPP = require '../'
describe 'on: message', ->
beforeEach (done) ->
@server = new xmpp.C2S.TCPServer
port: 5222
domain: 'localhost'
@server.on 'connection', (@client) =>
@client.on 'authenticate', (opts, callback) =>
callback(null, opts)
@server.on 'listening', done
afterEach (done) ->
@server.end done
describe 'with an active connection', ->
beforeEach (done) ->
@sut = new MeshbluXMPP uuid: 'uuid', token: 'token', hostname: 'localhost', port: 5222
@sut.connect done
afterEach 'close client', ->
@sut.close()
describe 'when a message is received', ->
beforeEach (done) ->
@sut.on 'message', (@message) => done()
@client.send new xmpp.Stanza('message',
type: 'normal'
to: 'uuid@meshblu.octoblu.com'
from: 'meshblu.octoblu.com'
).cnode(ltx.parse """
<metadata>
<route>
<hop to="dude" from="dude" type="dude" />
</route>
</metadata>
""").up().cnode(ltx.parse """
<raw-data>{"foo":"bar"}</raw-data>
""")
it 'should get a message', ->
expectedMessage =
metadata:
route: [
from: 'dude'
to: 'dude'
type: 'dude'
]
data:
foo: 'bar'
expect(@message).to.deep.equal expectedMessage
| 119865 | _ = require 'lodash'
ltx = require 'ltx'
xmpp = require 'node-xmpp-server'
xml2js = require('xml2js').parseString
MeshbluXMPP = require '../'
describe 'on: message', ->
beforeEach (done) ->
@server = new xmpp.C2S.TCPServer
port: 5222
domain: 'localhost'
@server.on 'connection', (@client) =>
@client.on 'authenticate', (opts, callback) =>
callback(null, opts)
@server.on 'listening', done
afterEach (done) ->
@server.end done
describe 'with an active connection', ->
beforeEach (done) ->
@sut = new MeshbluXMPP uuid: 'uuid', token: '<KEY>', hostname: 'localhost', port: 5222
@sut.connect done
afterEach 'close client', ->
@sut.close()
describe 'when a message is received', ->
beforeEach (done) ->
@sut.on 'message', (@message) => done()
@client.send new xmpp.Stanza('message',
type: 'normal'
to: '<EMAIL>'
from: 'meshblu.octoblu.com'
).cnode(ltx.parse """
<metadata>
<route>
<hop to="dude" from="dude" type="dude" />
</route>
</metadata>
""").up().cnode(ltx.parse """
<raw-data>{"foo":"bar"}</raw-data>
""")
it 'should get a message', ->
expectedMessage =
metadata:
route: [
from: 'dude'
to: 'dude'
type: 'dude'
]
data:
foo: 'bar'
expect(@message).to.deep.equal expectedMessage
| true | _ = require 'lodash'
ltx = require 'ltx'
xmpp = require 'node-xmpp-server'
xml2js = require('xml2js').parseString
MeshbluXMPP = require '../'
describe 'on: message', ->
beforeEach (done) ->
@server = new xmpp.C2S.TCPServer
port: 5222
domain: 'localhost'
@server.on 'connection', (@client) =>
@client.on 'authenticate', (opts, callback) =>
callback(null, opts)
@server.on 'listening', done
afterEach (done) ->
@server.end done
describe 'with an active connection', ->
beforeEach (done) ->
@sut = new MeshbluXMPP uuid: 'uuid', token: 'PI:KEY:<KEY>END_PI', hostname: 'localhost', port: 5222
@sut.connect done
afterEach 'close client', ->
@sut.close()
describe 'when a message is received', ->
beforeEach (done) ->
@sut.on 'message', (@message) => done()
@client.send new xmpp.Stanza('message',
type: 'normal'
to: 'PI:EMAIL:<EMAIL>END_PI'
from: 'meshblu.octoblu.com'
).cnode(ltx.parse """
<metadata>
<route>
<hop to="dude" from="dude" type="dude" />
</route>
</metadata>
""").up().cnode(ltx.parse """
<raw-data>{"foo":"bar"}</raw-data>
""")
it 'should get a message', ->
expectedMessage =
metadata:
route: [
from: 'dude'
to: 'dude'
type: 'dude'
]
data:
foo: 'bar'
expect(@message).to.deep.equal expectedMessage
|
[
{
"context": "\tcell: 'Cell: +38 093 675 18 44'\n\t\temail: 'E-mail: info@despace.com'\n\n\n",
"end": 2578,
"score": 0.999928891658783,
"start": 2562,
"tag": "EMAIL",
"value": "info@despace.com"
}
] | locale/ua.coffee | winnlab/Despace | 0 | module.exports =
menu:
about: 'ми'
work: 'проекти'
blog: 'блог'
contact: 'контакти'
slogan:
partOne: 'ВАША ІСТОРІЯ.'
partTwo: 'НАШЕ НАТХНЕННЯ'
we:
we: 'Ми'
content: "<p>Привіт! Ми - DESPACE.</p>
<br>
<p>Ми молоді, творчі та ініціативні люди, які
обожнюють свою справу. Наша команда
налічує дизайнерів, архітекторів і художників
з вищою професійною освітою, які глибоко
відчувають пропорції, ергономічність та естетику.</p>
<br>
<p>Ми ідеальний ресурс для ресторанів, кав'ярень,
офісів, готелів, квартир та приватних будинків.
Наш індивідуальний підхід орієнтований
на розв’язання будь-якого дизайнерського виклику.</p>"
whatWeDo:
whatWeDo: 'Що ми робимо'
content: '<p>Спектр послуг, які ми надаємо дуже широкий.
Від розробки дизайн-проекту інтер’єру до
виготовлення меблів, елементів декору та
освітлення. Тобто все, щоб задовольнити
Ваші потреби та наситити естетичним задоволенням.</p>
<br>
<p>Ми майстри своєї справи, коли йдеться про дизайн.</p>'
ourWorks:
ourWorks: 'Наші роботи'
content: "<p>Як ми це робимо</p>
<br>
<p>Постійний зв'язок з Нашими клієнтами, будь-то
створення нового продукту, розробка стратегії
або просто професійна порада, найбільший
успіх в нашій роботі.</p>
<br>
<p>Візуалізація ідей, яка надає їм матеріальну форму,
є важливим засобом комунікації. Вона буде часто
включати цифрові та мальовані ескізи, макети,
а також 3D візуалізації та детальні технічні плани.</p>
<br>
<p>Ваша зацікавленість та відкритість мають велике
значення для нас. А наші роботи говорять самі за себе.</p>"
theProcess:
theProcess: 'ЯК ЦЕ ПРАЦЮЄ'
design: 'ДИЗАЙН? ЗАВІТАЙТЕ ДО НАС'
content: '<p>Якщо ви хочете унікальний дизайн </p>
<p>і багато позитивних вражень </p>
<p>від процесу його створення - ласкаво просимо до нашого простору</p>'
coffee: 'кава'
designBrief: 'дизайн-бриф'
analysis: 'аналіз'
conceptualizing: 'концептуалізація'
development: 'розробка'
conclusion: 'висновок'
theFinal: 'результат'
approval: 'затвердження'
conctact:
ourPartners: 'наші партнери'
followUs: 'follow us'
content: '<br><p>Follow us to stay in the loop</p>
<p>on what’s new with Despace</p>'
contactUs: 'контакти'
address: 'Україна, Київ, Повітрофлотський пр-т, 11/15'
tel: 'T: +38 044 111 11 11'
cell: 'Cell: +38 093 675 18 44'
email: 'E-mail: info@despace.com'
| 74811 | module.exports =
menu:
about: 'ми'
work: 'проекти'
blog: 'блог'
contact: 'контакти'
slogan:
partOne: 'ВАША ІСТОРІЯ.'
partTwo: 'НАШЕ НАТХНЕННЯ'
we:
we: 'Ми'
content: "<p>Привіт! Ми - DESPACE.</p>
<br>
<p>Ми молоді, творчі та ініціативні люди, які
обожнюють свою справу. Наша команда
налічує дизайнерів, архітекторів і художників
з вищою професійною освітою, які глибоко
відчувають пропорції, ергономічність та естетику.</p>
<br>
<p>Ми ідеальний ресурс для ресторанів, кав'ярень,
офісів, готелів, квартир та приватних будинків.
Наш індивідуальний підхід орієнтований
на розв’язання будь-якого дизайнерського виклику.</p>"
whatWeDo:
whatWeDo: 'Що ми робимо'
content: '<p>Спектр послуг, які ми надаємо дуже широкий.
Від розробки дизайн-проекту інтер’єру до
виготовлення меблів, елементів декору та
освітлення. Тобто все, щоб задовольнити
Ваші потреби та наситити естетичним задоволенням.</p>
<br>
<p>Ми майстри своєї справи, коли йдеться про дизайн.</p>'
ourWorks:
ourWorks: 'Наші роботи'
content: "<p>Як ми це робимо</p>
<br>
<p>Постійний зв'язок з Нашими клієнтами, будь-то
створення нового продукту, розробка стратегії
або просто професійна порада, найбільший
успіх в нашій роботі.</p>
<br>
<p>Візуалізація ідей, яка надає їм матеріальну форму,
є важливим засобом комунікації. Вона буде часто
включати цифрові та мальовані ескізи, макети,
а також 3D візуалізації та детальні технічні плани.</p>
<br>
<p>Ваша зацікавленість та відкритість мають велике
значення для нас. А наші роботи говорять самі за себе.</p>"
theProcess:
theProcess: 'ЯК ЦЕ ПРАЦЮЄ'
design: 'ДИЗАЙН? ЗАВІТАЙТЕ ДО НАС'
content: '<p>Якщо ви хочете унікальний дизайн </p>
<p>і багато позитивних вражень </p>
<p>від процесу його створення - ласкаво просимо до нашого простору</p>'
coffee: 'кава'
designBrief: 'дизайн-бриф'
analysis: 'аналіз'
conceptualizing: 'концептуалізація'
development: 'розробка'
conclusion: 'висновок'
theFinal: 'результат'
approval: 'затвердження'
conctact:
ourPartners: 'наші партнери'
followUs: 'follow us'
content: '<br><p>Follow us to stay in the loop</p>
<p>on what’s new with Despace</p>'
contactUs: 'контакти'
address: 'Україна, Київ, Повітрофлотський пр-т, 11/15'
tel: 'T: +38 044 111 11 11'
cell: 'Cell: +38 093 675 18 44'
email: 'E-mail: <EMAIL>'
| true | module.exports =
menu:
about: 'ми'
work: 'проекти'
blog: 'блог'
contact: 'контакти'
slogan:
partOne: 'ВАША ІСТОРІЯ.'
partTwo: 'НАШЕ НАТХНЕННЯ'
we:
we: 'Ми'
content: "<p>Привіт! Ми - DESPACE.</p>
<br>
<p>Ми молоді, творчі та ініціативні люди, які
обожнюють свою справу. Наша команда
налічує дизайнерів, архітекторів і художників
з вищою професійною освітою, які глибоко
відчувають пропорції, ергономічність та естетику.</p>
<br>
<p>Ми ідеальний ресурс для ресторанів, кав'ярень,
офісів, готелів, квартир та приватних будинків.
Наш індивідуальний підхід орієнтований
на розв’язання будь-якого дизайнерського виклику.</p>"
whatWeDo:
whatWeDo: 'Що ми робимо'
content: '<p>Спектр послуг, які ми надаємо дуже широкий.
Від розробки дизайн-проекту інтер’єру до
виготовлення меблів, елементів декору та
освітлення. Тобто все, щоб задовольнити
Ваші потреби та наситити естетичним задоволенням.</p>
<br>
<p>Ми майстри своєї справи, коли йдеться про дизайн.</p>'
ourWorks:
ourWorks: 'Наші роботи'
content: "<p>Як ми це робимо</p>
<br>
<p>Постійний зв'язок з Нашими клієнтами, будь-то
створення нового продукту, розробка стратегії
або просто професійна порада, найбільший
успіх в нашій роботі.</p>
<br>
<p>Візуалізація ідей, яка надає їм матеріальну форму,
є важливим засобом комунікації. Вона буде часто
включати цифрові та мальовані ескізи, макети,
а також 3D візуалізації та детальні технічні плани.</p>
<br>
<p>Ваша зацікавленість та відкритість мають велике
значення для нас. А наші роботи говорять самі за себе.</p>"
theProcess:
theProcess: 'ЯК ЦЕ ПРАЦЮЄ'
design: 'ДИЗАЙН? ЗАВІТАЙТЕ ДО НАС'
content: '<p>Якщо ви хочете унікальний дизайн </p>
<p>і багато позитивних вражень </p>
<p>від процесу його створення - ласкаво просимо до нашого простору</p>'
coffee: 'кава'
designBrief: 'дизайн-бриф'
analysis: 'аналіз'
conceptualizing: 'концептуалізація'
development: 'розробка'
conclusion: 'висновок'
theFinal: 'результат'
approval: 'затвердження'
conctact:
ourPartners: 'наші партнери'
followUs: 'follow us'
content: '<br><p>Follow us to stay in the loop</p>
<p>on what’s new with Despace</p>'
contactUs: 'контакти'
address: 'Україна, Київ, Повітрофлотський пр-т, 11/15'
tel: 'T: +38 044 111 11 11'
cell: 'Cell: +38 093 675 18 44'
email: 'E-mail: PI:EMAIL:<EMAIL>END_PI'
|
[
{
"context": "3 Flarebyte.com Ltd. All rights reserved.\nCreator: Olivier Huin\nContributors:\n###\n\n'use strict'\nmodules= [\n \"fla",
"end": 151,
"score": 0.9998737573623657,
"start": 139,
"tag": "NAME",
"value": "Olivier Huin"
}
] | nodejs/flarebyte.net/0.8/node/flaming/browser/js/app.coffee | flarebyte/wonderful-bazar | 0 | ###
GENERATED - DO NOT EDIT - Tue Jan 14 2014 22:25:31 GMT+0000 (GMT)
Copyright (c) 2013 Flarebyte.com Ltd. All rights reserved.
Creator: Olivier Huin
Contributors:
###
'use strict'
modules= [
"flamingApp.controllers"
"flamingApp.filters"
"flamingApp.services"
"flamingApp.directives"
"jmdobry.angular-cache"
]
flamingApp= angular.module("flamingApp",modules)
flamingApp.config ($routeProvider, $locationProvider) ->
$locationProvider.html5Mode true
$routeProvider.when("/profile",
templateUrl: "partials/profile"
controller: "ProfileCtrl"
)
$routeProvider.when("/login",
templateUrl: "partials/login"
controller: "LoginCtrl"
)
$routeProvider.when("/compose",
templateUrl: "partials/compose"
controller: "ComposeCtrl"
)
$routeProvider.when("/to-read",
templateUrl: "partials/to_read"
controller: "ToReadCtrl"
)
$routeProvider.when("/to-do",
templateUrl: "partials/to_do"
controller: "ToDoCtrl"
)
$routeProvider.when("/important",
templateUrl: "partials/important"
controller: "ImportantCtrl"
)
$routeProvider.when("/recent",
templateUrl: "partials/recent"
controller: "RecentCtrl"
)
$routeProvider.when("/shared",
templateUrl: "partials/shared"
controller: "SharedCtrl"
)
$routeProvider.when("/all",
templateUrl: "partials/all"
controller: "AllCtrl"
)
$routeProvider.when("/news",
templateUrl: "partials/news"
controller: "NewsCtrl"
)
$routeProvider.when("/trash",
templateUrl: "partials/trash"
controller: "TrashCtrl"
)
$routeProvider.when("/dashboard",
templateUrl: "partials/dashboard"
controller: "DashboardCtrl"
)
$routeProvider.when("/contacts",
templateUrl: "partials/contacts"
controller: "ContactsCtrl"
)
$routeProvider.when("/settings",
templateUrl: "partials/settings"
controller: "SettingsCtrl"
)
$routeProvider.when("/help",
templateUrl: "partials/help"
controller: "HelpCtrl"
)
$routeProvider.when("/faq",
templateUrl: "partials/faq"
controller: "FaqCtrl"
)
$routeProvider.when("/privacy",
templateUrl: "partials/privacy"
controller: "PrivacyCtrl"
)
$routeProvider.when("/terms",
templateUrl: "partials/terms"
controller: "TermsCtrl"
)
| 122925 | ###
GENERATED - DO NOT EDIT - Tue Jan 14 2014 22:25:31 GMT+0000 (GMT)
Copyright (c) 2013 Flarebyte.com Ltd. All rights reserved.
Creator: <NAME>
Contributors:
###
'use strict'
modules= [
"flamingApp.controllers"
"flamingApp.filters"
"flamingApp.services"
"flamingApp.directives"
"jmdobry.angular-cache"
]
flamingApp= angular.module("flamingApp",modules)
flamingApp.config ($routeProvider, $locationProvider) ->
$locationProvider.html5Mode true
$routeProvider.when("/profile",
templateUrl: "partials/profile"
controller: "ProfileCtrl"
)
$routeProvider.when("/login",
templateUrl: "partials/login"
controller: "LoginCtrl"
)
$routeProvider.when("/compose",
templateUrl: "partials/compose"
controller: "ComposeCtrl"
)
$routeProvider.when("/to-read",
templateUrl: "partials/to_read"
controller: "ToReadCtrl"
)
$routeProvider.when("/to-do",
templateUrl: "partials/to_do"
controller: "ToDoCtrl"
)
$routeProvider.when("/important",
templateUrl: "partials/important"
controller: "ImportantCtrl"
)
$routeProvider.when("/recent",
templateUrl: "partials/recent"
controller: "RecentCtrl"
)
$routeProvider.when("/shared",
templateUrl: "partials/shared"
controller: "SharedCtrl"
)
$routeProvider.when("/all",
templateUrl: "partials/all"
controller: "AllCtrl"
)
$routeProvider.when("/news",
templateUrl: "partials/news"
controller: "NewsCtrl"
)
$routeProvider.when("/trash",
templateUrl: "partials/trash"
controller: "TrashCtrl"
)
$routeProvider.when("/dashboard",
templateUrl: "partials/dashboard"
controller: "DashboardCtrl"
)
$routeProvider.when("/contacts",
templateUrl: "partials/contacts"
controller: "ContactsCtrl"
)
$routeProvider.when("/settings",
templateUrl: "partials/settings"
controller: "SettingsCtrl"
)
$routeProvider.when("/help",
templateUrl: "partials/help"
controller: "HelpCtrl"
)
$routeProvider.when("/faq",
templateUrl: "partials/faq"
controller: "FaqCtrl"
)
$routeProvider.when("/privacy",
templateUrl: "partials/privacy"
controller: "PrivacyCtrl"
)
$routeProvider.when("/terms",
templateUrl: "partials/terms"
controller: "TermsCtrl"
)
| true | ###
GENERATED - DO NOT EDIT - Tue Jan 14 2014 22:25:31 GMT+0000 (GMT)
Copyright (c) 2013 Flarebyte.com Ltd. All rights reserved.
Creator: PI:NAME:<NAME>END_PI
Contributors:
###
'use strict'
modules= [
"flamingApp.controllers"
"flamingApp.filters"
"flamingApp.services"
"flamingApp.directives"
"jmdobry.angular-cache"
]
flamingApp= angular.module("flamingApp",modules)
flamingApp.config ($routeProvider, $locationProvider) ->
$locationProvider.html5Mode true
$routeProvider.when("/profile",
templateUrl: "partials/profile"
controller: "ProfileCtrl"
)
$routeProvider.when("/login",
templateUrl: "partials/login"
controller: "LoginCtrl"
)
$routeProvider.when("/compose",
templateUrl: "partials/compose"
controller: "ComposeCtrl"
)
$routeProvider.when("/to-read",
templateUrl: "partials/to_read"
controller: "ToReadCtrl"
)
$routeProvider.when("/to-do",
templateUrl: "partials/to_do"
controller: "ToDoCtrl"
)
$routeProvider.when("/important",
templateUrl: "partials/important"
controller: "ImportantCtrl"
)
$routeProvider.when("/recent",
templateUrl: "partials/recent"
controller: "RecentCtrl"
)
$routeProvider.when("/shared",
templateUrl: "partials/shared"
controller: "SharedCtrl"
)
$routeProvider.when("/all",
templateUrl: "partials/all"
controller: "AllCtrl"
)
$routeProvider.when("/news",
templateUrl: "partials/news"
controller: "NewsCtrl"
)
$routeProvider.when("/trash",
templateUrl: "partials/trash"
controller: "TrashCtrl"
)
$routeProvider.when("/dashboard",
templateUrl: "partials/dashboard"
controller: "DashboardCtrl"
)
$routeProvider.when("/contacts",
templateUrl: "partials/contacts"
controller: "ContactsCtrl"
)
$routeProvider.when("/settings",
templateUrl: "partials/settings"
controller: "SettingsCtrl"
)
$routeProvider.when("/help",
templateUrl: "partials/help"
controller: "HelpCtrl"
)
$routeProvider.when("/faq",
templateUrl: "partials/faq"
controller: "FaqCtrl"
)
$routeProvider.when("/privacy",
templateUrl: "partials/privacy"
controller: "PrivacyCtrl"
)
$routeProvider.when("/terms",
templateUrl: "partials/terms"
controller: "TermsCtrl"
)
|
[
{
"context": "map to a dictionary-like string', ->\n hash = {'Jonathan': 24, 'Bash': 23, 'Matt': 26}\n\n it 'should not",
"end": 8809,
"score": 0.9820432066917419,
"start": 8801,
"tag": "NAME",
"value": "Jonathan"
},
{
"context": "ary-like string', ->\n hash = {'Jonathan': 2... | coffee/test/test_humanize.spec.coffee | hallucinogen/humanize | 1 | describe 'When using method via destructured assignment', ->
it 'should properly reference other Humanize methods', ->
spyOn(Humanize, 'capitalize').andCallThrough()
{titlecase} = Humanize
expect(titlecase('ship it')).toEqual('Ship It')
expect(Humanize.capitalize).toHaveBeenCalled()
describe 'Millions as word', ->
it 'should pass', ->
expect(Humanize).toBeDefined()
expect(Humanize.intword(123456789, 'this is a nop', 2)).toEqual('123.46M')
expect(Humanize.intword(123456789, 'this is a nop', 1)).toEqual('123.5M')
expect(Humanize.intword(100)).toEqual('100.00')
expect(Humanize.intword(100, 'this is a nop', 0)).toEqual('100')
describe 'compactInteger tests', ->
it 'should string small numbers', ->
expect(Humanize).toBeDefined()
expect(Humanize.compactInteger(999)).toEqual('999')
expect(Humanize.compactInteger(999, 2)).toEqual('999.00')
expect(Humanize.compactInteger(-999)).toEqual('-999')
expect(Humanize.compactInteger(-0, 1)).toEqual('0.0')
expect(Humanize.compactInteger(15, 0)).toEqual('15')
expect(Humanize.compactInteger(7832186132456328967, 2)).toEqual('7.83x10^18')
expect(Humanize.compactInteger(-7832186132456328967, 4)).toEqual('-7.8322x10^18')
expect(Humanize.compactInteger(1000, 0)).toEqual('1k')
expect(Humanize.compactInteger(-99321, 2)).toEqual('-99.32k')
expect(Humanize.compactInteger(3199321, 1)).toEqual('3.2M')
expect(Humanize.compactInteger(-37123436321, 5)).toEqual('-37.12344B')
expect(Humanize.compactInteger(-9900432253321, 1)).toEqual('-9.9T')
expect(Humanize.compactInteger(-9960432253321, 1)).toEqual('-10.0T')
expect(Humanize.compactInteger(9990432253, 1)).toEqual('10.0B')
expect(Humanize.compactInteger(100)).toEqual('100')
expect(Humanize.compactInteger(123456789, 1)).toEqual('123.5M')
describe 'Ordinal value of numbers Test Suite', ->
describe 'Ordinal value for numbers ending in zero', ->
it 'should return 0 if the number is 0 (cos 0th doesnt read very well)', ->
expect(Humanize.ordinal(0)).toEqual(0)
it 'should return the number with suffix th', ->
expect(Humanize.ordinal(10)).toEqual('10th')
describe 'Ordinal value for numbers ending in one', ->
it 'should end in st for numbers not ending in 11', ->
expect(Humanize.ordinal(1)).toEqual('1st')
expect(Humanize.ordinal(11)).toNotEqual('11st')
expect(Humanize.ordinal(21)).toEqual('21st')
it 'should be 11th for numbers ending in 11', ->
expect(Humanize.ordinal(11)).toEqual('11th')
expect(Humanize.ordinal(111)).toEqual('111th')
describe 'Ordinal value for numbers ending in two', ->
it 'should end in nd for numbers not ending in 12', ->
expect(Humanize.ordinal(2)).toEqual('2nd')
expect(Humanize.ordinal(12)).toNotEqual('12nd')
expect(Humanize.ordinal(22)).toEqual('22nd')
it 'should be 12th for numbers ending in 12', ->
expect(Humanize.ordinal(12)).toEqual('12th')
expect(Humanize.ordinal(112)).toEqual('112th')
describe 'Ordinal value for numbers ending in three', ->
it 'should end in rd for numbers not ending in 13', ->
expect(Humanize.ordinal(3)).toEqual('3rd')
expect(Humanize.ordinal(13)).toNotEqual('13rd')
expect(Humanize.ordinal(23)).toEqual('23rd')
it 'should be 13th for numbers ending in 13', ->
expect(Humanize.ordinal(13)).toEqual('13th')
expect(Humanize.ordinal(113)).toEqual('113th')
describe 'Ordinal value for numbers ending in four', ->
it 'should end in th for numbers', ->
expect(Humanize.ordinal(4)).toEqual('4th')
expect(Humanize.ordinal(14)).toEqual('14th')
expect(Humanize.ordinal(24)).toEqual('24th')
describe 'Times tests', ->
it 'should say never', ->
expect(Humanize.times(0)).toEqual('never')
it 'should say once', ->
expect(Humanize.times(1)).toEqual('once')
it 'should say twice', ->
expect(Humanize.times(2)).toEqual('twice')
expect(Humanize.times(2, {2: 'dos times'})).toEqual('dos times')
it 'should say thrice or three times', ->
expect(Humanize.times(3)).toEqual('3 times')
expect(Humanize.times(3, {3: 'thrice'})).toEqual('thrice')
it 'should say 12 times', ->
expect(Humanize.times(12)).toEqual('12 times')
expect(Humanize.times(12, {12: 'douze times'})).toEqual('douze times')
it 'should allow number overrides for specified values', ->
expect(Humanize.times(12, {12:'too many times'})).toEqual('too many times')
describe 'Pluralize tests', ->
it 'should append an s as the default', ->
expect(Humanize.pluralize(1,'cupcake')).toEqual('cupcake')
expect(Humanize.pluralize(2,'cupcake')).toEqual('cupcakes')
it 'should return provided value for special cases', ->
expect(Humanize.pluralize(1,'person','people')).toEqual('person')
expect(Humanize.pluralize(2,'person','people')).toEqual('people')
expect(Humanize.pluralize(1,'child','children')).toEqual('child')
expect(Humanize.pluralize(2,'child','children')).toEqual('children')
describe 'Filesize tests for nerds', ->
it 'should append byte if it is exactly 1 byte', ->
expect(Humanize.filesize(1)).toEqual('1 byte')
expect(Humanize.fileSize(1)).toEqual('1 byte')
it 'should append bytes if it is less than 1024 bytes', ->
expect(Humanize.filesize(512)).toEqual('512 bytes')
expect(Humanize.fileSize(512)).toEqual('512 bytes')
it 'should return a file in KB if it is more than 1024 bytes', ->
expect(Humanize.filesize(1080)).toEqual('1 KB')
expect(Humanize.fileSize(1080)).toEqual('1 KB')
it 'should return a file in MB if it is more than a 1024 * 1024 bytes', ->
expect(Humanize.filesize(2.22*1024*1024)).toEqual('2.22 MB')
expect(Humanize.fileSize(2.22*1024*1024)).toEqual('2.22 MB')
it 'should return a file in GB if it is more than a 1024 * 1024 * 1024 bytes', ->
expect(Humanize.filesize(2.22*1024*1024*1024)).toEqual('2.22 GB')
expect(Humanize.fileSize(2.22*1024*1024*1024)).toEqual('2.22 GB')
describe 'Truncating objects to shorter versions', ->
objs =
str: 'abcdefghijklmnopqrstuvwxyz'
num: 1234567890
arr: [1, 2, 3, 4, 5]
it 'should truncate a long string with ellipsis', ->
expect(Humanize.truncate(objs.str, 14)).toEqual('abcdefghijk...')
expect(Humanize.truncate(objs.str, 14, '...kidding')).toEqual('abcd...kidding')
it 'should truncate a number to an upper bound', ->
expect(Humanize.truncatenumber(objs.num, 500)).toEqual('500+')
expect(Humanize.boundedNumber(objs.num, 500)).toEqual('500+')
it 'should not trucate things that are too short', ->
expect(Humanize.truncate(objs.str, objs.str.length + 1)).toEqual(objs.str)
expect(Humanize.truncatenumber(objs.num, objs.num + 1)).toEqual("#{objs.num}")
expect(Humanize.boundedNumber(objs.num, objs.num + 1)).toEqual("#{objs.num}")
describe 'Converting a list to a readable, oxford commafied string', ->
items = ['apple', 'orange', 'banana', 'pear', 'pineapple']
it 'should return an empty string when given an empty list', ->
expect(Humanize.oxford(items.slice(0, 0))).toEqual('')
it 'should return a string version of a list that has only one value', ->
expect(Humanize.oxford(items.slice(0, 1))).toEqual('apple')
it 'should return items separated by "and" when given a list of two values', ->
expect(Humanize.oxford(items.slice(0, 2))).toEqual('apple and orange')
it 'should convert a list to an oxford commafied string', ->
expect(Humanize.oxford(items.slice(0))).toEqual('apple, orange, banana, pear, and pineapple')
it 'should truncate a large list of items with proper pluralization', ->
expect(Humanize.oxford(items.slice(0), 3)).toEqual('apple, orange, banana, and 2 others')
expect(Humanize.oxford(items.slice(0), 4)).toEqual('apple, orange, banana, pear, and 1 other')
it 'should accept custom trucation strings', ->
limitStr = ", and some other fruits"
expect(Humanize.oxford(items.slice(0), 3, limitStr)).toEqual('apple, orange, banana' + limitStr)
expect(Humanize.oxford(items.slice(0, 3), 3, limitStr)).toEqual('apple, orange, and banana')
describe 'Converting a hashmap to a dictionary-like string', ->
hash = {'Jonathan': 24, 'Bash': 23, 'Matt': 26}
it 'should not accept non-objects', ->
expect(Humanize.dictionary('String')).toEqual('')
expect(Humanize.dictionary((arg) -> 'Function')).toEqual('')
expect(Humanize.dictionary([1, 2, 3])).toEqual('')
it 'should convert a hash to a key-value string', ->
expect(Humanize.dictionary(hash)).toEqual('Jonathan is 24, Bash is 23, Matt is 26')
describe 'Converting pace arguments into strings', ->
it 'should convert two pace arguments to a string', ->
second = 1000
week = 6.048e8
decade = 3.156e11
expect(Humanize.pace(4, week)).toEqual('Approximately 4 times per week')
expect(Humanize.pace(1.5, second, "heartbeat")).toEqual('Approximately 2 heartbeats per second')
expect(Humanize.pace(1, decade, "life crisis")).toEqual('Less than 1 life crisis per week')
describe 'Converting line breaks', ->
it 'should convert /\n to a <br/> tag', ->
expect(Humanize.nl2br('\n')).toEqual('<br/>')
it 'should convert a <br> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br>')).toEqual('\r\n')
it 'should convert a <br/> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br/>')).toEqual('\r\n')
it 'should convert a malformed <br> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br >')).toEqual('\r\n')
it 'should convert a malformed <br/> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br />')).toEqual('\r\n')
describe 'Capitalizing words appropriately', ->
it 'should convert "ship it" to "Ship it"', ->
expect(Humanize.capitalize('ship it')).toEqual('Ship it')
expect(Humanize.capitalize('wHoOaA!')).toEqual('WHoOaA!')
expect(Humanize.capitalize('wHoOaA!', true)).toEqual('Whooaa!')
it 'should convert "ship it" to "Ship It"', ->
expect(Humanize.titlecase('ship it')).toEqual('Ship It')
expect(Humanize.titleCase('ship it')).toEqual('Ship It')
it 'should convert "" to ""', ->
expect(Humanize.titlecase('')).toEqual('')
expect(Humanize.titleCase('')).toEqual('')
it 'should convert "the boss is O\'Mally\'s brother." to "The Boss is O\'Mally\'s Brother."', ->
expect(Humanize.titlecase('the boss likes O\'Mally\'s little brother a lot.')).toEqual('The Boss Likes O\'Mally\'s Little Brother a Lot.')
expect(Humanize.titleCase('the boss likes O\'Mally\'s little brother a lot.')).toEqual('The Boss Likes O\'Mally\'s Little Brother a Lot.')
it 'should convert "you get the cake an iTunes hat is West wacky?" to "You Get the Cake an iTunes Hat Is West Wacky?"', ->
expect(Humanize.titlecase('you get the cake an iTunes hat is West wacky?')).toEqual('You Get the Cake an iTunes Hat Is West Wacky?')
expect(Humanize.titleCase('you get the cake an iTunes hat is West wacky?')).toEqual('You Get the Cake an iTunes Hat Is West Wacky?')
it 'should convert "cool the iTunes cake, O\'Malley!" to "Cool the iTunes Cake, O\'Malley!"', ->
expect(Humanize.titlecase('cool the iTunes cake, O\'Malley!')).toEqual('Cool the iTunes Cake, O\'Malley!')
expect(Humanize.titleCase('cool the iTunes cake, O\'Malley!')).toEqual('Cool the iTunes Cake, O\'Malley!')
it 'should convert "cul-de-sac drive-by" to "Cul-de-Sac Drive-By"', ->
expect(Humanize.titlecase('cul-de-sac drive-by')).toEqual('Cul-de-Sac Drive-By')
expect(Humanize.titleCase('cul-de-sac drive-by')).toEqual('Cul-de-Sac Drive-By')
it 'should convert "ultra-book By iTunes" to "Ultra-Book by iTunes"', ->
expect(Humanize.titlecase('ultra-book By iTunes')).toEqual('Ultra-Book by iTunes')
expect(Humanize.titleCase('ultra-book By iTunes')).toEqual('Ultra-Book by iTunes')
it 'should convert "by-the-book ultra-book By iTunes" to "By-the-Book Ultra-Book by iTunes"', ->
expect(Humanize.titlecase('by-the-book ultra-book By iTunes')).toEqual('By-the-Book Ultra-Book by iTunes')
expect(Humanize.titleCase('by-the-book ultra-book By iTunes')).toEqual('By-the-Book Ultra-Book by iTunes')
it 'should convert "by-the-book ultra-book by-the-by iTunes" to "By-the-Book Ultra-Book by-the-by iTunes"', ->
expect(Humanize.titlecase('by-the-book ultra-book by-the-by iTunes')).toEqual('By-the-Book Ultra-Book by-the-by iTunes')
expect(Humanize.titleCase('by-the-book ultra-book by-the-by iTunes')).toEqual('By-the-Book Ultra-Book by-the-by iTunes')
it 'should convert "by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book" to "By-the-by Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book"', ->
expect(Humanize.titlecase('by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book')).toEqual('By-the-By Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book')
expect(Humanize.titleCase('by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book')).toEqual('By-the-By Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book')
| 69108 | describe 'When using method via destructured assignment', ->
it 'should properly reference other Humanize methods', ->
spyOn(Humanize, 'capitalize').andCallThrough()
{titlecase} = Humanize
expect(titlecase('ship it')).toEqual('Ship It')
expect(Humanize.capitalize).toHaveBeenCalled()
describe 'Millions as word', ->
it 'should pass', ->
expect(Humanize).toBeDefined()
expect(Humanize.intword(123456789, 'this is a nop', 2)).toEqual('123.46M')
expect(Humanize.intword(123456789, 'this is a nop', 1)).toEqual('123.5M')
expect(Humanize.intword(100)).toEqual('100.00')
expect(Humanize.intword(100, 'this is a nop', 0)).toEqual('100')
describe 'compactInteger tests', ->
it 'should string small numbers', ->
expect(Humanize).toBeDefined()
expect(Humanize.compactInteger(999)).toEqual('999')
expect(Humanize.compactInteger(999, 2)).toEqual('999.00')
expect(Humanize.compactInteger(-999)).toEqual('-999')
expect(Humanize.compactInteger(-0, 1)).toEqual('0.0')
expect(Humanize.compactInteger(15, 0)).toEqual('15')
expect(Humanize.compactInteger(7832186132456328967, 2)).toEqual('7.83x10^18')
expect(Humanize.compactInteger(-7832186132456328967, 4)).toEqual('-7.8322x10^18')
expect(Humanize.compactInteger(1000, 0)).toEqual('1k')
expect(Humanize.compactInteger(-99321, 2)).toEqual('-99.32k')
expect(Humanize.compactInteger(3199321, 1)).toEqual('3.2M')
expect(Humanize.compactInteger(-37123436321, 5)).toEqual('-37.12344B')
expect(Humanize.compactInteger(-9900432253321, 1)).toEqual('-9.9T')
expect(Humanize.compactInteger(-9960432253321, 1)).toEqual('-10.0T')
expect(Humanize.compactInteger(9990432253, 1)).toEqual('10.0B')
expect(Humanize.compactInteger(100)).toEqual('100')
expect(Humanize.compactInteger(123456789, 1)).toEqual('123.5M')
describe 'Ordinal value of numbers Test Suite', ->
describe 'Ordinal value for numbers ending in zero', ->
it 'should return 0 if the number is 0 (cos 0th doesnt read very well)', ->
expect(Humanize.ordinal(0)).toEqual(0)
it 'should return the number with suffix th', ->
expect(Humanize.ordinal(10)).toEqual('10th')
describe 'Ordinal value for numbers ending in one', ->
it 'should end in st for numbers not ending in 11', ->
expect(Humanize.ordinal(1)).toEqual('1st')
expect(Humanize.ordinal(11)).toNotEqual('11st')
expect(Humanize.ordinal(21)).toEqual('21st')
it 'should be 11th for numbers ending in 11', ->
expect(Humanize.ordinal(11)).toEqual('11th')
expect(Humanize.ordinal(111)).toEqual('111th')
describe 'Ordinal value for numbers ending in two', ->
it 'should end in nd for numbers not ending in 12', ->
expect(Humanize.ordinal(2)).toEqual('2nd')
expect(Humanize.ordinal(12)).toNotEqual('12nd')
expect(Humanize.ordinal(22)).toEqual('22nd')
it 'should be 12th for numbers ending in 12', ->
expect(Humanize.ordinal(12)).toEqual('12th')
expect(Humanize.ordinal(112)).toEqual('112th')
describe 'Ordinal value for numbers ending in three', ->
it 'should end in rd for numbers not ending in 13', ->
expect(Humanize.ordinal(3)).toEqual('3rd')
expect(Humanize.ordinal(13)).toNotEqual('13rd')
expect(Humanize.ordinal(23)).toEqual('23rd')
it 'should be 13th for numbers ending in 13', ->
expect(Humanize.ordinal(13)).toEqual('13th')
expect(Humanize.ordinal(113)).toEqual('113th')
describe 'Ordinal value for numbers ending in four', ->
it 'should end in th for numbers', ->
expect(Humanize.ordinal(4)).toEqual('4th')
expect(Humanize.ordinal(14)).toEqual('14th')
expect(Humanize.ordinal(24)).toEqual('24th')
describe 'Times tests', ->
it 'should say never', ->
expect(Humanize.times(0)).toEqual('never')
it 'should say once', ->
expect(Humanize.times(1)).toEqual('once')
it 'should say twice', ->
expect(Humanize.times(2)).toEqual('twice')
expect(Humanize.times(2, {2: 'dos times'})).toEqual('dos times')
it 'should say thrice or three times', ->
expect(Humanize.times(3)).toEqual('3 times')
expect(Humanize.times(3, {3: 'thrice'})).toEqual('thrice')
it 'should say 12 times', ->
expect(Humanize.times(12)).toEqual('12 times')
expect(Humanize.times(12, {12: 'douze times'})).toEqual('douze times')
it 'should allow number overrides for specified values', ->
expect(Humanize.times(12, {12:'too many times'})).toEqual('too many times')
describe 'Pluralize tests', ->
it 'should append an s as the default', ->
expect(Humanize.pluralize(1,'cupcake')).toEqual('cupcake')
expect(Humanize.pluralize(2,'cupcake')).toEqual('cupcakes')
it 'should return provided value for special cases', ->
expect(Humanize.pluralize(1,'person','people')).toEqual('person')
expect(Humanize.pluralize(2,'person','people')).toEqual('people')
expect(Humanize.pluralize(1,'child','children')).toEqual('child')
expect(Humanize.pluralize(2,'child','children')).toEqual('children')
describe 'Filesize tests for nerds', ->
it 'should append byte if it is exactly 1 byte', ->
expect(Humanize.filesize(1)).toEqual('1 byte')
expect(Humanize.fileSize(1)).toEqual('1 byte')
it 'should append bytes if it is less than 1024 bytes', ->
expect(Humanize.filesize(512)).toEqual('512 bytes')
expect(Humanize.fileSize(512)).toEqual('512 bytes')
it 'should return a file in KB if it is more than 1024 bytes', ->
expect(Humanize.filesize(1080)).toEqual('1 KB')
expect(Humanize.fileSize(1080)).toEqual('1 KB')
it 'should return a file in MB if it is more than a 1024 * 1024 bytes', ->
expect(Humanize.filesize(2.22*1024*1024)).toEqual('2.22 MB')
expect(Humanize.fileSize(2.22*1024*1024)).toEqual('2.22 MB')
it 'should return a file in GB if it is more than a 1024 * 1024 * 1024 bytes', ->
expect(Humanize.filesize(2.22*1024*1024*1024)).toEqual('2.22 GB')
expect(Humanize.fileSize(2.22*1024*1024*1024)).toEqual('2.22 GB')
describe 'Truncating objects to shorter versions', ->
objs =
str: 'abcdefghijklmnopqrstuvwxyz'
num: 1234567890
arr: [1, 2, 3, 4, 5]
it 'should truncate a long string with ellipsis', ->
expect(Humanize.truncate(objs.str, 14)).toEqual('abcdefghijk...')
expect(Humanize.truncate(objs.str, 14, '...kidding')).toEqual('abcd...kidding')
it 'should truncate a number to an upper bound', ->
expect(Humanize.truncatenumber(objs.num, 500)).toEqual('500+')
expect(Humanize.boundedNumber(objs.num, 500)).toEqual('500+')
it 'should not trucate things that are too short', ->
expect(Humanize.truncate(objs.str, objs.str.length + 1)).toEqual(objs.str)
expect(Humanize.truncatenumber(objs.num, objs.num + 1)).toEqual("#{objs.num}")
expect(Humanize.boundedNumber(objs.num, objs.num + 1)).toEqual("#{objs.num}")
describe 'Converting a list to a readable, oxford commafied string', ->
items = ['apple', 'orange', 'banana', 'pear', 'pineapple']
it 'should return an empty string when given an empty list', ->
expect(Humanize.oxford(items.slice(0, 0))).toEqual('')
it 'should return a string version of a list that has only one value', ->
expect(Humanize.oxford(items.slice(0, 1))).toEqual('apple')
it 'should return items separated by "and" when given a list of two values', ->
expect(Humanize.oxford(items.slice(0, 2))).toEqual('apple and orange')
it 'should convert a list to an oxford commafied string', ->
expect(Humanize.oxford(items.slice(0))).toEqual('apple, orange, banana, pear, and pineapple')
it 'should truncate a large list of items with proper pluralization', ->
expect(Humanize.oxford(items.slice(0), 3)).toEqual('apple, orange, banana, and 2 others')
expect(Humanize.oxford(items.slice(0), 4)).toEqual('apple, orange, banana, pear, and 1 other')
it 'should accept custom trucation strings', ->
limitStr = ", and some other fruits"
expect(Humanize.oxford(items.slice(0), 3, limitStr)).toEqual('apple, orange, banana' + limitStr)
expect(Humanize.oxford(items.slice(0, 3), 3, limitStr)).toEqual('apple, orange, and banana')
describe 'Converting a hashmap to a dictionary-like string', ->
hash = {'<NAME>': 24, '<NAME>': 23, '<NAME>': 26}
it 'should not accept non-objects', ->
expect(Humanize.dictionary('String')).toEqual('')
expect(Humanize.dictionary((arg) -> 'Function')).toEqual('')
expect(Humanize.dictionary([1, 2, 3])).toEqual('')
it 'should convert a hash to a key-value string', ->
expect(Humanize.dictionary(hash)).toEqual('<NAME> is 24, Bash is 23, <NAME> is 26')
describe 'Converting pace arguments into strings', ->
it 'should convert two pace arguments to a string', ->
second = 1000
week = 6.048e8
decade = 3.156e11
expect(Humanize.pace(4, week)).toEqual('Approximately 4 times per week')
expect(Humanize.pace(1.5, second, "heartbeat")).toEqual('Approximately 2 heartbeats per second')
expect(Humanize.pace(1, decade, "life crisis")).toEqual('Less than 1 life crisis per week')
describe 'Converting line breaks', ->
it 'should convert /\n to a <br/> tag', ->
expect(Humanize.nl2br('\n')).toEqual('<br/>')
it 'should convert a <br> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br>')).toEqual('\r\n')
it 'should convert a <br/> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br/>')).toEqual('\r\n')
it 'should convert a malformed <br> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br >')).toEqual('\r\n')
it 'should convert a malformed <br/> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br />')).toEqual('\r\n')
describe 'Capitalizing words appropriately', ->
it 'should convert "ship it" to "Ship it"', ->
expect(Humanize.capitalize('ship it')).toEqual('Ship it')
expect(Humanize.capitalize('wHoOaA!')).toEqual('WHoOaA!')
expect(Humanize.capitalize('wHoOaA!', true)).toEqual('Whooaa!')
it 'should convert "ship it" to "Ship It"', ->
expect(Humanize.titlecase('ship it')).toEqual('Ship It')
expect(Humanize.titleCase('ship it')).toEqual('Ship It')
it 'should convert "" to ""', ->
expect(Humanize.titlecase('')).toEqual('')
expect(Humanize.titleCase('')).toEqual('')
it 'should convert "the boss is O\'Mally\'s brother." to "The Boss is O\'Mally\'s Brother."', ->
expect(Humanize.titlecase('the boss likes O\'Mally\'s little brother a lot.')).toEqual('The Boss Likes O\'Mally\'s Little Brother a Lot.')
expect(Humanize.titleCase('the boss likes O\'Mally\'s little brother a lot.')).toEqual('The Boss Likes O\'Mally\'s Little Brother a Lot.')
it 'should convert "you get the cake an iTunes hat is West wacky?" to "You Get the Cake an iTunes Hat Is West Wacky?"', ->
expect(Humanize.titlecase('you get the cake an iTunes hat is West wacky?')).toEqual('You Get the Cake an iTunes Hat Is West Wacky?')
expect(Humanize.titleCase('you get the cake an iTunes hat is West wacky?')).toEqual('You Get the Cake an iTunes Hat Is West Wacky?')
it 'should convert "cool the iTunes cake, O\'Malley!" to "Cool the iTunes Cake, O\'Malley!"', ->
expect(Humanize.titlecase('cool the iTunes cake, O\'Malley!')).toEqual('Cool the iTunes Cake, O\'Malley!')
expect(Humanize.titleCase('cool the iTunes cake, O\'Malley!')).toEqual('Cool the iTunes Cake, O\'Malley!')
it 'should convert "cul-de-sac drive-by" to "Cul-de-Sac Drive-By"', ->
expect(Humanize.titlecase('cul-de-sac drive-by')).toEqual('Cul-de-Sac Drive-By')
expect(Humanize.titleCase('cul-de-sac drive-by')).toEqual('Cul-de-Sac Drive-By')
it 'should convert "ultra-book By iTunes" to "Ultra-Book by iTunes"', ->
expect(Humanize.titlecase('ultra-book By iTunes')).toEqual('Ultra-Book by iTunes')
expect(Humanize.titleCase('ultra-book By iTunes')).toEqual('Ultra-Book by iTunes')
it 'should convert "by-the-book ultra-book By iTunes" to "By-the-Book Ultra-Book by iTunes"', ->
expect(Humanize.titlecase('by-the-book ultra-book By iTunes')).toEqual('By-the-Book Ultra-Book by iTunes')
expect(Humanize.titleCase('by-the-book ultra-book By iTunes')).toEqual('By-the-Book Ultra-Book by iTunes')
it 'should convert "by-the-book ultra-book by-the-by iTunes" to "By-the-Book Ultra-Book by-the-by iTunes"', ->
expect(Humanize.titlecase('by-the-book ultra-book by-the-by iTunes')).toEqual('By-the-Book Ultra-Book by-the-by iTunes')
expect(Humanize.titleCase('by-the-book ultra-book by-the-by iTunes')).toEqual('By-the-Book Ultra-Book by-the-by iTunes')
it 'should convert "by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book" to "By-the-by Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book"', ->
expect(Humanize.titlecase('by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book')).toEqual('By-the-By Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book')
expect(Humanize.titleCase('by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book')).toEqual('By-the-By Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book')
| true | describe 'When using method via destructured assignment', ->
it 'should properly reference other Humanize methods', ->
spyOn(Humanize, 'capitalize').andCallThrough()
{titlecase} = Humanize
expect(titlecase('ship it')).toEqual('Ship It')
expect(Humanize.capitalize).toHaveBeenCalled()
describe 'Millions as word', ->
it 'should pass', ->
expect(Humanize).toBeDefined()
expect(Humanize.intword(123456789, 'this is a nop', 2)).toEqual('123.46M')
expect(Humanize.intword(123456789, 'this is a nop', 1)).toEqual('123.5M')
expect(Humanize.intword(100)).toEqual('100.00')
expect(Humanize.intword(100, 'this is a nop', 0)).toEqual('100')
describe 'compactInteger tests', ->
it 'should string small numbers', ->
expect(Humanize).toBeDefined()
expect(Humanize.compactInteger(999)).toEqual('999')
expect(Humanize.compactInteger(999, 2)).toEqual('999.00')
expect(Humanize.compactInteger(-999)).toEqual('-999')
expect(Humanize.compactInteger(-0, 1)).toEqual('0.0')
expect(Humanize.compactInteger(15, 0)).toEqual('15')
expect(Humanize.compactInteger(7832186132456328967, 2)).toEqual('7.83x10^18')
expect(Humanize.compactInteger(-7832186132456328967, 4)).toEqual('-7.8322x10^18')
expect(Humanize.compactInteger(1000, 0)).toEqual('1k')
expect(Humanize.compactInteger(-99321, 2)).toEqual('-99.32k')
expect(Humanize.compactInteger(3199321, 1)).toEqual('3.2M')
expect(Humanize.compactInteger(-37123436321, 5)).toEqual('-37.12344B')
expect(Humanize.compactInteger(-9900432253321, 1)).toEqual('-9.9T')
expect(Humanize.compactInteger(-9960432253321, 1)).toEqual('-10.0T')
expect(Humanize.compactInteger(9990432253, 1)).toEqual('10.0B')
expect(Humanize.compactInteger(100)).toEqual('100')
expect(Humanize.compactInteger(123456789, 1)).toEqual('123.5M')
describe 'Ordinal value of numbers Test Suite', ->
describe 'Ordinal value for numbers ending in zero', ->
it 'should return 0 if the number is 0 (cos 0th doesnt read very well)', ->
expect(Humanize.ordinal(0)).toEqual(0)
it 'should return the number with suffix th', ->
expect(Humanize.ordinal(10)).toEqual('10th')
describe 'Ordinal value for numbers ending in one', ->
it 'should end in st for numbers not ending in 11', ->
expect(Humanize.ordinal(1)).toEqual('1st')
expect(Humanize.ordinal(11)).toNotEqual('11st')
expect(Humanize.ordinal(21)).toEqual('21st')
it 'should be 11th for numbers ending in 11', ->
expect(Humanize.ordinal(11)).toEqual('11th')
expect(Humanize.ordinal(111)).toEqual('111th')
describe 'Ordinal value for numbers ending in two', ->
it 'should end in nd for numbers not ending in 12', ->
expect(Humanize.ordinal(2)).toEqual('2nd')
expect(Humanize.ordinal(12)).toNotEqual('12nd')
expect(Humanize.ordinal(22)).toEqual('22nd')
it 'should be 12th for numbers ending in 12', ->
expect(Humanize.ordinal(12)).toEqual('12th')
expect(Humanize.ordinal(112)).toEqual('112th')
describe 'Ordinal value for numbers ending in three', ->
it 'should end in rd for numbers not ending in 13', ->
expect(Humanize.ordinal(3)).toEqual('3rd')
expect(Humanize.ordinal(13)).toNotEqual('13rd')
expect(Humanize.ordinal(23)).toEqual('23rd')
it 'should be 13th for numbers ending in 13', ->
expect(Humanize.ordinal(13)).toEqual('13th')
expect(Humanize.ordinal(113)).toEqual('113th')
describe 'Ordinal value for numbers ending in four', ->
it 'should end in th for numbers', ->
expect(Humanize.ordinal(4)).toEqual('4th')
expect(Humanize.ordinal(14)).toEqual('14th')
expect(Humanize.ordinal(24)).toEqual('24th')
describe 'Times tests', ->
it 'should say never', ->
expect(Humanize.times(0)).toEqual('never')
it 'should say once', ->
expect(Humanize.times(1)).toEqual('once')
it 'should say twice', ->
expect(Humanize.times(2)).toEqual('twice')
expect(Humanize.times(2, {2: 'dos times'})).toEqual('dos times')
it 'should say thrice or three times', ->
expect(Humanize.times(3)).toEqual('3 times')
expect(Humanize.times(3, {3: 'thrice'})).toEqual('thrice')
it 'should say 12 times', ->
expect(Humanize.times(12)).toEqual('12 times')
expect(Humanize.times(12, {12: 'douze times'})).toEqual('douze times')
it 'should allow number overrides for specified values', ->
expect(Humanize.times(12, {12:'too many times'})).toEqual('too many times')
describe 'Pluralize tests', ->
it 'should append an s as the default', ->
expect(Humanize.pluralize(1,'cupcake')).toEqual('cupcake')
expect(Humanize.pluralize(2,'cupcake')).toEqual('cupcakes')
it 'should return provided value for special cases', ->
expect(Humanize.pluralize(1,'person','people')).toEqual('person')
expect(Humanize.pluralize(2,'person','people')).toEqual('people')
expect(Humanize.pluralize(1,'child','children')).toEqual('child')
expect(Humanize.pluralize(2,'child','children')).toEqual('children')
describe 'Filesize tests for nerds', ->
it 'should append byte if it is exactly 1 byte', ->
expect(Humanize.filesize(1)).toEqual('1 byte')
expect(Humanize.fileSize(1)).toEqual('1 byte')
it 'should append bytes if it is less than 1024 bytes', ->
expect(Humanize.filesize(512)).toEqual('512 bytes')
expect(Humanize.fileSize(512)).toEqual('512 bytes')
it 'should return a file in KB if it is more than 1024 bytes', ->
expect(Humanize.filesize(1080)).toEqual('1 KB')
expect(Humanize.fileSize(1080)).toEqual('1 KB')
it 'should return a file in MB if it is more than a 1024 * 1024 bytes', ->
expect(Humanize.filesize(2.22*1024*1024)).toEqual('2.22 MB')
expect(Humanize.fileSize(2.22*1024*1024)).toEqual('2.22 MB')
it 'should return a file in GB if it is more than a 1024 * 1024 * 1024 bytes', ->
expect(Humanize.filesize(2.22*1024*1024*1024)).toEqual('2.22 GB')
expect(Humanize.fileSize(2.22*1024*1024*1024)).toEqual('2.22 GB')
describe 'Truncating objects to shorter versions', ->
objs =
str: 'abcdefghijklmnopqrstuvwxyz'
num: 1234567890
arr: [1, 2, 3, 4, 5]
it 'should truncate a long string with ellipsis', ->
expect(Humanize.truncate(objs.str, 14)).toEqual('abcdefghijk...')
expect(Humanize.truncate(objs.str, 14, '...kidding')).toEqual('abcd...kidding')
it 'should truncate a number to an upper bound', ->
expect(Humanize.truncatenumber(objs.num, 500)).toEqual('500+')
expect(Humanize.boundedNumber(objs.num, 500)).toEqual('500+')
it 'should not trucate things that are too short', ->
expect(Humanize.truncate(objs.str, objs.str.length + 1)).toEqual(objs.str)
expect(Humanize.truncatenumber(objs.num, objs.num + 1)).toEqual("#{objs.num}")
expect(Humanize.boundedNumber(objs.num, objs.num + 1)).toEqual("#{objs.num}")
describe 'Converting a list to a readable, oxford commafied string', ->
items = ['apple', 'orange', 'banana', 'pear', 'pineapple']
it 'should return an empty string when given an empty list', ->
expect(Humanize.oxford(items.slice(0, 0))).toEqual('')
it 'should return a string version of a list that has only one value', ->
expect(Humanize.oxford(items.slice(0, 1))).toEqual('apple')
it 'should return items separated by "and" when given a list of two values', ->
expect(Humanize.oxford(items.slice(0, 2))).toEqual('apple and orange')
it 'should convert a list to an oxford commafied string', ->
expect(Humanize.oxford(items.slice(0))).toEqual('apple, orange, banana, pear, and pineapple')
it 'should truncate a large list of items with proper pluralization', ->
expect(Humanize.oxford(items.slice(0), 3)).toEqual('apple, orange, banana, and 2 others')
expect(Humanize.oxford(items.slice(0), 4)).toEqual('apple, orange, banana, pear, and 1 other')
it 'should accept custom trucation strings', ->
limitStr = ", and some other fruits"
expect(Humanize.oxford(items.slice(0), 3, limitStr)).toEqual('apple, orange, banana' + limitStr)
expect(Humanize.oxford(items.slice(0, 3), 3, limitStr)).toEqual('apple, orange, and banana')
describe 'Converting a hashmap to a dictionary-like string', ->
hash = {'PI:NAME:<NAME>END_PI': 24, 'PI:NAME:<NAME>END_PI': 23, 'PI:NAME:<NAME>END_PI': 26}
it 'should not accept non-objects', ->
expect(Humanize.dictionary('String')).toEqual('')
expect(Humanize.dictionary((arg) -> 'Function')).toEqual('')
expect(Humanize.dictionary([1, 2, 3])).toEqual('')
it 'should convert a hash to a key-value string', ->
expect(Humanize.dictionary(hash)).toEqual('PI:NAME:<NAME>END_PI is 24, Bash is 23, PI:NAME:<NAME>END_PI is 26')
describe 'Converting pace arguments into strings', ->
it 'should convert two pace arguments to a string', ->
second = 1000
week = 6.048e8
decade = 3.156e11
expect(Humanize.pace(4, week)).toEqual('Approximately 4 times per week')
expect(Humanize.pace(1.5, second, "heartbeat")).toEqual('Approximately 2 heartbeats per second')
expect(Humanize.pace(1, decade, "life crisis")).toEqual('Less than 1 life crisis per week')
describe 'Converting line breaks', ->
it 'should convert /\n to a <br/> tag', ->
expect(Humanize.nl2br('\n')).toEqual('<br/>')
it 'should convert a <br> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br>')).toEqual('\r\n')
it 'should convert a <br/> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br/>')).toEqual('\r\n')
it 'should convert a malformed <br> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br >')).toEqual('\r\n')
it 'should convert a malformed <br/> tag to /\r/\n (new line)', ->
expect(Humanize.br2nl('<br />')).toEqual('\r\n')
describe 'Capitalizing words appropriately', ->
it 'should convert "ship it" to "Ship it"', ->
expect(Humanize.capitalize('ship it')).toEqual('Ship it')
expect(Humanize.capitalize('wHoOaA!')).toEqual('WHoOaA!')
expect(Humanize.capitalize('wHoOaA!', true)).toEqual('Whooaa!')
it 'should convert "ship it" to "Ship It"', ->
expect(Humanize.titlecase('ship it')).toEqual('Ship It')
expect(Humanize.titleCase('ship it')).toEqual('Ship It')
it 'should convert "" to ""', ->
expect(Humanize.titlecase('')).toEqual('')
expect(Humanize.titleCase('')).toEqual('')
it 'should convert "the boss is O\'Mally\'s brother." to "The Boss is O\'Mally\'s Brother."', ->
expect(Humanize.titlecase('the boss likes O\'Mally\'s little brother a lot.')).toEqual('The Boss Likes O\'Mally\'s Little Brother a Lot.')
expect(Humanize.titleCase('the boss likes O\'Mally\'s little brother a lot.')).toEqual('The Boss Likes O\'Mally\'s Little Brother a Lot.')
it 'should convert "you get the cake an iTunes hat is West wacky?" to "You Get the Cake an iTunes Hat Is West Wacky?"', ->
expect(Humanize.titlecase('you get the cake an iTunes hat is West wacky?')).toEqual('You Get the Cake an iTunes Hat Is West Wacky?')
expect(Humanize.titleCase('you get the cake an iTunes hat is West wacky?')).toEqual('You Get the Cake an iTunes Hat Is West Wacky?')
it 'should convert "cool the iTunes cake, O\'Malley!" to "Cool the iTunes Cake, O\'Malley!"', ->
expect(Humanize.titlecase('cool the iTunes cake, O\'Malley!')).toEqual('Cool the iTunes Cake, O\'Malley!')
expect(Humanize.titleCase('cool the iTunes cake, O\'Malley!')).toEqual('Cool the iTunes Cake, O\'Malley!')
it 'should convert "cul-de-sac drive-by" to "Cul-de-Sac Drive-By"', ->
expect(Humanize.titlecase('cul-de-sac drive-by')).toEqual('Cul-de-Sac Drive-By')
expect(Humanize.titleCase('cul-de-sac drive-by')).toEqual('Cul-de-Sac Drive-By')
it 'should convert "ultra-book By iTunes" to "Ultra-Book by iTunes"', ->
expect(Humanize.titlecase('ultra-book By iTunes')).toEqual('Ultra-Book by iTunes')
expect(Humanize.titleCase('ultra-book By iTunes')).toEqual('Ultra-Book by iTunes')
it 'should convert "by-the-book ultra-book By iTunes" to "By-the-Book Ultra-Book by iTunes"', ->
expect(Humanize.titlecase('by-the-book ultra-book By iTunes')).toEqual('By-the-Book Ultra-Book by iTunes')
expect(Humanize.titleCase('by-the-book ultra-book By iTunes')).toEqual('By-the-Book Ultra-Book by iTunes')
it 'should convert "by-the-book ultra-book by-the-by iTunes" to "By-the-Book Ultra-Book by-the-by iTunes"', ->
expect(Humanize.titlecase('by-the-book ultra-book by-the-by iTunes')).toEqual('By-the-Book Ultra-Book by-the-by iTunes')
expect(Humanize.titleCase('by-the-book ultra-book by-the-by iTunes')).toEqual('By-the-Book Ultra-Book by-the-by iTunes')
it 'should convert "by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book" to "By-the-by Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book"', ->
expect(Humanize.titlecase('by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book')).toEqual('By-the-By Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book')
expect(Humanize.titleCase('by-the-by is not iTunes-O\'Malley\'s favorite of the new-on-a-book')).toEqual('By-the-By Is Not iTunes-O\'Malley\'s Favorite of the New-on-a-Book')
|
[
{
"context": "ss\n getDefaultProps: ->\n {\n name: 'Jon Snow'\n image: 'http://www.allmediany.com/bignai",
"end": 117,
"score": 0.994853675365448,
"start": 109,
"tag": "NAME",
"value": "Jon Snow"
},
{
"context": "k.jpg'\n fb_link: 'https://www.facebook.co... | app/assets/javascripts/components/catalog.jsx.coffee | gaiax-asia/describe_me | 0 | #Main View
jQuery ->
Component.Catalog = React.createClass
getDefaultProps: ->
{
name: 'Jon Snow'
image: 'http://www.allmediany.com/bignails/1343917142_blank.jpg'
fb_link: 'https://www.facebook.com/JonSnowWatcherOnTheWall'
description: 'He knows Nothing!'
descriptions: []
}
render: ->
return `<div className='container'>
<div className='row'>
<div className='col-md-6 container'>
<div className='row'>
<div className='col-md-12 image'>
< Component.Image image={this.props.image} />
</div>
</div>
<div className='row'>
<div className='col-md-12 details'>
< Component.Details name={this.props.name} fb_link={this.props.fb_link} />
</div>
</div>
</div>
<div className='col-md-6 container'>
<div className='row'>
<div className='col-md-12 '>
< Component.Descriptions descriptions={this.props.descriptions}/>
</div>
</div>
</div>
</div>
<div className='row'>
<div className='col-sm-12'>
< Component.DescriptionInput description={this.props.description} id={this.props.id}/>
</div>
</div>
</div>` | 100571 | #Main View
jQuery ->
Component.Catalog = React.createClass
getDefaultProps: ->
{
name: '<NAME>'
image: 'http://www.allmediany.com/bignails/1343917142_blank.jpg'
fb_link: 'https://www.facebook.com/JonSnowWatcherOnTheWall'
description: 'He knows Nothing!'
descriptions: []
}
render: ->
return `<div className='container'>
<div className='row'>
<div className='col-md-6 container'>
<div className='row'>
<div className='col-md-12 image'>
< Component.Image image={this.props.image} />
</div>
</div>
<div className='row'>
<div className='col-md-12 details'>
< Component.Details name={this.props.name} fb_link={this.props.fb_link} />
</div>
</div>
</div>
<div className='col-md-6 container'>
<div className='row'>
<div className='col-md-12 '>
< Component.Descriptions descriptions={this.props.descriptions}/>
</div>
</div>
</div>
</div>
<div className='row'>
<div className='col-sm-12'>
< Component.DescriptionInput description={this.props.description} id={this.props.id}/>
</div>
</div>
</div>` | true | #Main View
jQuery ->
Component.Catalog = React.createClass
getDefaultProps: ->
{
name: 'PI:NAME:<NAME>END_PI'
image: 'http://www.allmediany.com/bignails/1343917142_blank.jpg'
fb_link: 'https://www.facebook.com/JonSnowWatcherOnTheWall'
description: 'He knows Nothing!'
descriptions: []
}
render: ->
return `<div className='container'>
<div className='row'>
<div className='col-md-6 container'>
<div className='row'>
<div className='col-md-12 image'>
< Component.Image image={this.props.image} />
</div>
</div>
<div className='row'>
<div className='col-md-12 details'>
< Component.Details name={this.props.name} fb_link={this.props.fb_link} />
</div>
</div>
</div>
<div className='col-md-6 container'>
<div className='row'>
<div className='col-md-12 '>
< Component.Descriptions descriptions={this.props.descriptions}/>
</div>
</div>
</div>
</div>
<div className='row'>
<div className='col-sm-12'>
< Component.DescriptionInput description={this.props.description} id={this.props.id}/>
</div>
</div>
</div>` |
[
{
"context": " reporter: 'Spec'\n urls: ['http://127.0.0.1:9000/index.html']\n\n yuidoc:\n compile:\n ",
"end": 2574,
"score": 0.7011075615882874,
"start": 2566,
"tag": "IP_ADDRESS",
"value": "27.0.0.1"
}
] | Gruntfile.coffee | tictail/tt.js | 7 | module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
config:
src: 'src'
test: 'test'
build: 'build'
tmp: '.tmp'
docs: '.tmp/docs'
coffee:
test:
expand: true
src: 'test/{,*/}*.coffee'
dest: '<%= config.tmp %>'
ext: '.js'
build:
expand: true
src: 'src/{,*/}*.coffee'
dest: '<%= config.tmp %>'
ext: '.js'
s3:
options:
bucket: 'sdk.ttcdn.co'
region: 'eu-west-1'
access: 'public-read'
build:
upload: [
src: "<%= config.build %>/*"
dest: ""
]
bump:
options:
pushTo: "origin"
clean:
build:
files: [{
dot: true
src: [
'<%= config.build %>/*'
]
}]
copy:
build:
files: [{
expand: true,
cwd: '<%= config.build %>'
src: [
'**.*'
]
dest: '<%= config.build %>/'
filter: (src) ->
return not src.match(/\d+\.\d+\.\d+/)
rename: (dest, src) ->
parts = src.split(".")
extension = parts.pop()
parts.push('<%= pkg.version %>')
parts.push(extension)
dest + parts.join(".")
}]
concat:
docs:
src: ['<%= config.docs %>/classes/*.html', '!<%= config.docs %>/classes/TT.api.html', '<%= config.docs %>/classes/TT.api.html']
dest: '<%= config.build %>/tt.js.docs.html'
connect:
test:
options:
port: 9000
base: [
'<%= config.test %>'
'<%= config.tmp %>'
'<%= config.build %>'
'node_modules'
]
browserify:
tt:
src: ['<%= config.tmp %>/src/tt.js']
dest: '<%= config.build %>/tt.js'
api:
src: ['<%= config.tmp %>/src/tt-api.js']
dest: '<%= config.build %>/tt-api.js'
native:
src: ['<%= config.tmp %>/src/tt-native.js']
dest: '<%= config.build %>/tt-native.js'
watch:
test:
files: [
'<%= config.test %>/{,*/}*.coffee'
'<%= config.src %>/{,*/}*.coffee'
'test/index.html'
]
tasks: [
'test'
]
mocha:
all:
options:
run: true
bail: false
log: true
reporter: 'Spec'
urls: ['http://127.0.0.1:9000/index.html']
yuidoc:
compile:
name: '<%= pkg.name %>'
description: '<%= pkg.description %>'
version: '<%= pkg.version %>'
url: '<%= pkg.homepage %>'
options:
paths: 'src'
syntaxtype: "coffee"
extension: ".coffee"
themedir: 'docs/theme'
outdir: '<%= config.docs %>'
grunt.registerTask 'build', [
'clean:build'
'coffee:build'
'browserify'
'copy:build'
]
grunt.registerTask 'release', [
'build'
'docs'
's3'
]
grunt.registerTask 'test', [
'build'
'coffee:test'
'connect:test'
'mocha'
]
grunt.registerTask 'docs', [
'yuidoc:compile'
'concat:docs'
'copy:build'
]
| 14752 | module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
config:
src: 'src'
test: 'test'
build: 'build'
tmp: '.tmp'
docs: '.tmp/docs'
coffee:
test:
expand: true
src: 'test/{,*/}*.coffee'
dest: '<%= config.tmp %>'
ext: '.js'
build:
expand: true
src: 'src/{,*/}*.coffee'
dest: '<%= config.tmp %>'
ext: '.js'
s3:
options:
bucket: 'sdk.ttcdn.co'
region: 'eu-west-1'
access: 'public-read'
build:
upload: [
src: "<%= config.build %>/*"
dest: ""
]
bump:
options:
pushTo: "origin"
clean:
build:
files: [{
dot: true
src: [
'<%= config.build %>/*'
]
}]
copy:
build:
files: [{
expand: true,
cwd: '<%= config.build %>'
src: [
'**.*'
]
dest: '<%= config.build %>/'
filter: (src) ->
return not src.match(/\d+\.\d+\.\d+/)
rename: (dest, src) ->
parts = src.split(".")
extension = parts.pop()
parts.push('<%= pkg.version %>')
parts.push(extension)
dest + parts.join(".")
}]
concat:
docs:
src: ['<%= config.docs %>/classes/*.html', '!<%= config.docs %>/classes/TT.api.html', '<%= config.docs %>/classes/TT.api.html']
dest: '<%= config.build %>/tt.js.docs.html'
connect:
test:
options:
port: 9000
base: [
'<%= config.test %>'
'<%= config.tmp %>'
'<%= config.build %>'
'node_modules'
]
browserify:
tt:
src: ['<%= config.tmp %>/src/tt.js']
dest: '<%= config.build %>/tt.js'
api:
src: ['<%= config.tmp %>/src/tt-api.js']
dest: '<%= config.build %>/tt-api.js'
native:
src: ['<%= config.tmp %>/src/tt-native.js']
dest: '<%= config.build %>/tt-native.js'
watch:
test:
files: [
'<%= config.test %>/{,*/}*.coffee'
'<%= config.src %>/{,*/}*.coffee'
'test/index.html'
]
tasks: [
'test'
]
mocha:
all:
options:
run: true
bail: false
log: true
reporter: 'Spec'
urls: ['http://1192.168.127.12:9000/index.html']
yuidoc:
compile:
name: '<%= pkg.name %>'
description: '<%= pkg.description %>'
version: '<%= pkg.version %>'
url: '<%= pkg.homepage %>'
options:
paths: 'src'
syntaxtype: "coffee"
extension: ".coffee"
themedir: 'docs/theme'
outdir: '<%= config.docs %>'
grunt.registerTask 'build', [
'clean:build'
'coffee:build'
'browserify'
'copy:build'
]
grunt.registerTask 'release', [
'build'
'docs'
's3'
]
grunt.registerTask 'test', [
'build'
'coffee:test'
'connect:test'
'mocha'
]
grunt.registerTask 'docs', [
'yuidoc:compile'
'concat:docs'
'copy:build'
]
| true | module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
config:
src: 'src'
test: 'test'
build: 'build'
tmp: '.tmp'
docs: '.tmp/docs'
coffee:
test:
expand: true
src: 'test/{,*/}*.coffee'
dest: '<%= config.tmp %>'
ext: '.js'
build:
expand: true
src: 'src/{,*/}*.coffee'
dest: '<%= config.tmp %>'
ext: '.js'
s3:
options:
bucket: 'sdk.ttcdn.co'
region: 'eu-west-1'
access: 'public-read'
build:
upload: [
src: "<%= config.build %>/*"
dest: ""
]
bump:
options:
pushTo: "origin"
clean:
build:
files: [{
dot: true
src: [
'<%= config.build %>/*'
]
}]
copy:
build:
files: [{
expand: true,
cwd: '<%= config.build %>'
src: [
'**.*'
]
dest: '<%= config.build %>/'
filter: (src) ->
return not src.match(/\d+\.\d+\.\d+/)
rename: (dest, src) ->
parts = src.split(".")
extension = parts.pop()
parts.push('<%= pkg.version %>')
parts.push(extension)
dest + parts.join(".")
}]
concat:
docs:
src: ['<%= config.docs %>/classes/*.html', '!<%= config.docs %>/classes/TT.api.html', '<%= config.docs %>/classes/TT.api.html']
dest: '<%= config.build %>/tt.js.docs.html'
connect:
test:
options:
port: 9000
base: [
'<%= config.test %>'
'<%= config.tmp %>'
'<%= config.build %>'
'node_modules'
]
browserify:
tt:
src: ['<%= config.tmp %>/src/tt.js']
dest: '<%= config.build %>/tt.js'
api:
src: ['<%= config.tmp %>/src/tt-api.js']
dest: '<%= config.build %>/tt-api.js'
native:
src: ['<%= config.tmp %>/src/tt-native.js']
dest: '<%= config.build %>/tt-native.js'
watch:
test:
files: [
'<%= config.test %>/{,*/}*.coffee'
'<%= config.src %>/{,*/}*.coffee'
'test/index.html'
]
tasks: [
'test'
]
mocha:
all:
options:
run: true
bail: false
log: true
reporter: 'Spec'
urls: ['http://1PI:IP_ADDRESS:192.168.127.12END_PI:9000/index.html']
yuidoc:
compile:
name: '<%= pkg.name %>'
description: '<%= pkg.description %>'
version: '<%= pkg.version %>'
url: '<%= pkg.homepage %>'
options:
paths: 'src'
syntaxtype: "coffee"
extension: ".coffee"
themedir: 'docs/theme'
outdir: '<%= config.docs %>'
grunt.registerTask 'build', [
'clean:build'
'coffee:build'
'browserify'
'copy:build'
]
grunt.registerTask 'release', [
'build'
'docs'
's3'
]
grunt.registerTask 'test', [
'build'
'coffee:test'
'connect:test'
'mocha'
]
grunt.registerTask 'docs', [
'yuidoc:compile'
'concat:docs'
'copy:build'
]
|
[
{
"context": "sification.annotations\n annotation._key = Math.random()\n task = @props.workflow.tasks[annotation",
"end": 444,
"score": 0.9441130757331848,
"start": 431,
"tag": "KEY",
"value": "Math.random()"
}
] | app/classifier/classification-summary.cjsx | Crentist/Panoptes-frontend-spanish | 1 | React = require 'react'
tasks = require './tasks'
module.exports = React.createClass
displayName: 'ClassificationSummary'
getDefaultProps: ->
workflow: null
classification: null
render: ->
<div className="classification-summary">
{if @props.classification.annotations.length is 0
'No annotations'
else
for annotation in @props.classification.annotations
annotation._key = Math.random()
task = @props.workflow.tasks[annotation.task]
SummaryComponent = tasks[task.type].Summary # TODO: There's a lot of duplicated code in these modules.
<div key={annotation._key} className="classification-task-summary">
<SummaryComponent task={task} annotation={annotation} onToggle={@props.onToggle} />
</div>}
</div>
| 47970 | React = require 'react'
tasks = require './tasks'
module.exports = React.createClass
displayName: 'ClassificationSummary'
getDefaultProps: ->
workflow: null
classification: null
render: ->
<div className="classification-summary">
{if @props.classification.annotations.length is 0
'No annotations'
else
for annotation in @props.classification.annotations
annotation._key = <KEY>
task = @props.workflow.tasks[annotation.task]
SummaryComponent = tasks[task.type].Summary # TODO: There's a lot of duplicated code in these modules.
<div key={annotation._key} className="classification-task-summary">
<SummaryComponent task={task} annotation={annotation} onToggle={@props.onToggle} />
</div>}
</div>
| true | React = require 'react'
tasks = require './tasks'
module.exports = React.createClass
displayName: 'ClassificationSummary'
getDefaultProps: ->
workflow: null
classification: null
render: ->
<div className="classification-summary">
{if @props.classification.annotations.length is 0
'No annotations'
else
for annotation in @props.classification.annotations
annotation._key = PI:KEY:<KEY>END_PI
task = @props.workflow.tasks[annotation.task]
SummaryComponent = tasks[task.type].Summary # TODO: There's a lot of duplicated code in these modules.
<div key={annotation._key} className="classification-task-summary">
<SummaryComponent task={task} annotation={annotation} onToggle={@props.onToggle} />
</div>}
</div>
|
[
{
"context": " options.data.views\n }, {\n name: \"Просмотры\",\n pointStart: options.startDate",
"end": 2898,
"score": 0.5601512789726257,
"start": 2897,
"tag": "NAME",
"value": "П"
}
] | src/Vifeed/FrontendBundle/Resources/assets/js/analytics/services/chart-configurator.coffee | bzis/zomba | 0 | angular.module('analytics').factory 'ChartConfigurator', [
'$window', 'Statistics', ($window, Statistics) ->
'use strict'
new class ChartConfigurator
HOUR_IN_SECS = 3600000
HOURS_24 = 24
moment = $window.moment
highcharts = $window.Highcharts
getConfig: (opts = {}) ->
validateOptions opts
config = {}
if opts.hourly? and opts.hourly is true
config =
data: buildHourViews(opts.records)
startDate: opts.period.startDate
dayInterval: 1
else
config =
data: buildDailyViews(opts.period, opts.records)
startDate: opts.period.startDate
dayInterval: HOURS_24
getChartConfig(config, opts)
# private
validateOptions = (options) ->
throw new Error 'The property "period" is not set' if not options.period?.startDate? or not options.period.endDate?
throw new Error 'The property "zoomLevel" is not set' unless options.zoomLevel?
throw new Error 'The property "records" is not set' unless options.records?
throw new Error 'The property "records" must be an array' unless angular.isArray options.records
getChartConfig = (config, opts) ->
{
options:
chart:
type: 'areaspline'
zoomType: 'x'
height: '300'
subtitle:
text: 'Нажмите на графике и перетащите границу участка, чтобы увидеть детальные данные'
xAxis:
type: 'datetime'
maxZoom: opts.zoomLevel * HOURS_24 * HOUR_IN_SECS
title:
text: null
yAxis:
title:
text: 'Количество показов и просмотров'
min: 0
tooltip:
shared: true
legend:
enabled: false
plotOptions:
area:
fillColor:
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }
stops: [
[0, highcharts.getOptions().colors[0]]
[1, highcharts.Color(highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
lineWidth: 1
marker:
enabled: false
shadow: false
states:
hover:
lineWidth: 1
threshold: null
series: getSeries(config)
title:
text: null
credits:
enabled: false
loading: false
}
getSeries = (options) ->
series = []
series.push {
name: "Показы"
pointStart: options.startDate.valueOf()
pointInterval: options.dayInterval * HOUR_IN_SECS
data: options.data.views
}, {
name: "Просмотры",
pointStart: options.startDate.valueOf()
pointInterval: options.dayInterval * HOUR_IN_SECS
data: options.data.paidViews
}
series
buildDailyViews = (period, records = []) ->
container = views: [], paidViews: []
iterator = moment.twix(period.startDate.valueOf(), period.endDate.valueOf()).iterate 'days'
while iterator.hasNext()
current = iterator.next()
data =
views: [current.format('LL'), 0]
paidViews: [current.format('LL'), 0]
for record in records
if record.date? and record.date is current.format 'YYYY-MM-DD'
data.views = [current.format('LL'), parseInt(record.views, 10)]
data.paidViews = [current.format('LL'), parseInt(record.paid_views, 10)]
container.views.push data.views
container.paidViews.push data.paidViews
container
buildHourViews = (records = []) ->
container = views: [], paidViews: []
for i in [0...HOURS_24]
label = "0#{i}:00".slice(-5)
data = views: [label, 0], paidViews: [label, 0]
for record in records
if record.hour? and parseInt(record.hour, 10) is i
data.views = [label, parseInt(record.views, 10)]
data.paidViews = [label, parseInt(record.paid_views, 10)]
container.views.push data.views
container.paidViews.push data.paidViews
container
]
| 50562 | angular.module('analytics').factory 'ChartConfigurator', [
'$window', 'Statistics', ($window, Statistics) ->
'use strict'
new class ChartConfigurator
HOUR_IN_SECS = 3600000
HOURS_24 = 24
moment = $window.moment
highcharts = $window.Highcharts
getConfig: (opts = {}) ->
validateOptions opts
config = {}
if opts.hourly? and opts.hourly is true
config =
data: buildHourViews(opts.records)
startDate: opts.period.startDate
dayInterval: 1
else
config =
data: buildDailyViews(opts.period, opts.records)
startDate: opts.period.startDate
dayInterval: HOURS_24
getChartConfig(config, opts)
# private
validateOptions = (options) ->
throw new Error 'The property "period" is not set' if not options.period?.startDate? or not options.period.endDate?
throw new Error 'The property "zoomLevel" is not set' unless options.zoomLevel?
throw new Error 'The property "records" is not set' unless options.records?
throw new Error 'The property "records" must be an array' unless angular.isArray options.records
getChartConfig = (config, opts) ->
{
options:
chart:
type: 'areaspline'
zoomType: 'x'
height: '300'
subtitle:
text: 'Нажмите на графике и перетащите границу участка, чтобы увидеть детальные данные'
xAxis:
type: 'datetime'
maxZoom: opts.zoomLevel * HOURS_24 * HOUR_IN_SECS
title:
text: null
yAxis:
title:
text: 'Количество показов и просмотров'
min: 0
tooltip:
shared: true
legend:
enabled: false
plotOptions:
area:
fillColor:
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }
stops: [
[0, highcharts.getOptions().colors[0]]
[1, highcharts.Color(highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
lineWidth: 1
marker:
enabled: false
shadow: false
states:
hover:
lineWidth: 1
threshold: null
series: getSeries(config)
title:
text: null
credits:
enabled: false
loading: false
}
getSeries = (options) ->
series = []
series.push {
name: "Показы"
pointStart: options.startDate.valueOf()
pointInterval: options.dayInterval * HOUR_IN_SECS
data: options.data.views
}, {
name: "<NAME>росмотры",
pointStart: options.startDate.valueOf()
pointInterval: options.dayInterval * HOUR_IN_SECS
data: options.data.paidViews
}
series
buildDailyViews = (period, records = []) ->
container = views: [], paidViews: []
iterator = moment.twix(period.startDate.valueOf(), period.endDate.valueOf()).iterate 'days'
while iterator.hasNext()
current = iterator.next()
data =
views: [current.format('LL'), 0]
paidViews: [current.format('LL'), 0]
for record in records
if record.date? and record.date is current.format 'YYYY-MM-DD'
data.views = [current.format('LL'), parseInt(record.views, 10)]
data.paidViews = [current.format('LL'), parseInt(record.paid_views, 10)]
container.views.push data.views
container.paidViews.push data.paidViews
container
buildHourViews = (records = []) ->
container = views: [], paidViews: []
for i in [0...HOURS_24]
label = "0#{i}:00".slice(-5)
data = views: [label, 0], paidViews: [label, 0]
for record in records
if record.hour? and parseInt(record.hour, 10) is i
data.views = [label, parseInt(record.views, 10)]
data.paidViews = [label, parseInt(record.paid_views, 10)]
container.views.push data.views
container.paidViews.push data.paidViews
container
]
| true | angular.module('analytics').factory 'ChartConfigurator', [
'$window', 'Statistics', ($window, Statistics) ->
'use strict'
new class ChartConfigurator
HOUR_IN_SECS = 3600000
HOURS_24 = 24
moment = $window.moment
highcharts = $window.Highcharts
getConfig: (opts = {}) ->
validateOptions opts
config = {}
if opts.hourly? and opts.hourly is true
config =
data: buildHourViews(opts.records)
startDate: opts.period.startDate
dayInterval: 1
else
config =
data: buildDailyViews(opts.period, opts.records)
startDate: opts.period.startDate
dayInterval: HOURS_24
getChartConfig(config, opts)
# private
validateOptions = (options) ->
throw new Error 'The property "period" is not set' if not options.period?.startDate? or not options.period.endDate?
throw new Error 'The property "zoomLevel" is not set' unless options.zoomLevel?
throw new Error 'The property "records" is not set' unless options.records?
throw new Error 'The property "records" must be an array' unless angular.isArray options.records
getChartConfig = (config, opts) ->
{
options:
chart:
type: 'areaspline'
zoomType: 'x'
height: '300'
subtitle:
text: 'Нажмите на графике и перетащите границу участка, чтобы увидеть детальные данные'
xAxis:
type: 'datetime'
maxZoom: opts.zoomLevel * HOURS_24 * HOUR_IN_SECS
title:
text: null
yAxis:
title:
text: 'Количество показов и просмотров'
min: 0
tooltip:
shared: true
legend:
enabled: false
plotOptions:
area:
fillColor:
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }
stops: [
[0, highcharts.getOptions().colors[0]]
[1, highcharts.Color(highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
lineWidth: 1
marker:
enabled: false
shadow: false
states:
hover:
lineWidth: 1
threshold: null
series: getSeries(config)
title:
text: null
credits:
enabled: false
loading: false
}
getSeries = (options) ->
series = []
series.push {
name: "Показы"
pointStart: options.startDate.valueOf()
pointInterval: options.dayInterval * HOUR_IN_SECS
data: options.data.views
}, {
name: "PI:NAME:<NAME>END_PIросмотры",
pointStart: options.startDate.valueOf()
pointInterval: options.dayInterval * HOUR_IN_SECS
data: options.data.paidViews
}
series
buildDailyViews = (period, records = []) ->
container = views: [], paidViews: []
iterator = moment.twix(period.startDate.valueOf(), period.endDate.valueOf()).iterate 'days'
while iterator.hasNext()
current = iterator.next()
data =
views: [current.format('LL'), 0]
paidViews: [current.format('LL'), 0]
for record in records
if record.date? and record.date is current.format 'YYYY-MM-DD'
data.views = [current.format('LL'), parseInt(record.views, 10)]
data.paidViews = [current.format('LL'), parseInt(record.paid_views, 10)]
container.views.push data.views
container.paidViews.push data.paidViews
container
buildHourViews = (records = []) ->
container = views: [], paidViews: []
for i in [0...HOURS_24]
label = "0#{i}:00".slice(-5)
data = views: [label, 0], paidViews: [label, 0]
for record in records
if record.hour? and parseInt(record.hour, 10) is i
data.views = [label, parseInt(record.views, 10)]
data.paidViews = [label, parseInt(record.paid_views, 10)]
container.views.push data.views
container.paidViews.push data.paidViews
container
]
|
[
{
"context": " @utils.setupHash @scope, [\n key : \"page\"\n post_change : () =>\n ",
"end": 278,
"score": 0.9256280660629272,
"start": 274,
"tag": "KEY",
"value": "page"
},
{
"context": " @utils.setupHash s, [\n key : \"read... | app/scripts/result_controllers.coffee | Keeleressursid/korp-frontend | 1 | korpApp = angular.module("korpApp")
korpApp.controller "resultContainerCtrl", ($scope, searches, $location) ->
$scope.searches = searches
class KwicCtrl
setupHash : () ->
c.log "setupHash", @scope.$id
@utils.setupHash @scope, [
key : "page"
post_change : () =>
c.log "post_change page hash", @scope.page
@scope.pageObj.pager = (@scope.page or 0) + 1
c.log "@scope.pageObj.pager", @scope.pageObj.pager
val_in : Number
]
initPage : () ->
@scope.pageObj =
pager: Number(@location.search().page) + 1 or 1
@scope.page = @scope.pageObj.pager - 1
@$inject: ['$scope', "$timeout", "utils", "$location", "kwicDownload"]
constructor: (@scope, @timeout, @utils, @location, @kwicDownload) ->
s = @scope
$scope = @scope
c.log "kwicCtrl init", $scope.$parent
$location = @location
s.onexit = () ->
c.log "onexit"
s.$root.sidebar_visible = false
punctArray = [",", ".", ";", ":", "!", "?", "..."]
@initPage()
s.pageChange = ($event, page) ->
c.log "pageChange", arguments
$event.stopPropagation()
s.page = page - 1
@setupHash()
s.onPageInput = ($event, page, numPages) ->
if $event.keyCode == 13
if page > numPages then page = numPages
if page <= 0 then page = "1"
s.gotoPage = page
s.pageObj.pager = page
s.page = Number(page) - 1
readingChange = () ->
if s.instance?.getProxy().pendingRequests.length
window.pending = s.instance.getProxy().pendingRequests
$.when(s.instance.getProxy().pendingRequests...).then () ->
c.log "readingchange makeRequest"
s.instance.makeRequest()
s.setupReadingHash = () =>
@utils.setupHash s, [
key : "reading_mode",
post_change : (isReading) =>
c.log "change reading mode", isReading
readingChange()
]
# used by example kwic
s.setupReadingWatch = _.once () ->
c.log "setupReadingWatch"
init = true
s.$watch "reading_mode", () ->
if not init
readingChange()
init = false
s.toggleReading = () ->
s.reading_mode = not s.reading_mode
s.instance.centerScrollbar()
s.hitspictureClick = (pageNumber) ->
c.log "pageNumber", pageNumber
s.page = Number(pageNumber)
massageData = (hitArray) ->
prevCorpus = ""
output = []
for hitContext, i in hitArray
currentStruct = {}
if currentMode == "parallel"
mainCorpusId = hitContext.corpus.split("|")[0].toLowerCase()
linkCorpusId = hitContext.corpus.split("|")[1].toLowerCase()
else
mainCorpusId = hitContext.corpus.toLowerCase()
id = (linkCorpusId or mainCorpusId)
[matchSentenceStart, matchSentenceEnd] = findMatchSentence hitContext
if not (hitContext.match instanceof Array)
matches = [{start: hitContext.match.start, end: hitContext.match.end}]
else
matches = hitContext.match
for j in [0...hitContext.tokens.length]
wd = hitContext.tokens[j]
wd.position = j
wd._open = []
wd._close = []
for {start, end} in matches
if start <= j < end
_.extend wd, {_match : true}
if matchSentenceStart < j < matchSentenceEnd
_.extend wd, {_matchSentence : true}
if wd.word in punctArray
_.extend wd, {_punct : true}
for structItem in wd.structs?.open or []
spaceIdx = structItem.indexOf(" ")
if spaceIdx == -1
key = structItem
val = ""
else
key = structItem.substring(0, spaceIdx)
val = structItem.substring(spaceIdx + 1)
wd._open.push key
if key of settings.corpora[id].attributes
currentStruct[key] = val
_.extend wd, currentStruct
for structItem in wd.structs?.close or []
wd._close.push structItem
delete currentStruct[structItem]
if prevCorpus != id
corpus = settings.corpora[id]
newSent = {newCorpus : corpus.title, noContext : _.keys(corpus.context).length == 1}
output.push newSent
if i % 2 == 0
hitContext._color = settings.primaryColor
else
hitContext._color = settings.primaryLight
hitContext.corpus = mainCorpusId
output.push(hitContext)
if hitContext.aligned
[corpus_aligned, tokens] = _.toPairs(hitContext.aligned)[0]
output.push
tokens : tokens
isLinked : true
corpus : corpus_aligned
_color : hitContext._color
prevCorpus = id
return output
findMatchSentence = (hitContext) ->
span = []
{start, end} = hitContext.match
decr = start
incr = end
while decr >= 0
if "sentence" in (hitContext.tokens[decr--].structs?.open or [])
span[0] = decr
break
while incr < hitContext.tokens.length
if "sentence" in (hitContext.tokens[incr++].structs?.close or [])
span[1] = incr
break
return span
s.kwic = []
s.contextKwic = []
s.setContextData = (data) ->
s.kwic = []
s.pagerHitsPerPage = s.hitsPerPage
s.contextKwic = massageData data.kwic
s.setKwicData = (data) ->
s.contextKwic = []
s.pagerHitsPerPage = s.hitsPerPage
s.kwic = massageData(data.kwic)
c.log "selectionManager"
s.selectionManager = new util.SelectionManager()
s.selectLeft = (sentence) ->
if not sentence.match then return
sentence.tokens.slice 0, sentence.match.start
s.selectMatch = (sentence) ->
if not sentence.match then return
from = sentence.match.start
sentence.tokens.slice from, sentence.match.end
s.selectRight = (sentence) ->
if not sentence.match then return
from = sentence.match.end
len = sentence.tokens.length
sentence.tokens.slice from, len
s.$watch (() -> $location.search().hpp), (hpp) ->
s.hitsPerPage = hpp or 25
s.download =
options: [
{value: "", label: "download_kwic"},
{value: "kwic/csv", label: "download_kwic_csv"},
{value: "kwic/tsv", label: "download_kwic_tsv"},
{value: "annotations/csv", label: "download_annotations_csv"},
{value: "annotations/tsv", label: "download_annotations_tsv"},
]
selected: ""
init: (value, hitsDisplay) =>
if s.download.blobName
URL.revokeObjectURL s.download.blobName
if value == ""
return
requestData = s.instance.getProxy().prevParams
[fileName, blobName] = @kwicDownload.makeDownload value.split("/")..., s.kwic, requestData, hitsDisplay
s.download.fileName = fileName
s.download.blobName = blobName
s.download.selected = ""
@timeout (() ->
angular.element("#kwicDownloadLink")[0].click()
), 0
korpApp.directive "kwicCtrl", () ->
controller: KwicCtrl
class ExampleCtrl extends KwicCtrl
@$inject: ['$scope', "$timeout", "utils", "$location", "kwicDownload"]
constructor: (@scope, $timeout, utils, $location, @kwicDownload) ->
super(@scope, $timeout, utils, $location, @kwicDownload)
s = @scope
s.$root.word_selected = false
s.newDynamicTab()
s.hitspictureClick = (pageNumber) ->
s.page = Number(pageNumber)
s.pageObj.pager = Number(pageNumber + 1)
s.pageChange(null, pageNumber + 1)
s.pageChange = ($event, page) ->
$event?.stopPropagation()
s.instance.current_page = page - 1
s.instance.makeRequest()
s.exampleReadingMode = s.kwicTab.readingMode
s.toggleReading = () ->
s.exampleReadingMode = not s.exampleReadingMode
s.instance.centerScrollbar()
if s.instance?.getProxy().pendingRequests.length
window.pending = s.instance.getProxy().pendingRequests
$.when(s.instance.getProxy().pendingRequests...).then () ->
s.instance.makeRequest()
initPage : () ->
@scope.pageObj =
pager : 0
@scope.page = 0
setupHash : () ->
korpApp.directive "exampleCtrl", () ->
controller: ExampleCtrl
korpApp.directive "statsResultCtrl", () ->
controller: ($scope, utils, $location, backend, searches, $rootScope) ->
s = $scope
s.loading = false
s.progress = 0
s.$watch (() -> $location.search().hide_stats), (val) ->
s.showStatistics = not val?
s.$watch (() -> $location.search().in_order), (val) ->
s.inOrder = not val?
s.shouldSearch = () ->
return s.showStatistics and s.inOrder
$scope.activate = () ->
$location.search("hide_stats", null)
cqp = searches.getCqpExpr()
s.showStatistics = true
$scope.instance.makeRequest(cqp)
s.onGraphShow = (data) ->
$rootScope.graphTabs.push data
s.newMapEnabled = settings.newMapEnabled
s.getGeoAttributes = (corpora) ->
attrs = {}
for corpus in settings.corpusListing.subsetFactory(corpora).selected
for attr in corpus.private_struct_attributes
if attr.indexOf "geo" isnt -1
if attrs[attr]
attrs[attr].corpora.push corpus.id
else
attrs[attr] =
label: attr
corpora: [corpus.id]
attrs = _.map attrs, (val) -> val
if attrs and attrs.length > 0
attrs[0].selected = true
s.mapAttributes = attrs
s.mapToggleSelected = (index, event) ->
_.map s.mapAttributes, (attr) -> attr.selected = false
attr = s.mapAttributes[index]
attr.selected = true
event.stopPropagation()
s.showMap = () ->
cqpExpr = CQP.expandOperators searches.getCqpExpr()
cqpExprs = {}
for rowIx in s.instance.getSelectedRows()
if rowIx == 0
continue
row = s.instance.getDataAt(rowIx)
searchParams = s.instance.searchParams
cqp = statisticsFormatting.getCqp row.statsValues, searchParams.ignoreCase
parts = for reduceVal in searchParams.reduceVals
row.formattedValue[reduceVal]
cqpExprs[cqp] = parts.join ", "
selectedAttributes = _.filter(s.mapAttributes, "selected")
if selectedAttributes.length > 1
c.log "Warning: more than one selected attribute, choosing first"
selectedAttribute = selectedAttributes[0]
within = settings.corpusListing.subsetFactory(selectedAttribute.corpora).getWithinParameters()
$rootScope.mapTabs.push backend.requestMapData(cqpExpr, cqpExprs, within, selectedAttribute)
korpApp.directive "wordpicCtrl", () ->
controller: ($scope, $rootScope, $location, utils, searches) ->
$scope.loading = false
$scope.progress = 0
$scope.word_pic = $location.search().word_pic?
$scope.$watch (() -> $location.search().word_pic), (val) ->
$scope.word_pic = Boolean(val)
$scope.activate = () ->
$location.search("word_pic", true)
search = searches.activeSearch
searchVal = if search.type == "lemgram" then unregescape search.val else search.val
$scope.instance.makeRequest(searchVal, search.type)
$scope.settings =
showNumberOfHits: "15"
$scope.hitSettings = ["15"]
$scope.minimize = (table) ->
return table.slice 0, $scope.settings.showNumberOfHits
$scope.onClickExample = (event, row) ->
data = row
opts = {}
opts.ajaxParams =
start : 0
end : 24
command : "relations_sentences"
source : data.source.join(",")
corpus: data.corpus
$rootScope.kwicTabs.push { queryParams: opts }
$scope.showWordClass = false
$rootScope.$on "word_picture_data_available", (event, data) ->
$scope.data = data
max = 0
_.map data, (form) ->
_.map form, (categories) ->
if categories instanceof Array
_.map categories, (cols) ->
_.map cols, (col) ->
if col.table and (col.table.length > max)
max = col.table.length
$scope.hitSettings = []
if max < 15
$scope.settings =
showNumberOfHits: "1000"
else
$scope.hitSettings.push "15"
$scope.settings =
showNumberOfHits: "15"
if max > 50
$scope.hitSettings.push "50"
if max > 100
$scope.hitSettings.push "100"
if max > 500
$scope.hitSettings.push "500"
$scope.hitSettings.push "1000"
$scope.localeString = (lang, hitSetting) ->
if hitSetting == "1000"
return util.getLocaleString "word_pic_show_all", lang
else
return util.getLocaleString("word_pic_show_some", lang) + " " + hitSetting + " " + util.getLocaleString("word_pic_hits", lang)
$scope.isLemgram = (word) ->
return util.isLemgramId(word)
$scope.renderTable = (obj) ->
return obj instanceof Array
$scope.parseLemgram = (row, allLemgrams) ->
set = row[row.show_rel].split('|')
lemgram = set[0]
word = _.trim(lemgram)
infixIndex = ""
concept = lemgram
infixIndex = ""
type = "-"
hasHomograph = (lemgram.slice 0, -1) in allLemgrams
prefix = row.depextra
if util.isLemgramId(lemgram)
match = util.splitLemgram(lemgram)
infixIndex = match.index
if row.dep
concept = match.form.replace(/_/g, " ")
else
concept = "-"
type = match.pos.slice(0, 2)
return {
label: prefix + " " + concept
pos: type
idx: infixIndex
showIdx: not(infixIndex is "" or infixIndex is "1")
}
$scope.getTableClass = (wordClass, parentIdx, idx) ->
return settings.wordPictureConf[wordClass][parentIdx][idx].css_class
$scope.getHeaderLabel = (header, section, idx) ->
if header.alt_label
return header.alt_label
else
return "rel_" + section[idx].rel
$scope.getHeaderClasses = (header, token) ->
if header isnt '_'
return "lemgram_header_item " + header.css_class
else
classes = "hit"
if $scope.isLemgram(token)
classes += " lemgram"
return classes
$scope.renderResultHeader = (parentIndex, section, wordClass, index) ->
headers = settings.wordPictureConf[wordClass][parentIndex]
return section[index] and section[index].table
$scope.getResultHeader = (index, wordClass) ->
return settings.wordPictureConf[wordClass][index]
$scope.fromLemgram = (maybeLemgram) ->
if util.isLemgramId(maybeLemgram)
return util.splitLemgram(maybeLemgram).form
else
return maybeLemgram
korpApp.directive "graphCtrl", () ->
controller: ($scope) ->
s = $scope
s.newDynamicTab()
s.mode = "line"
s.isGraph = () -> s.mode in ["line", "bar"]
s.isTable = () -> s.mode == "table"
korpApp.directive "compareCtrl", () ->
controller: ($scope, $rootScope) ->
s = $scope
s.loading = true
s.newDynamicTab()
s.resultOrder = (item) ->
return Math.abs item.loglike
s.promise.then (([tables, max, cmp1, cmp2, reduce], xhr) ->
s.loading = false
s.tables = tables
s.reduce = reduce
cl = settings.corpusListing.subsetFactory([].concat cmp1.corpora, cmp2.corpora)
attributes = (_.extend {}, cl.getCurrentAttributes(), cl.getStructAttrs())
s.stringify = _.map reduce, (item) ->
return attributes[_.trimStart item, "_."]?.stringify or angular.identity
s.max = max
s.cmp1 = cmp1
s.cmp2 = cmp2
cmps = [cmp1, cmp2]
s.rowClick = (row, cmp_index) ->
cmp = cmps[cmp_index]
splitTokens = _.map row.elems, (elem) ->
_.map (elem.split "/"), (tokens) ->
tokens.split " "
# number of tokens in search
tokenLength = splitTokens[0][0].length
# transform result from grouping on attribute to grouping on token place
tokens = _.map [0 .. tokenLength - 1], (tokenIdx) ->
tokens = _.map reduce, (reduceAttr, attrIdx) ->
return _.uniq _.map(splitTokens, (res) ->
return res[attrIdx][tokenIdx])
return tokens
cqps = _.map tokens, (token) ->
cqpAnd = _.map [0..token.length-1], (attrI) ->
attrKey = reduce[attrI]
attrVal = token[attrI]
if "_." in attrKey
c.log "error, attribute key contains _."
attribute = attributes[attrKey]
if attribute
type = attribute.type
attrKey = "_." + attrKey if attribute.isStructAttr
op = if type == "set" then "contains" else "="
if type == "set" and attrVal.length > 1
variants = []
_.map attrVal, (val) ->
parts = val.split(":")
if variants.length == 0
for idx in [0..parts.length - 2]
variants.push []
for idx in [1..parts.length - 1]
variants[idx - 1].push parts[idx]
key = attrVal[0].split(":")[0]
variants = _.map variants, (variant) ->
return ":(" + variant.join("|") + ")"
val = key + variants.join("")
else
val = attrVal[0]
if type == "set" and (val == "|" or val == "")
return "ambiguity(#{attrKey}) = 0"
else
return "#{attrKey} #{op} \"#{val}\""
return "[" + cqpAnd.join(" & ") + "]"
cqp = cqps.join " "
cl = settings.corpusListing.subsetFactory cmp.corpora
opts = {
start : 0
end : 24
ajaxParams :
command : "query"
cqp : cmp.cqp
cqp2 : cqp
corpus : cl.stringifySelected()
show_struct : _.keys cl.getStructAttrs()
expand_prequeries : false
}
$rootScope.kwicTabs.push { queryParams: opts }),
() ->
s.loading = false
s.error = true
| 59319 | korpApp = angular.module("korpApp")
korpApp.controller "resultContainerCtrl", ($scope, searches, $location) ->
$scope.searches = searches
class KwicCtrl
setupHash : () ->
c.log "setupHash", @scope.$id
@utils.setupHash @scope, [
key : "<KEY>"
post_change : () =>
c.log "post_change page hash", @scope.page
@scope.pageObj.pager = (@scope.page or 0) + 1
c.log "@scope.pageObj.pager", @scope.pageObj.pager
val_in : Number
]
initPage : () ->
@scope.pageObj =
pager: Number(@location.search().page) + 1 or 1
@scope.page = @scope.pageObj.pager - 1
@$inject: ['$scope', "$timeout", "utils", "$location", "kwicDownload"]
constructor: (@scope, @timeout, @utils, @location, @kwicDownload) ->
s = @scope
$scope = @scope
c.log "kwicCtrl init", $scope.$parent
$location = @location
s.onexit = () ->
c.log "onexit"
s.$root.sidebar_visible = false
punctArray = [",", ".", ";", ":", "!", "?", "..."]
@initPage()
s.pageChange = ($event, page) ->
c.log "pageChange", arguments
$event.stopPropagation()
s.page = page - 1
@setupHash()
s.onPageInput = ($event, page, numPages) ->
if $event.keyCode == 13
if page > numPages then page = numPages
if page <= 0 then page = "1"
s.gotoPage = page
s.pageObj.pager = page
s.page = Number(page) - 1
readingChange = () ->
if s.instance?.getProxy().pendingRequests.length
window.pending = s.instance.getProxy().pendingRequests
$.when(s.instance.getProxy().pendingRequests...).then () ->
c.log "readingchange makeRequest"
s.instance.makeRequest()
s.setupReadingHash = () =>
@utils.setupHash s, [
key : "<KEY>",
post_change : (isReading) =>
c.log "change reading mode", isReading
readingChange()
]
# used by example kwic
s.setupReadingWatch = _.once () ->
c.log "setupReadingWatch"
init = true
s.$watch "reading_mode", () ->
if not init
readingChange()
init = false
s.toggleReading = () ->
s.reading_mode = not s.reading_mode
s.instance.centerScrollbar()
s.hitspictureClick = (pageNumber) ->
c.log "pageNumber", pageNumber
s.page = Number(pageNumber)
massageData = (hitArray) ->
prevCorpus = ""
output = []
for hitContext, i in hitArray
currentStruct = {}
if currentMode == "parallel"
mainCorpusId = hitContext.corpus.split("|")[0].toLowerCase()
linkCorpusId = hitContext.corpus.split("|")[1].toLowerCase()
else
mainCorpusId = hitContext.corpus.toLowerCase()
id = (linkCorpusId or mainCorpusId)
[matchSentenceStart, matchSentenceEnd] = findMatchSentence hitContext
if not (hitContext.match instanceof Array)
matches = [{start: hitContext.match.start, end: hitContext.match.end}]
else
matches = hitContext.match
for j in [0...hitContext.tokens.length]
wd = hitContext.tokens[j]
wd.position = j
wd._open = []
wd._close = []
for {start, end} in matches
if start <= j < end
_.extend wd, {_match : true}
if matchSentenceStart < j < matchSentenceEnd
_.extend wd, {_matchSentence : true}
if wd.word in punctArray
_.extend wd, {_punct : true}
for structItem in wd.structs?.open or []
spaceIdx = structItem.indexOf(" ")
if spaceIdx == -1
key = structItem
val = ""
else
key = structItem.substring(0, spaceIdx)
val = structItem.substring(spaceIdx + 1)
wd._open.push key
if key of settings.corpora[id].attributes
currentStruct[key] = val
_.extend wd, currentStruct
for structItem in wd.structs?.close or []
wd._close.push structItem
delete currentStruct[structItem]
if prevCorpus != id
corpus = settings.corpora[id]
newSent = {newCorpus : corpus.title, noContext : _.keys(corpus.context).length == 1}
output.push newSent
if i % 2 == 0
hitContext._color = settings.primaryColor
else
hitContext._color = settings.primaryLight
hitContext.corpus = mainCorpusId
output.push(hitContext)
if hitContext.aligned
[corpus_aligned, tokens] = _.toPairs(hitContext.aligned)[0]
output.push
tokens : tokens
isLinked : true
corpus : corpus_aligned
_color : hitContext._color
prevCorpus = id
return output
findMatchSentence = (hitContext) ->
span = []
{start, end} = hitContext.match
decr = start
incr = end
while decr >= 0
if "sentence" in (hitContext.tokens[decr--].structs?.open or [])
span[0] = decr
break
while incr < hitContext.tokens.length
if "sentence" in (hitContext.tokens[incr++].structs?.close or [])
span[1] = incr
break
return span
s.kwic = []
s.contextKwic = []
s.setContextData = (data) ->
s.kwic = []
s.pagerHitsPerPage = s.hitsPerPage
s.contextKwic = massageData data.kwic
s.setKwicData = (data) ->
s.contextKwic = []
s.pagerHitsPerPage = s.hitsPerPage
s.kwic = massageData(data.kwic)
c.log "selectionManager"
s.selectionManager = new util.SelectionManager()
s.selectLeft = (sentence) ->
if not sentence.match then return
sentence.tokens.slice 0, sentence.match.start
s.selectMatch = (sentence) ->
if not sentence.match then return
from = sentence.match.start
sentence.tokens.slice from, sentence.match.end
s.selectRight = (sentence) ->
if not sentence.match then return
from = sentence.match.end
len = sentence.tokens.length
sentence.tokens.slice from, len
s.$watch (() -> $location.search().hpp), (hpp) ->
s.hitsPerPage = hpp or 25
s.download =
options: [
{value: "", label: "download_kwic"},
{value: "kwic/csv", label: "download_kwic_csv"},
{value: "kwic/tsv", label: "download_kwic_tsv"},
{value: "annotations/csv", label: "download_annotations_csv"},
{value: "annotations/tsv", label: "download_annotations_tsv"},
]
selected: ""
init: (value, hitsDisplay) =>
if s.download.blobName
URL.revokeObjectURL s.download.blobName
if value == ""
return
requestData = s.instance.getProxy().prevParams
[fileName, blobName] = @kwicDownload.makeDownload value.split("/")..., s.kwic, requestData, hitsDisplay
s.download.fileName = fileName
s.download.blobName = blobName
s.download.selected = ""
@timeout (() ->
angular.element("#kwicDownloadLink")[0].click()
), 0
korpApp.directive "kwicCtrl", () ->
controller: KwicCtrl
class ExampleCtrl extends KwicCtrl
@$inject: ['$scope', "$timeout", "utils", "$location", "kwicDownload"]
constructor: (@scope, $timeout, utils, $location, @kwicDownload) ->
super(@scope, $timeout, utils, $location, @kwicDownload)
s = @scope
s.$root.word_selected = false
s.newDynamicTab()
s.hitspictureClick = (pageNumber) ->
s.page = Number(pageNumber)
s.pageObj.pager = Number(pageNumber + 1)
s.pageChange(null, pageNumber + 1)
s.pageChange = ($event, page) ->
$event?.stopPropagation()
s.instance.current_page = page - 1
s.instance.makeRequest()
s.exampleReadingMode = s.kwicTab.readingMode
s.toggleReading = () ->
s.exampleReadingMode = not s.exampleReadingMode
s.instance.centerScrollbar()
if s.instance?.getProxy().pendingRequests.length
window.pending = s.instance.getProxy().pendingRequests
$.when(s.instance.getProxy().pendingRequests...).then () ->
s.instance.makeRequest()
initPage : () ->
@scope.pageObj =
pager : 0
@scope.page = 0
setupHash : () ->
korpApp.directive "exampleCtrl", () ->
controller: ExampleCtrl
korpApp.directive "statsResultCtrl", () ->
controller: ($scope, utils, $location, backend, searches, $rootScope) ->
s = $scope
s.loading = false
s.progress = 0
s.$watch (() -> $location.search().hide_stats), (val) ->
s.showStatistics = not val?
s.$watch (() -> $location.search().in_order), (val) ->
s.inOrder = not val?
s.shouldSearch = () ->
return s.showStatistics and s.inOrder
$scope.activate = () ->
$location.search("hide_stats", null)
cqp = searches.getCqpExpr()
s.showStatistics = true
$scope.instance.makeRequest(cqp)
s.onGraphShow = (data) ->
$rootScope.graphTabs.push data
s.newMapEnabled = settings.newMapEnabled
s.getGeoAttributes = (corpora) ->
attrs = {}
for corpus in settings.corpusListing.subsetFactory(corpora).selected
for attr in corpus.private_struct_attributes
if attr.indexOf "geo" isnt -1
if attrs[attr]
attrs[attr].corpora.push corpus.id
else
attrs[attr] =
label: attr
corpora: [corpus.id]
attrs = _.map attrs, (val) -> val
if attrs and attrs.length > 0
attrs[0].selected = true
s.mapAttributes = attrs
s.mapToggleSelected = (index, event) ->
_.map s.mapAttributes, (attr) -> attr.selected = false
attr = s.mapAttributes[index]
attr.selected = true
event.stopPropagation()
s.showMap = () ->
cqpExpr = CQP.expandOperators searches.getCqpExpr()
cqpExprs = {}
for rowIx in s.instance.getSelectedRows()
if rowIx == 0
continue
row = s.instance.getDataAt(rowIx)
searchParams = s.instance.searchParams
cqp = statisticsFormatting.getCqp row.statsValues, searchParams.ignoreCase
parts = for reduceVal in searchParams.reduceVals
row.formattedValue[reduceVal]
cqpExprs[cqp] = parts.join ", "
selectedAttributes = _.filter(s.mapAttributes, "selected")
if selectedAttributes.length > 1
c.log "Warning: more than one selected attribute, choosing first"
selectedAttribute = selectedAttributes[0]
within = settings.corpusListing.subsetFactory(selectedAttribute.corpora).getWithinParameters()
$rootScope.mapTabs.push backend.requestMapData(cqpExpr, cqpExprs, within, selectedAttribute)
korpApp.directive "wordpicCtrl", () ->
controller: ($scope, $rootScope, $location, utils, searches) ->
$scope.loading = false
$scope.progress = 0
$scope.word_pic = $location.search().word_pic?
$scope.$watch (() -> $location.search().word_pic), (val) ->
$scope.word_pic = Boolean(val)
$scope.activate = () ->
$location.search("word_pic", true)
search = searches.activeSearch
searchVal = if search.type == "lemgram" then unregescape search.val else search.val
$scope.instance.makeRequest(searchVal, search.type)
$scope.settings =
showNumberOfHits: "15"
$scope.hitSettings = ["15"]
$scope.minimize = (table) ->
return table.slice 0, $scope.settings.showNumberOfHits
$scope.onClickExample = (event, row) ->
data = row
opts = {}
opts.ajaxParams =
start : 0
end : 24
command : "relations_sentences"
source : data.source.join(",")
corpus: data.corpus
$rootScope.kwicTabs.push { queryParams: opts }
$scope.showWordClass = false
$rootScope.$on "word_picture_data_available", (event, data) ->
$scope.data = data
max = 0
_.map data, (form) ->
_.map form, (categories) ->
if categories instanceof Array
_.map categories, (cols) ->
_.map cols, (col) ->
if col.table and (col.table.length > max)
max = col.table.length
$scope.hitSettings = []
if max < 15
$scope.settings =
showNumberOfHits: "1000"
else
$scope.hitSettings.push "15"
$scope.settings =
showNumberOfHits: "15"
if max > 50
$scope.hitSettings.push "50"
if max > 100
$scope.hitSettings.push "100"
if max > 500
$scope.hitSettings.push "500"
$scope.hitSettings.push "1000"
$scope.localeString = (lang, hitSetting) ->
if hitSetting == "1000"
return util.getLocaleString "word_pic_show_all", lang
else
return util.getLocaleString("word_pic_show_some", lang) + " " + hitSetting + " " + util.getLocaleString("word_pic_hits", lang)
$scope.isLemgram = (word) ->
return util.isLemgramId(word)
$scope.renderTable = (obj) ->
return obj instanceof Array
$scope.parseLemgram = (row, allLemgrams) ->
set = row[row.show_rel].split('|')
lemgram = set[0]
word = _.trim(lemgram)
infixIndex = ""
concept = lemgram
infixIndex = ""
type = "-"
hasHomograph = (lemgram.slice 0, -1) in allLemgrams
prefix = row.depextra
if util.isLemgramId(lemgram)
match = util.splitLemgram(lemgram)
infixIndex = match.index
if row.dep
concept = match.form.replace(/_/g, " ")
else
concept = "-"
type = match.pos.slice(0, 2)
return {
label: prefix + " " + concept
pos: type
idx: infixIndex
showIdx: not(infixIndex is "" or infixIndex is "1")
}
$scope.getTableClass = (wordClass, parentIdx, idx) ->
return settings.wordPictureConf[wordClass][parentIdx][idx].css_class
$scope.getHeaderLabel = (header, section, idx) ->
if header.alt_label
return header.alt_label
else
return "rel_" + section[idx].rel
$scope.getHeaderClasses = (header, token) ->
if header isnt '_'
return "lemgram_header_item " + header.css_class
else
classes = "hit"
if $scope.isLemgram(token)
classes += " lemgram"
return classes
$scope.renderResultHeader = (parentIndex, section, wordClass, index) ->
headers = settings.wordPictureConf[wordClass][parentIndex]
return section[index] and section[index].table
$scope.getResultHeader = (index, wordClass) ->
return settings.wordPictureConf[wordClass][index]
$scope.fromLemgram = (maybeLemgram) ->
if util.isLemgramId(maybeLemgram)
return util.splitLemgram(maybeLemgram).form
else
return maybeLemgram
korpApp.directive "graphCtrl", () ->
controller: ($scope) ->
s = $scope
s.newDynamicTab()
s.mode = "line"
s.isGraph = () -> s.mode in ["line", "bar"]
s.isTable = () -> s.mode == "table"
korpApp.directive "compareCtrl", () ->
controller: ($scope, $rootScope) ->
s = $scope
s.loading = true
s.newDynamicTab()
s.resultOrder = (item) ->
return Math.abs item.loglike
s.promise.then (([tables, max, cmp1, cmp2, reduce], xhr) ->
s.loading = false
s.tables = tables
s.reduce = reduce
cl = settings.corpusListing.subsetFactory([].concat cmp1.corpora, cmp2.corpora)
attributes = (_.extend {}, cl.getCurrentAttributes(), cl.getStructAttrs())
s.stringify = _.map reduce, (item) ->
return attributes[_.trimStart item, "_."]?.stringify or angular.identity
s.max = max
s.cmp1 = cmp1
s.cmp2 = cmp2
cmps = [cmp1, cmp2]
s.rowClick = (row, cmp_index) ->
cmp = cmps[cmp_index]
splitTokens = _.map row.elems, (elem) ->
_.map (elem.split "/"), (tokens) ->
tokens.split " "
# number of tokens in search
tokenLength = splitTokens[0][0].length
# transform result from grouping on attribute to grouping on token place
tokens = _.map [0 .. tokenLength - 1], (tokenIdx) ->
tokens = _.map reduce, (reduceAttr, attrIdx) ->
return _.uniq _.map(splitTokens, (res) ->
return res[attrIdx][tokenIdx])
return tokens
cqps = _.map tokens, (token) ->
cqpAnd = _.map [0..token.length-1], (attrI) ->
attrKey = reduce[attrI]
attrVal = token[attrI]
if "_." in attrKey
c.log "error, attribute key contains _."
attribute = attributes[attrKey]
if attribute
type = attribute.type
attrKey = "_." + attrKey if attribute.isStructAttr
op = if type == "set" then "contains" else "="
if type == "set" and attrVal.length > 1
variants = []
_.map attrVal, (val) ->
parts = val.split(":")
if variants.length == 0
for idx in [0..parts.length - 2]
variants.push []
for idx in [1..parts.length - 1]
variants[idx - 1].push parts[idx]
key = attrVal[0].split(":")[0]
variants = _.map variants, (variant) ->
return ":(" + variant.join("|") + ")"
val = key + variants.join("")
else
val = attrVal[0]
if type == "set" and (val == "|" or val == "")
return "ambiguity(#{attrKey}) = 0"
else
return "#{attrKey} #{op} \"#{val}\""
return "[" + cqpAnd.join(" & ") + "]"
cqp = cqps.join " "
cl = settings.corpusListing.subsetFactory cmp.corpora
opts = {
start : 0
end : 24
ajaxParams :
command : "query"
cqp : cmp.cqp
cqp2 : cqp
corpus : cl.stringifySelected()
show_struct : _.keys cl.getStructAttrs()
expand_prequeries : false
}
$rootScope.kwicTabs.push { queryParams: opts }),
() ->
s.loading = false
s.error = true
| true | korpApp = angular.module("korpApp")
korpApp.controller "resultContainerCtrl", ($scope, searches, $location) ->
$scope.searches = searches
class KwicCtrl
setupHash : () ->
c.log "setupHash", @scope.$id
@utils.setupHash @scope, [
key : "PI:KEY:<KEY>END_PI"
post_change : () =>
c.log "post_change page hash", @scope.page
@scope.pageObj.pager = (@scope.page or 0) + 1
c.log "@scope.pageObj.pager", @scope.pageObj.pager
val_in : Number
]
initPage : () ->
@scope.pageObj =
pager: Number(@location.search().page) + 1 or 1
@scope.page = @scope.pageObj.pager - 1
@$inject: ['$scope', "$timeout", "utils", "$location", "kwicDownload"]
constructor: (@scope, @timeout, @utils, @location, @kwicDownload) ->
s = @scope
$scope = @scope
c.log "kwicCtrl init", $scope.$parent
$location = @location
s.onexit = () ->
c.log "onexit"
s.$root.sidebar_visible = false
punctArray = [",", ".", ";", ":", "!", "?", "..."]
@initPage()
s.pageChange = ($event, page) ->
c.log "pageChange", arguments
$event.stopPropagation()
s.page = page - 1
@setupHash()
s.onPageInput = ($event, page, numPages) ->
if $event.keyCode == 13
if page > numPages then page = numPages
if page <= 0 then page = "1"
s.gotoPage = page
s.pageObj.pager = page
s.page = Number(page) - 1
readingChange = () ->
if s.instance?.getProxy().pendingRequests.length
window.pending = s.instance.getProxy().pendingRequests
$.when(s.instance.getProxy().pendingRequests...).then () ->
c.log "readingchange makeRequest"
s.instance.makeRequest()
s.setupReadingHash = () =>
@utils.setupHash s, [
key : "PI:KEY:<KEY>END_PI",
post_change : (isReading) =>
c.log "change reading mode", isReading
readingChange()
]
# used by example kwic
s.setupReadingWatch = _.once () ->
c.log "setupReadingWatch"
init = true
s.$watch "reading_mode", () ->
if not init
readingChange()
init = false
s.toggleReading = () ->
s.reading_mode = not s.reading_mode
s.instance.centerScrollbar()
s.hitspictureClick = (pageNumber) ->
c.log "pageNumber", pageNumber
s.page = Number(pageNumber)
massageData = (hitArray) ->
prevCorpus = ""
output = []
for hitContext, i in hitArray
currentStruct = {}
if currentMode == "parallel"
mainCorpusId = hitContext.corpus.split("|")[0].toLowerCase()
linkCorpusId = hitContext.corpus.split("|")[1].toLowerCase()
else
mainCorpusId = hitContext.corpus.toLowerCase()
id = (linkCorpusId or mainCorpusId)
[matchSentenceStart, matchSentenceEnd] = findMatchSentence hitContext
if not (hitContext.match instanceof Array)
matches = [{start: hitContext.match.start, end: hitContext.match.end}]
else
matches = hitContext.match
for j in [0...hitContext.tokens.length]
wd = hitContext.tokens[j]
wd.position = j
wd._open = []
wd._close = []
for {start, end} in matches
if start <= j < end
_.extend wd, {_match : true}
if matchSentenceStart < j < matchSentenceEnd
_.extend wd, {_matchSentence : true}
if wd.word in punctArray
_.extend wd, {_punct : true}
for structItem in wd.structs?.open or []
spaceIdx = structItem.indexOf(" ")
if spaceIdx == -1
key = structItem
val = ""
else
key = structItem.substring(0, spaceIdx)
val = structItem.substring(spaceIdx + 1)
wd._open.push key
if key of settings.corpora[id].attributes
currentStruct[key] = val
_.extend wd, currentStruct
for structItem in wd.structs?.close or []
wd._close.push structItem
delete currentStruct[structItem]
if prevCorpus != id
corpus = settings.corpora[id]
newSent = {newCorpus : corpus.title, noContext : _.keys(corpus.context).length == 1}
output.push newSent
if i % 2 == 0
hitContext._color = settings.primaryColor
else
hitContext._color = settings.primaryLight
hitContext.corpus = mainCorpusId
output.push(hitContext)
if hitContext.aligned
[corpus_aligned, tokens] = _.toPairs(hitContext.aligned)[0]
output.push
tokens : tokens
isLinked : true
corpus : corpus_aligned
_color : hitContext._color
prevCorpus = id
return output
findMatchSentence = (hitContext) ->
span = []
{start, end} = hitContext.match
decr = start
incr = end
while decr >= 0
if "sentence" in (hitContext.tokens[decr--].structs?.open or [])
span[0] = decr
break
while incr < hitContext.tokens.length
if "sentence" in (hitContext.tokens[incr++].structs?.close or [])
span[1] = incr
break
return span
s.kwic = []
s.contextKwic = []
s.setContextData = (data) ->
s.kwic = []
s.pagerHitsPerPage = s.hitsPerPage
s.contextKwic = massageData data.kwic
s.setKwicData = (data) ->
s.contextKwic = []
s.pagerHitsPerPage = s.hitsPerPage
s.kwic = massageData(data.kwic)
c.log "selectionManager"
s.selectionManager = new util.SelectionManager()
s.selectLeft = (sentence) ->
if not sentence.match then return
sentence.tokens.slice 0, sentence.match.start
s.selectMatch = (sentence) ->
if not sentence.match then return
from = sentence.match.start
sentence.tokens.slice from, sentence.match.end
s.selectRight = (sentence) ->
if not sentence.match then return
from = sentence.match.end
len = sentence.tokens.length
sentence.tokens.slice from, len
s.$watch (() -> $location.search().hpp), (hpp) ->
s.hitsPerPage = hpp or 25
s.download =
options: [
{value: "", label: "download_kwic"},
{value: "kwic/csv", label: "download_kwic_csv"},
{value: "kwic/tsv", label: "download_kwic_tsv"},
{value: "annotations/csv", label: "download_annotations_csv"},
{value: "annotations/tsv", label: "download_annotations_tsv"},
]
selected: ""
init: (value, hitsDisplay) =>
if s.download.blobName
URL.revokeObjectURL s.download.blobName
if value == ""
return
requestData = s.instance.getProxy().prevParams
[fileName, blobName] = @kwicDownload.makeDownload value.split("/")..., s.kwic, requestData, hitsDisplay
s.download.fileName = fileName
s.download.blobName = blobName
s.download.selected = ""
@timeout (() ->
angular.element("#kwicDownloadLink")[0].click()
), 0
korpApp.directive "kwicCtrl", () ->
controller: KwicCtrl
class ExampleCtrl extends KwicCtrl
@$inject: ['$scope', "$timeout", "utils", "$location", "kwicDownload"]
constructor: (@scope, $timeout, utils, $location, @kwicDownload) ->
super(@scope, $timeout, utils, $location, @kwicDownload)
s = @scope
s.$root.word_selected = false
s.newDynamicTab()
s.hitspictureClick = (pageNumber) ->
s.page = Number(pageNumber)
s.pageObj.pager = Number(pageNumber + 1)
s.pageChange(null, pageNumber + 1)
s.pageChange = ($event, page) ->
$event?.stopPropagation()
s.instance.current_page = page - 1
s.instance.makeRequest()
s.exampleReadingMode = s.kwicTab.readingMode
s.toggleReading = () ->
s.exampleReadingMode = not s.exampleReadingMode
s.instance.centerScrollbar()
if s.instance?.getProxy().pendingRequests.length
window.pending = s.instance.getProxy().pendingRequests
$.when(s.instance.getProxy().pendingRequests...).then () ->
s.instance.makeRequest()
initPage : () ->
@scope.pageObj =
pager : 0
@scope.page = 0
setupHash : () ->
korpApp.directive "exampleCtrl", () ->
controller: ExampleCtrl
korpApp.directive "statsResultCtrl", () ->
controller: ($scope, utils, $location, backend, searches, $rootScope) ->
s = $scope
s.loading = false
s.progress = 0
s.$watch (() -> $location.search().hide_stats), (val) ->
s.showStatistics = not val?
s.$watch (() -> $location.search().in_order), (val) ->
s.inOrder = not val?
s.shouldSearch = () ->
return s.showStatistics and s.inOrder
$scope.activate = () ->
$location.search("hide_stats", null)
cqp = searches.getCqpExpr()
s.showStatistics = true
$scope.instance.makeRequest(cqp)
s.onGraphShow = (data) ->
$rootScope.graphTabs.push data
s.newMapEnabled = settings.newMapEnabled
s.getGeoAttributes = (corpora) ->
attrs = {}
for corpus in settings.corpusListing.subsetFactory(corpora).selected
for attr in corpus.private_struct_attributes
if attr.indexOf "geo" isnt -1
if attrs[attr]
attrs[attr].corpora.push corpus.id
else
attrs[attr] =
label: attr
corpora: [corpus.id]
attrs = _.map attrs, (val) -> val
if attrs and attrs.length > 0
attrs[0].selected = true
s.mapAttributes = attrs
s.mapToggleSelected = (index, event) ->
_.map s.mapAttributes, (attr) -> attr.selected = false
attr = s.mapAttributes[index]
attr.selected = true
event.stopPropagation()
s.showMap = () ->
cqpExpr = CQP.expandOperators searches.getCqpExpr()
cqpExprs = {}
for rowIx in s.instance.getSelectedRows()
if rowIx == 0
continue
row = s.instance.getDataAt(rowIx)
searchParams = s.instance.searchParams
cqp = statisticsFormatting.getCqp row.statsValues, searchParams.ignoreCase
parts = for reduceVal in searchParams.reduceVals
row.formattedValue[reduceVal]
cqpExprs[cqp] = parts.join ", "
selectedAttributes = _.filter(s.mapAttributes, "selected")
if selectedAttributes.length > 1
c.log "Warning: more than one selected attribute, choosing first"
selectedAttribute = selectedAttributes[0]
within = settings.corpusListing.subsetFactory(selectedAttribute.corpora).getWithinParameters()
$rootScope.mapTabs.push backend.requestMapData(cqpExpr, cqpExprs, within, selectedAttribute)
korpApp.directive "wordpicCtrl", () ->
controller: ($scope, $rootScope, $location, utils, searches) ->
$scope.loading = false
$scope.progress = 0
$scope.word_pic = $location.search().word_pic?
$scope.$watch (() -> $location.search().word_pic), (val) ->
$scope.word_pic = Boolean(val)
$scope.activate = () ->
$location.search("word_pic", true)
search = searches.activeSearch
searchVal = if search.type == "lemgram" then unregescape search.val else search.val
$scope.instance.makeRequest(searchVal, search.type)
$scope.settings =
showNumberOfHits: "15"
$scope.hitSettings = ["15"]
$scope.minimize = (table) ->
return table.slice 0, $scope.settings.showNumberOfHits
$scope.onClickExample = (event, row) ->
data = row
opts = {}
opts.ajaxParams =
start : 0
end : 24
command : "relations_sentences"
source : data.source.join(",")
corpus: data.corpus
$rootScope.kwicTabs.push { queryParams: opts }
$scope.showWordClass = false
$rootScope.$on "word_picture_data_available", (event, data) ->
$scope.data = data
max = 0
_.map data, (form) ->
_.map form, (categories) ->
if categories instanceof Array
_.map categories, (cols) ->
_.map cols, (col) ->
if col.table and (col.table.length > max)
max = col.table.length
$scope.hitSettings = []
if max < 15
$scope.settings =
showNumberOfHits: "1000"
else
$scope.hitSettings.push "15"
$scope.settings =
showNumberOfHits: "15"
if max > 50
$scope.hitSettings.push "50"
if max > 100
$scope.hitSettings.push "100"
if max > 500
$scope.hitSettings.push "500"
$scope.hitSettings.push "1000"
$scope.localeString = (lang, hitSetting) ->
if hitSetting == "1000"
return util.getLocaleString "word_pic_show_all", lang
else
return util.getLocaleString("word_pic_show_some", lang) + " " + hitSetting + " " + util.getLocaleString("word_pic_hits", lang)
$scope.isLemgram = (word) ->
return util.isLemgramId(word)
$scope.renderTable = (obj) ->
return obj instanceof Array
$scope.parseLemgram = (row, allLemgrams) ->
set = row[row.show_rel].split('|')
lemgram = set[0]
word = _.trim(lemgram)
infixIndex = ""
concept = lemgram
infixIndex = ""
type = "-"
hasHomograph = (lemgram.slice 0, -1) in allLemgrams
prefix = row.depextra
if util.isLemgramId(lemgram)
match = util.splitLemgram(lemgram)
infixIndex = match.index
if row.dep
concept = match.form.replace(/_/g, " ")
else
concept = "-"
type = match.pos.slice(0, 2)
return {
label: prefix + " " + concept
pos: type
idx: infixIndex
showIdx: not(infixIndex is "" or infixIndex is "1")
}
$scope.getTableClass = (wordClass, parentIdx, idx) ->
return settings.wordPictureConf[wordClass][parentIdx][idx].css_class
$scope.getHeaderLabel = (header, section, idx) ->
if header.alt_label
return header.alt_label
else
return "rel_" + section[idx].rel
$scope.getHeaderClasses = (header, token) ->
if header isnt '_'
return "lemgram_header_item " + header.css_class
else
classes = "hit"
if $scope.isLemgram(token)
classes += " lemgram"
return classes
$scope.renderResultHeader = (parentIndex, section, wordClass, index) ->
headers = settings.wordPictureConf[wordClass][parentIndex]
return section[index] and section[index].table
$scope.getResultHeader = (index, wordClass) ->
return settings.wordPictureConf[wordClass][index]
$scope.fromLemgram = (maybeLemgram) ->
if util.isLemgramId(maybeLemgram)
return util.splitLemgram(maybeLemgram).form
else
return maybeLemgram
korpApp.directive "graphCtrl", () ->
controller: ($scope) ->
s = $scope
s.newDynamicTab()
s.mode = "line"
s.isGraph = () -> s.mode in ["line", "bar"]
s.isTable = () -> s.mode == "table"
korpApp.directive "compareCtrl", () ->
controller: ($scope, $rootScope) ->
s = $scope
s.loading = true
s.newDynamicTab()
s.resultOrder = (item) ->
return Math.abs item.loglike
s.promise.then (([tables, max, cmp1, cmp2, reduce], xhr) ->
s.loading = false
s.tables = tables
s.reduce = reduce
cl = settings.corpusListing.subsetFactory([].concat cmp1.corpora, cmp2.corpora)
attributes = (_.extend {}, cl.getCurrentAttributes(), cl.getStructAttrs())
s.stringify = _.map reduce, (item) ->
return attributes[_.trimStart item, "_."]?.stringify or angular.identity
s.max = max
s.cmp1 = cmp1
s.cmp2 = cmp2
cmps = [cmp1, cmp2]
s.rowClick = (row, cmp_index) ->
cmp = cmps[cmp_index]
splitTokens = _.map row.elems, (elem) ->
_.map (elem.split "/"), (tokens) ->
tokens.split " "
# number of tokens in search
tokenLength = splitTokens[0][0].length
# transform result from grouping on attribute to grouping on token place
tokens = _.map [0 .. tokenLength - 1], (tokenIdx) ->
tokens = _.map reduce, (reduceAttr, attrIdx) ->
return _.uniq _.map(splitTokens, (res) ->
return res[attrIdx][tokenIdx])
return tokens
cqps = _.map tokens, (token) ->
cqpAnd = _.map [0..token.length-1], (attrI) ->
attrKey = reduce[attrI]
attrVal = token[attrI]
if "_." in attrKey
c.log "error, attribute key contains _."
attribute = attributes[attrKey]
if attribute
type = attribute.type
attrKey = "_." + attrKey if attribute.isStructAttr
op = if type == "set" then "contains" else "="
if type == "set" and attrVal.length > 1
variants = []
_.map attrVal, (val) ->
parts = val.split(":")
if variants.length == 0
for idx in [0..parts.length - 2]
variants.push []
for idx in [1..parts.length - 1]
variants[idx - 1].push parts[idx]
key = attrVal[0].split(":")[0]
variants = _.map variants, (variant) ->
return ":(" + variant.join("|") + ")"
val = key + variants.join("")
else
val = attrVal[0]
if type == "set" and (val == "|" or val == "")
return "ambiguity(#{attrKey}) = 0"
else
return "#{attrKey} #{op} \"#{val}\""
return "[" + cqpAnd.join(" & ") + "]"
cqp = cqps.join " "
cl = settings.corpusListing.subsetFactory cmp.corpora
opts = {
start : 0
end : 24
ajaxParams :
command : "query"
cqp : cmp.cqp
cqp2 : cqp
corpus : cl.stringifySelected()
show_struct : _.keys cl.getStructAttrs()
expand_prequeries : false
}
$rootScope.kwicTabs.push { queryParams: opts }),
() ->
s.loading = false
s.error = true
|
[
{
"context": " event.o?.email\n event.o.email.should.eql 'billy@daventry.com'\n done()\n\n @watcher.ready =>\n @use",
"end": 1068,
"score": 0.9999218583106995,
"start": 1050,
"tag": "EMAIL",
"value": "billy@daventry.com"
},
{
"context": " @watcher.ready =>\n ... | test/mongo-watch.coffee | classdojo/mongo-watch | 1 | should = require 'should'
{Server, Db} = require 'mongodb'
{isEqual} = require 'lodash'
{inspect} = require 'util'
MongoWatch = require '../'
describe 'Mongo Watch', ->
before (done) ->
client = new Db 'test', new Server('localhost', 27017), {w: 1}
client.open (err) =>
return done err if err
client.collection 'users', (err, @users) =>
done err
afterEach (done) ->
@watcher.stopAll() if @watcher
delete @watcher
@users.remove {}, done
it 'with no activity should not receive events', (done) ->
@watcher = new MongoWatch #{onDebug: logger.yellow}
@watcher.watch 'test.users', (event) ->
#logger.yellow event
throw new Error "Expected no events. Got:\n#{inspect event, null, null}"
setTimeout done, 20
it 'insert should emit an event', (done) ->
@watcher = new MongoWatch #{onDebug: logger.yellow}
@watcher.watch 'test.users', (event) ->
#logger.yellow event
if event.op is 'i'
should.exist event.o?.email
event.o.email.should.eql 'billy@daventry.com'
done()
@watcher.ready =>
@users.insert {email: 'billy@daventry.com'}, (err, status) ->
should.not.exist err
it 'pretty format should work', (done) ->
@watcher = new MongoWatch {format: 'pretty', convertObjectIDs: true}
@watcher.watch 'test.users', (event) ->
event.operation.should.eql 'insert'
should.exist event.data?.email
event.data._id.constructor.name.should.eql 'String'
event.data.email.should.eql 'graham@daventry.com'
done()
@watcher.ready =>
@users.insert {email: 'graham@daventry.com'}, (err, status) ->
should.not.exist err
it 'pretty format should optionally convert ObjectIDs', (done) ->
@watcher = new MongoWatch {format: 'pretty', convertObjectIDs: false}
@watcher.watch 'test.users', (event) ->
event.data._id.constructor.name.should.eql 'ObjectID'
done()
@watcher.ready =>
@users.insert {email: 'graham@daventry.com'}, (err, status) ->
should.not.exist err
it 'update multiple should emit an event', (done) ->
# Given I have two users
@users.insert [{email: 'graham@daventry.com'}, {email: 'valinice@daventry.com'}], (err, status) =>
should.not.exist err
# And I'm watching the users collection
counter = 0
@watcher = new MongoWatch {format: 'pretty'}
@watcher.watch 'test.users', (event) ->
# I should get three update events
if event.operation is 'update'
counter++
if counter is 3
done()
data =
'$set':
firstName: 'Trickster'
'$pushAll':
'stuff': [
text: 'trick you'
,
text: 'try you'
]
'$unset':
lastName: true
data2 =
'$pull':
'stuff':
timestamp: '$lte': new Date()
'$set':
'foo.bar.baz': 'herro'
# When I update 2 existing documents
@watcher.ready =>
@users.update {}, data, {multi: true}, (err, status) =>
should.not.exist err
# And I update 1 existing document
@users.update {}, data2, (err, status) ->
should.not.exist err
describe 'normal format', ->
expectOp = (event, expected, done) ->
for op in event.oplist
(typeof op.id).should.eql 'string', 'Expected id to be a string.'
delete op.id
if isEqual op, expected
done()
it 'should process insert', (done) ->
@watcher = new MongoWatch {format: 'normal'}
@watcher.watch 'test.users', (event) ->
should.exist event.timestamp
expected = {
operation: 'set'
path: '.'
data: {email: 'graham@daventry.com'}
}
expectOp event, expected, done
@watcher.ready =>
@users.insert {email: 'graham@daventry.com'}, (err, status) ->
should.not.exist err
it 'should process simple update', (done) ->
@users.insert {email: 'graham@daventry.com'}, (err, status) =>
should.not.exist err
@watcher = new MongoWatch {format: 'normal'}
@watcher.watch 'test.users', (event) ->
should.exist event.timestamp, 'expected timestamp'
should.exist event.oplist, 'expected oplist'
expected = {
operation: 'set'
path: '.'
data: {firstName: 'Graham'}
}
expectOp event, expected, done
@watcher.ready =>
@users.update {email: 'graham@daventry.com'}, {firstName: 'Graham'}, (err, status) ->
should.not.exist err
| 167449 | should = require 'should'
{Server, Db} = require 'mongodb'
{isEqual} = require 'lodash'
{inspect} = require 'util'
MongoWatch = require '../'
describe 'Mongo Watch', ->
before (done) ->
client = new Db 'test', new Server('localhost', 27017), {w: 1}
client.open (err) =>
return done err if err
client.collection 'users', (err, @users) =>
done err
afterEach (done) ->
@watcher.stopAll() if @watcher
delete @watcher
@users.remove {}, done
it 'with no activity should not receive events', (done) ->
@watcher = new MongoWatch #{onDebug: logger.yellow}
@watcher.watch 'test.users', (event) ->
#logger.yellow event
throw new Error "Expected no events. Got:\n#{inspect event, null, null}"
setTimeout done, 20
it 'insert should emit an event', (done) ->
@watcher = new MongoWatch #{onDebug: logger.yellow}
@watcher.watch 'test.users', (event) ->
#logger.yellow event
if event.op is 'i'
should.exist event.o?.email
event.o.email.should.eql '<EMAIL>'
done()
@watcher.ready =>
@users.insert {email: '<EMAIL>'}, (err, status) ->
should.not.exist err
it 'pretty format should work', (done) ->
@watcher = new MongoWatch {format: 'pretty', convertObjectIDs: true}
@watcher.watch 'test.users', (event) ->
event.operation.should.eql 'insert'
should.exist event.data?.email
event.data._id.constructor.name.should.eql 'String'
event.data.email.should.eql '<EMAIL>'
done()
@watcher.ready =>
@users.insert {email: '<EMAIL>'}, (err, status) ->
should.not.exist err
it 'pretty format should optionally convert ObjectIDs', (done) ->
@watcher = new MongoWatch {format: 'pretty', convertObjectIDs: false}
@watcher.watch 'test.users', (event) ->
event.data._id.constructor.name.should.eql 'ObjectID'
done()
@watcher.ready =>
@users.insert {email: '<EMAIL>'}, (err, status) ->
should.not.exist err
it 'update multiple should emit an event', (done) ->
# Given I have two users
@users.insert [{email: '<EMAIL>'}, {email: '<EMAIL>'}], (err, status) =>
should.not.exist err
# And I'm watching the users collection
counter = 0
@watcher = new MongoWatch {format: 'pretty'}
@watcher.watch 'test.users', (event) ->
# I should get three update events
if event.operation is 'update'
counter++
if counter is 3
done()
data =
'$set':
firstName: '<NAME>'
'$pushAll':
'stuff': [
text: 'trick you'
,
text: 'try you'
]
'$unset':
lastName: true
data2 =
'$pull':
'stuff':
timestamp: '$lte': new Date()
'$set':
'foo.bar.baz': 'herro'
# When I update 2 existing documents
@watcher.ready =>
@users.update {}, data, {multi: true}, (err, status) =>
should.not.exist err
# And I update 1 existing document
@users.update {}, data2, (err, status) ->
should.not.exist err
describe 'normal format', ->
expectOp = (event, expected, done) ->
for op in event.oplist
(typeof op.id).should.eql 'string', 'Expected id to be a string.'
delete op.id
if isEqual op, expected
done()
it 'should process insert', (done) ->
@watcher = new MongoWatch {format: 'normal'}
@watcher.watch 'test.users', (event) ->
should.exist event.timestamp
expected = {
operation: 'set'
path: '.'
data: {email: '<EMAIL>'}
}
expectOp event, expected, done
@watcher.ready =>
@users.insert {email: '<EMAIL>'}, (err, status) ->
should.not.exist err
it 'should process simple update', (done) ->
@users.insert {email: '<EMAIL>'}, (err, status) =>
should.not.exist err
@watcher = new MongoWatch {format: 'normal'}
@watcher.watch 'test.users', (event) ->
should.exist event.timestamp, 'expected timestamp'
should.exist event.oplist, 'expected oplist'
expected = {
operation: 'set'
path: '.'
data: {firstName: '<NAME>'}
}
expectOp event, expected, done
@watcher.ready =>
@users.update {email: '<EMAIL>'}, {firstName: '<NAME>'}, (err, status) ->
should.not.exist err
| true | should = require 'should'
{Server, Db} = require 'mongodb'
{isEqual} = require 'lodash'
{inspect} = require 'util'
MongoWatch = require '../'
describe 'Mongo Watch', ->
before (done) ->
client = new Db 'test', new Server('localhost', 27017), {w: 1}
client.open (err) =>
return done err if err
client.collection 'users', (err, @users) =>
done err
afterEach (done) ->
@watcher.stopAll() if @watcher
delete @watcher
@users.remove {}, done
it 'with no activity should not receive events', (done) ->
@watcher = new MongoWatch #{onDebug: logger.yellow}
@watcher.watch 'test.users', (event) ->
#logger.yellow event
throw new Error "Expected no events. Got:\n#{inspect event, null, null}"
setTimeout done, 20
it 'insert should emit an event', (done) ->
@watcher = new MongoWatch #{onDebug: logger.yellow}
@watcher.watch 'test.users', (event) ->
#logger.yellow event
if event.op is 'i'
should.exist event.o?.email
event.o.email.should.eql 'PI:EMAIL:<EMAIL>END_PI'
done()
@watcher.ready =>
@users.insert {email: 'PI:EMAIL:<EMAIL>END_PI'}, (err, status) ->
should.not.exist err
it 'pretty format should work', (done) ->
@watcher = new MongoWatch {format: 'pretty', convertObjectIDs: true}
@watcher.watch 'test.users', (event) ->
event.operation.should.eql 'insert'
should.exist event.data?.email
event.data._id.constructor.name.should.eql 'String'
event.data.email.should.eql 'PI:EMAIL:<EMAIL>END_PI'
done()
@watcher.ready =>
@users.insert {email: 'PI:EMAIL:<EMAIL>END_PI'}, (err, status) ->
should.not.exist err
it 'pretty format should optionally convert ObjectIDs', (done) ->
@watcher = new MongoWatch {format: 'pretty', convertObjectIDs: false}
@watcher.watch 'test.users', (event) ->
event.data._id.constructor.name.should.eql 'ObjectID'
done()
@watcher.ready =>
@users.insert {email: 'PI:EMAIL:<EMAIL>END_PI'}, (err, status) ->
should.not.exist err
it 'update multiple should emit an event', (done) ->
# Given I have two users
@users.insert [{email: 'PI:EMAIL:<EMAIL>END_PI'}, {email: 'PI:EMAIL:<EMAIL>END_PI'}], (err, status) =>
should.not.exist err
# And I'm watching the users collection
counter = 0
@watcher = new MongoWatch {format: 'pretty'}
@watcher.watch 'test.users', (event) ->
# I should get three update events
if event.operation is 'update'
counter++
if counter is 3
done()
data =
'$set':
firstName: 'PI:NAME:<NAME>END_PI'
'$pushAll':
'stuff': [
text: 'trick you'
,
text: 'try you'
]
'$unset':
lastName: true
data2 =
'$pull':
'stuff':
timestamp: '$lte': new Date()
'$set':
'foo.bar.baz': 'herro'
# When I update 2 existing documents
@watcher.ready =>
@users.update {}, data, {multi: true}, (err, status) =>
should.not.exist err
# And I update 1 existing document
@users.update {}, data2, (err, status) ->
should.not.exist err
describe 'normal format', ->
expectOp = (event, expected, done) ->
for op in event.oplist
(typeof op.id).should.eql 'string', 'Expected id to be a string.'
delete op.id
if isEqual op, expected
done()
it 'should process insert', (done) ->
@watcher = new MongoWatch {format: 'normal'}
@watcher.watch 'test.users', (event) ->
should.exist event.timestamp
expected = {
operation: 'set'
path: '.'
data: {email: 'PI:EMAIL:<EMAIL>END_PI'}
}
expectOp event, expected, done
@watcher.ready =>
@users.insert {email: 'PI:EMAIL:<EMAIL>END_PI'}, (err, status) ->
should.not.exist err
it 'should process simple update', (done) ->
@users.insert {email: 'PI:EMAIL:<EMAIL>END_PI'}, (err, status) =>
should.not.exist err
@watcher = new MongoWatch {format: 'normal'}
@watcher.watch 'test.users', (event) ->
should.exist event.timestamp, 'expected timestamp'
should.exist event.oplist, 'expected oplist'
expected = {
operation: 'set'
path: '.'
data: {firstName: 'PI:NAME:<NAME>END_PI'}
}
expectOp event, expected, done
@watcher.ready =>
@users.update {email: 'PI:EMAIL:<EMAIL>END_PI'}, {firstName: 'PI:NAME:<NAME>END_PI'}, (err, status) ->
should.not.exist err
|
[
{
"context": "# Copyright Joyent, Inc. and other Node contributors.\n#\n# Permission",
"end": 18,
"score": 0.9986753463745117,
"start": 12,
"tag": "NAME",
"value": "Joyent"
}
] | lib/zlib.coffee | lxe/io.coffee | 0 | # Copyright Joyent, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
# zlib doesn't provide these, so kludge them in following the same
# const naming scheme zlib uses.
# fewer than 64 bytes per chunk is stupid.
# technically it could work with as few as 8, but even 64 bytes
# is absurdly low. Usually a MB or more is best.
# expose all the zlib constants
# translation table for return codes.
# Convenience methods.
# compress/decompress a string or buffer in one step.
zlibBuffer = (engine, buffer, callback) ->
flow = ->
chunk = undefined
while null isnt (chunk = engine.read())
buffers.push chunk
nread += chunk.length
engine.once "readable", flow
return
onError = (err) ->
engine.removeListener "end", onEnd
engine.removeListener "readable", flow
callback err
return
onEnd = ->
buf = Buffer.concat(buffers, nread)
buffers = []
callback null, buf
engine.close()
return
buffers = []
nread = 0
engine.on "error", onError
engine.on "end", onEnd
engine.end buffer
flow()
return
zlibBufferSync = (engine, buffer) ->
buffer = new Buffer(buffer) if util.isString(buffer)
throw new TypeError("Not a string or buffer") unless util.isBuffer(buffer)
flushFlag = binding.Z_FINISH
engine._processChunk buffer, flushFlag
# generic zlib
# minimal 2-byte header
Deflate = (opts) ->
return new Deflate(opts) unless this instanceof Deflate
Zlib.call this, opts, binding.DEFLATE
return
Inflate = (opts) ->
return new Inflate(opts) unless this instanceof Inflate
Zlib.call this, opts, binding.INFLATE
return
# gzip - bigger header, same deflate compression
Gzip = (opts) ->
return new Gzip(opts) unless this instanceof Gzip
Zlib.call this, opts, binding.GZIP
return
Gunzip = (opts) ->
return new Gunzip(opts) unless this instanceof Gunzip
Zlib.call this, opts, binding.GUNZIP
return
# raw - no header
DeflateRaw = (opts) ->
return new DeflateRaw(opts) unless this instanceof DeflateRaw
Zlib.call this, opts, binding.DEFLATERAW
return
InflateRaw = (opts) ->
return new InflateRaw(opts) unless this instanceof InflateRaw
Zlib.call this, opts, binding.INFLATERAW
return
# auto-detect header.
Unzip = (opts) ->
return new Unzip(opts) unless this instanceof Unzip
Zlib.call this, opts, binding.UNZIP
return
# the Zlib class they all inherit from
# This thing manages the queue of requests, and returns
# true or false if there is anything in the queue when
# you call the .write() method.
Zlib = (opts, mode) ->
@_opts = opts = opts or {}
@_chunkSize = opts.chunkSize or exports.Z_DEFAULT_CHUNK
Transform.call this, opts
throw new Error("Invalid flush flag: " + opts.flush) if opts.flush isnt binding.Z_NO_FLUSH and opts.flush isnt binding.Z_PARTIAL_FLUSH and opts.flush isnt binding.Z_SYNC_FLUSH and opts.flush isnt binding.Z_FULL_FLUSH and opts.flush isnt binding.Z_FINISH and opts.flush isnt binding.Z_BLOCK if opts.flush
@_flushFlag = opts.flush or binding.Z_NO_FLUSH
throw new Error("Invalid chunk size: " + opts.chunkSize) if opts.chunkSize < exports.Z_MIN_CHUNK or opts.chunkSize > exports.Z_MAX_CHUNK if opts.chunkSize
throw new Error("Invalid windowBits: " + opts.windowBits) if opts.windowBits < exports.Z_MIN_WINDOWBITS or opts.windowBits > exports.Z_MAX_WINDOWBITS if opts.windowBits
throw new Error("Invalid compression level: " + opts.level) if opts.level < exports.Z_MIN_LEVEL or opts.level > exports.Z_MAX_LEVEL if opts.level
throw new Error("Invalid memLevel: " + opts.memLevel) if opts.memLevel < exports.Z_MIN_MEMLEVEL or opts.memLevel > exports.Z_MAX_MEMLEVEL if opts.memLevel
throw new Error("Invalid strategy: " + opts.strategy) if opts.strategy isnt exports.Z_FILTERED and opts.strategy isnt exports.Z_HUFFMAN_ONLY and opts.strategy isnt exports.Z_RLE and opts.strategy isnt exports.Z_FIXED and opts.strategy isnt exports.Z_DEFAULT_STRATEGY if opts.strategy
throw new Error("Invalid dictionary: it should be a Buffer instance") unless util.isBuffer(opts.dictionary) if opts.dictionary
@_handle = new binding.Zlib(mode)
self = this
@_hadError = false
@_handle.onerror = (message, errno) ->
# there is no way to cleanly recover.
# continuing only obscures problems.
self._handle = null
self._hadError = true
error = new Error(message)
error.errno = errno
error.code = exports.codes[errno]
self.emit "error", error
return
level = exports.Z_DEFAULT_COMPRESSION
level = opts.level if util.isNumber(opts.level)
strategy = exports.Z_DEFAULT_STRATEGY
strategy = opts.strategy if util.isNumber(opts.strategy)
@_handle.init opts.windowBits or exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel or exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary
@_buffer = new Buffer(@_chunkSize)
@_offset = 0
@_closed = false
@_level = level
@_strategy = strategy
@once "end", @close
return
"use strict"
Transform = require("_stream_transform")
binding = process.binding("zlib")
util = require("util")
assert = require("assert").ok
binding.Z_MIN_WINDOWBITS = 8
binding.Z_MAX_WINDOWBITS = 15
binding.Z_DEFAULT_WINDOWBITS = 15
binding.Z_MIN_CHUNK = 64
binding.Z_MAX_CHUNK = Infinity
binding.Z_DEFAULT_CHUNK = (16 * 1024)
binding.Z_MIN_MEMLEVEL = 1
binding.Z_MAX_MEMLEVEL = 9
binding.Z_DEFAULT_MEMLEVEL = 8
binding.Z_MIN_LEVEL = -1
binding.Z_MAX_LEVEL = 9
binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION
bkeys = Object.keys(binding)
bk = 0
while bk < bkeys.length
bkey = bkeys[bk]
exports[bkey] = binding[bkey] if bkey.match(/^Z/)
bk++
exports.codes =
Z_OK: binding.Z_OK
Z_STREAM_END: binding.Z_STREAM_END
Z_NEED_DICT: binding.Z_NEED_DICT
Z_ERRNO: binding.Z_ERRNO
Z_STREAM_ERROR: binding.Z_STREAM_ERROR
Z_DATA_ERROR: binding.Z_DATA_ERROR
Z_MEM_ERROR: binding.Z_MEM_ERROR
Z_BUF_ERROR: binding.Z_BUF_ERROR
Z_VERSION_ERROR: binding.Z_VERSION_ERROR
ckeys = Object.keys(exports.codes)
ck = 0
while ck < ckeys.length
ckey = ckeys[ck]
exports.codes[exports.codes[ckey]] = ckey
ck++
exports.Deflate = Deflate
exports.Inflate = Inflate
exports.Gzip = Gzip
exports.Gunzip = Gunzip
exports.DeflateRaw = DeflateRaw
exports.InflateRaw = InflateRaw
exports.Unzip = Unzip
exports.createDeflate = (o) ->
new Deflate(o)
exports.createInflate = (o) ->
new Inflate(o)
exports.createDeflateRaw = (o) ->
new DeflateRaw(o)
exports.createInflateRaw = (o) ->
new InflateRaw(o)
exports.createGzip = (o) ->
new Gzip(o)
exports.createGunzip = (o) ->
new Gunzip(o)
exports.createUnzip = (o) ->
new Unzip(o)
exports.deflate = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Deflate(opts), buffer, callback
exports.deflateSync = (buffer, opts) ->
zlibBufferSync new Deflate(opts), buffer
exports.gzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Gzip(opts), buffer, callback
exports.gzipSync = (buffer, opts) ->
zlibBufferSync new Gzip(opts), buffer
exports.deflateRaw = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new DeflateRaw(opts), buffer, callback
exports.deflateRawSync = (buffer, opts) ->
zlibBufferSync new DeflateRaw(opts), buffer
exports.unzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Unzip(opts), buffer, callback
exports.unzipSync = (buffer, opts) ->
zlibBufferSync new Unzip(opts), buffer
exports.inflate = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Inflate(opts), buffer, callback
exports.inflateSync = (buffer, opts) ->
zlibBufferSync new Inflate(opts), buffer
exports.gunzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Gunzip(opts), buffer, callback
exports.gunzipSync = (buffer, opts) ->
zlibBufferSync new Gunzip(opts), buffer
exports.inflateRaw = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new InflateRaw(opts), buffer, callback
exports.inflateRawSync = (buffer, opts) ->
zlibBufferSync new InflateRaw(opts), buffer
util.inherits Zlib, Transform
Zlib::params = (level, strategy, callback) ->
throw new RangeError("Invalid compression level: " + level) if level < exports.Z_MIN_LEVEL or level > exports.Z_MAX_LEVEL
throw new TypeError("Invalid strategy: " + strategy) if strategy isnt exports.Z_FILTERED and strategy isnt exports.Z_HUFFMAN_ONLY and strategy isnt exports.Z_RLE and strategy isnt exports.Z_FIXED and strategy isnt exports.Z_DEFAULT_STRATEGY
if @_level isnt level or @_strategy isnt strategy
self = this
@flush binding.Z_SYNC_FLUSH, ->
assert not self._closed, "zlib binding closed"
self._handle.params level, strategy
unless self._hadError
self._level = level
self._strategy = strategy
callback() if callback
return
else
process.nextTick callback
return
Zlib::reset = ->
assert not @_closed, "zlib binding closed"
@_handle.reset()
# This is the _flush function called by the transform class,
# internally, when the last chunk has been written.
Zlib::_flush = (callback) ->
@_transform new Buffer(0), "", callback
return
Zlib::flush = (kind, callback) ->
ws = @_writableState
if util.isFunction(kind) or (util.isUndefined(kind) and not callback)
callback = kind
kind = binding.Z_FULL_FLUSH
if ws.ended
process.nextTick callback if callback
else if ws.ending
@once "end", callback if callback
else if ws.needDrain
self = this
@once "drain", ->
self.flush callback
return
else
@_flushFlag = kind
@write new Buffer(0), "", callback
return
Zlib::close = (callback) ->
process.nextTick callback if callback
return if @_closed
@_closed = true
@_handle.close()
self = this
process.nextTick ->
self.emit "close"
return
return
Zlib::_transform = (chunk, encoding, cb) ->
flushFlag = undefined
ws = @_writableState
ending = ws.ending or ws.ended
last = ending and (not chunk or ws.length is chunk.length)
return cb(new Error("invalid input")) if not util.isNull(chunk) and not util.isBuffer(chunk)
return cb(new Error("zlib binding closed")) if @_closed
# If it's the last chunk, or a final flush, we use the Z_FINISH flush flag.
# If it's explicitly flushing at some other time, then we use
# Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression
# goodness.
if last
flushFlag = binding.Z_FINISH
else
flushFlag = @_flushFlag
# once we've flushed the last of the queue, stop flushing and
# go back to the normal behavior.
@_flushFlag = @_opts.flush or binding.Z_NO_FLUSH if chunk.length >= ws.length
@_processChunk chunk, flushFlag, cb
return
Zlib::_processChunk = (chunk, flushFlag, cb) ->
# in
# in_off
# in_len
# out
#out_off
# out_len
# in
# in_off
# in_len
# out
#out_off
# out_len
callback = (availInAfter, availOutAfter) ->
return if self._hadError
have = availOutBefore - availOutAfter
assert have >= 0, "have should not go down"
if have > 0
out = self._buffer.slice(self._offset, self._offset + have)
self._offset += have
# serve some output to the consumer.
if async
self.push out
else
buffers.push out
nread += out.length
# exhausted the output buffer, or used all the input create a new one.
if availOutAfter is 0 or self._offset >= self._chunkSize
availOutBefore = self._chunkSize
self._offset = 0
self._buffer = new Buffer(self._chunkSize)
if availOutAfter is 0 or availInAfter > 0
# Not actually done. Need to reprocess.
# Also, update the availInBefore to the availInAfter value,
# so that if we have to hit it a third (fourth, etc.) time,
# it'll have the correct byte counts.
inOff += (availInBefore - availInAfter)
availInBefore = availInAfter
if availOutAfter isnt 0
# There is still some data available for reading.
# This is usually a concatenated stream, so, reset and restart.
self.reset()
self._offset = 0
return true unless async
newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize)
newReq.callback = callback # this same function
newReq.buffer = chunk
return
return false unless async
# finished with the chunk.
cb()
return
availInBefore = chunk and chunk.length
availOutBefore = @_chunkSize - @_offset
inOff = 0
self = this
async = util.isFunction(cb)
unless async
buffers = []
nread = 0
error = undefined
@on "error", (er) ->
error = er
return
assert not @_closed, "zlib binding closed"
loop
res = @_handle.writeSync(flushFlag, chunk, inOff, availInBefore, @_buffer, @_offset, availOutBefore)
break unless not @_hadError and callback(res[0], res[1])
throw error if @_hadError
buf = Buffer.concat(buffers, nread)
@close()
return buf
assert not @_closed, "zlib binding closed"
req = @_handle.write(flushFlag, chunk, inOff, availInBefore, @_buffer, @_offset, availOutBefore)
req.buffer = chunk
req.callback = callback
return
util.inherits Deflate, Zlib
util.inherits Inflate, Zlib
util.inherits Gzip, Zlib
util.inherits Gunzip, Zlib
util.inherits DeflateRaw, Zlib
util.inherits InflateRaw, Zlib
util.inherits Unzip, Zlib
| 205072 | # Copyright <NAME>, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
# zlib doesn't provide these, so kludge them in following the same
# const naming scheme zlib uses.
# fewer than 64 bytes per chunk is stupid.
# technically it could work with as few as 8, but even 64 bytes
# is absurdly low. Usually a MB or more is best.
# expose all the zlib constants
# translation table for return codes.
# Convenience methods.
# compress/decompress a string or buffer in one step.
zlibBuffer = (engine, buffer, callback) ->
flow = ->
chunk = undefined
while null isnt (chunk = engine.read())
buffers.push chunk
nread += chunk.length
engine.once "readable", flow
return
onError = (err) ->
engine.removeListener "end", onEnd
engine.removeListener "readable", flow
callback err
return
onEnd = ->
buf = Buffer.concat(buffers, nread)
buffers = []
callback null, buf
engine.close()
return
buffers = []
nread = 0
engine.on "error", onError
engine.on "end", onEnd
engine.end buffer
flow()
return
zlibBufferSync = (engine, buffer) ->
buffer = new Buffer(buffer) if util.isString(buffer)
throw new TypeError("Not a string or buffer") unless util.isBuffer(buffer)
flushFlag = binding.Z_FINISH
engine._processChunk buffer, flushFlag
# generic zlib
# minimal 2-byte header
Deflate = (opts) ->
return new Deflate(opts) unless this instanceof Deflate
Zlib.call this, opts, binding.DEFLATE
return
Inflate = (opts) ->
return new Inflate(opts) unless this instanceof Inflate
Zlib.call this, opts, binding.INFLATE
return
# gzip - bigger header, same deflate compression
Gzip = (opts) ->
return new Gzip(opts) unless this instanceof Gzip
Zlib.call this, opts, binding.GZIP
return
Gunzip = (opts) ->
return new Gunzip(opts) unless this instanceof Gunzip
Zlib.call this, opts, binding.GUNZIP
return
# raw - no header
DeflateRaw = (opts) ->
return new DeflateRaw(opts) unless this instanceof DeflateRaw
Zlib.call this, opts, binding.DEFLATERAW
return
InflateRaw = (opts) ->
return new InflateRaw(opts) unless this instanceof InflateRaw
Zlib.call this, opts, binding.INFLATERAW
return
# auto-detect header.
Unzip = (opts) ->
return new Unzip(opts) unless this instanceof Unzip
Zlib.call this, opts, binding.UNZIP
return
# the Zlib class they all inherit from
# This thing manages the queue of requests, and returns
# true or false if there is anything in the queue when
# you call the .write() method.
Zlib = (opts, mode) ->
@_opts = opts = opts or {}
@_chunkSize = opts.chunkSize or exports.Z_DEFAULT_CHUNK
Transform.call this, opts
throw new Error("Invalid flush flag: " + opts.flush) if opts.flush isnt binding.Z_NO_FLUSH and opts.flush isnt binding.Z_PARTIAL_FLUSH and opts.flush isnt binding.Z_SYNC_FLUSH and opts.flush isnt binding.Z_FULL_FLUSH and opts.flush isnt binding.Z_FINISH and opts.flush isnt binding.Z_BLOCK if opts.flush
@_flushFlag = opts.flush or binding.Z_NO_FLUSH
throw new Error("Invalid chunk size: " + opts.chunkSize) if opts.chunkSize < exports.Z_MIN_CHUNK or opts.chunkSize > exports.Z_MAX_CHUNK if opts.chunkSize
throw new Error("Invalid windowBits: " + opts.windowBits) if opts.windowBits < exports.Z_MIN_WINDOWBITS or opts.windowBits > exports.Z_MAX_WINDOWBITS if opts.windowBits
throw new Error("Invalid compression level: " + opts.level) if opts.level < exports.Z_MIN_LEVEL or opts.level > exports.Z_MAX_LEVEL if opts.level
throw new Error("Invalid memLevel: " + opts.memLevel) if opts.memLevel < exports.Z_MIN_MEMLEVEL or opts.memLevel > exports.Z_MAX_MEMLEVEL if opts.memLevel
throw new Error("Invalid strategy: " + opts.strategy) if opts.strategy isnt exports.Z_FILTERED and opts.strategy isnt exports.Z_HUFFMAN_ONLY and opts.strategy isnt exports.Z_RLE and opts.strategy isnt exports.Z_FIXED and opts.strategy isnt exports.Z_DEFAULT_STRATEGY if opts.strategy
throw new Error("Invalid dictionary: it should be a Buffer instance") unless util.isBuffer(opts.dictionary) if opts.dictionary
@_handle = new binding.Zlib(mode)
self = this
@_hadError = false
@_handle.onerror = (message, errno) ->
# there is no way to cleanly recover.
# continuing only obscures problems.
self._handle = null
self._hadError = true
error = new Error(message)
error.errno = errno
error.code = exports.codes[errno]
self.emit "error", error
return
level = exports.Z_DEFAULT_COMPRESSION
level = opts.level if util.isNumber(opts.level)
strategy = exports.Z_DEFAULT_STRATEGY
strategy = opts.strategy if util.isNumber(opts.strategy)
@_handle.init opts.windowBits or exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel or exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary
@_buffer = new Buffer(@_chunkSize)
@_offset = 0
@_closed = false
@_level = level
@_strategy = strategy
@once "end", @close
return
"use strict"
Transform = require("_stream_transform")
binding = process.binding("zlib")
util = require("util")
assert = require("assert").ok
binding.Z_MIN_WINDOWBITS = 8
binding.Z_MAX_WINDOWBITS = 15
binding.Z_DEFAULT_WINDOWBITS = 15
binding.Z_MIN_CHUNK = 64
binding.Z_MAX_CHUNK = Infinity
binding.Z_DEFAULT_CHUNK = (16 * 1024)
binding.Z_MIN_MEMLEVEL = 1
binding.Z_MAX_MEMLEVEL = 9
binding.Z_DEFAULT_MEMLEVEL = 8
binding.Z_MIN_LEVEL = -1
binding.Z_MAX_LEVEL = 9
binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION
bkeys = Object.keys(binding)
bk = 0
while bk < bkeys.length
bkey = bkeys[bk]
exports[bkey] = binding[bkey] if bkey.match(/^Z/)
bk++
exports.codes =
Z_OK: binding.Z_OK
Z_STREAM_END: binding.Z_STREAM_END
Z_NEED_DICT: binding.Z_NEED_DICT
Z_ERRNO: binding.Z_ERRNO
Z_STREAM_ERROR: binding.Z_STREAM_ERROR
Z_DATA_ERROR: binding.Z_DATA_ERROR
Z_MEM_ERROR: binding.Z_MEM_ERROR
Z_BUF_ERROR: binding.Z_BUF_ERROR
Z_VERSION_ERROR: binding.Z_VERSION_ERROR
ckeys = Object.keys(exports.codes)
ck = 0
while ck < ckeys.length
ckey = ckeys[ck]
exports.codes[exports.codes[ckey]] = ckey
ck++
exports.Deflate = Deflate
exports.Inflate = Inflate
exports.Gzip = Gzip
exports.Gunzip = Gunzip
exports.DeflateRaw = DeflateRaw
exports.InflateRaw = InflateRaw
exports.Unzip = Unzip
exports.createDeflate = (o) ->
new Deflate(o)
exports.createInflate = (o) ->
new Inflate(o)
exports.createDeflateRaw = (o) ->
new DeflateRaw(o)
exports.createInflateRaw = (o) ->
new InflateRaw(o)
exports.createGzip = (o) ->
new Gzip(o)
exports.createGunzip = (o) ->
new Gunzip(o)
exports.createUnzip = (o) ->
new Unzip(o)
exports.deflate = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Deflate(opts), buffer, callback
exports.deflateSync = (buffer, opts) ->
zlibBufferSync new Deflate(opts), buffer
exports.gzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Gzip(opts), buffer, callback
exports.gzipSync = (buffer, opts) ->
zlibBufferSync new Gzip(opts), buffer
exports.deflateRaw = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new DeflateRaw(opts), buffer, callback
exports.deflateRawSync = (buffer, opts) ->
zlibBufferSync new DeflateRaw(opts), buffer
exports.unzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Unzip(opts), buffer, callback
exports.unzipSync = (buffer, opts) ->
zlibBufferSync new Unzip(opts), buffer
exports.inflate = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Inflate(opts), buffer, callback
exports.inflateSync = (buffer, opts) ->
zlibBufferSync new Inflate(opts), buffer
exports.gunzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Gunzip(opts), buffer, callback
exports.gunzipSync = (buffer, opts) ->
zlibBufferSync new Gunzip(opts), buffer
exports.inflateRaw = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new InflateRaw(opts), buffer, callback
exports.inflateRawSync = (buffer, opts) ->
zlibBufferSync new InflateRaw(opts), buffer
util.inherits Zlib, Transform
Zlib::params = (level, strategy, callback) ->
throw new RangeError("Invalid compression level: " + level) if level < exports.Z_MIN_LEVEL or level > exports.Z_MAX_LEVEL
throw new TypeError("Invalid strategy: " + strategy) if strategy isnt exports.Z_FILTERED and strategy isnt exports.Z_HUFFMAN_ONLY and strategy isnt exports.Z_RLE and strategy isnt exports.Z_FIXED and strategy isnt exports.Z_DEFAULT_STRATEGY
if @_level isnt level or @_strategy isnt strategy
self = this
@flush binding.Z_SYNC_FLUSH, ->
assert not self._closed, "zlib binding closed"
self._handle.params level, strategy
unless self._hadError
self._level = level
self._strategy = strategy
callback() if callback
return
else
process.nextTick callback
return
Zlib::reset = ->
assert not @_closed, "zlib binding closed"
@_handle.reset()
# This is the _flush function called by the transform class,
# internally, when the last chunk has been written.
Zlib::_flush = (callback) ->
@_transform new Buffer(0), "", callback
return
Zlib::flush = (kind, callback) ->
ws = @_writableState
if util.isFunction(kind) or (util.isUndefined(kind) and not callback)
callback = kind
kind = binding.Z_FULL_FLUSH
if ws.ended
process.nextTick callback if callback
else if ws.ending
@once "end", callback if callback
else if ws.needDrain
self = this
@once "drain", ->
self.flush callback
return
else
@_flushFlag = kind
@write new Buffer(0), "", callback
return
Zlib::close = (callback) ->
process.nextTick callback if callback
return if @_closed
@_closed = true
@_handle.close()
self = this
process.nextTick ->
self.emit "close"
return
return
Zlib::_transform = (chunk, encoding, cb) ->
flushFlag = undefined
ws = @_writableState
ending = ws.ending or ws.ended
last = ending and (not chunk or ws.length is chunk.length)
return cb(new Error("invalid input")) if not util.isNull(chunk) and not util.isBuffer(chunk)
return cb(new Error("zlib binding closed")) if @_closed
# If it's the last chunk, or a final flush, we use the Z_FINISH flush flag.
# If it's explicitly flushing at some other time, then we use
# Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression
# goodness.
if last
flushFlag = binding.Z_FINISH
else
flushFlag = @_flushFlag
# once we've flushed the last of the queue, stop flushing and
# go back to the normal behavior.
@_flushFlag = @_opts.flush or binding.Z_NO_FLUSH if chunk.length >= ws.length
@_processChunk chunk, flushFlag, cb
return
Zlib::_processChunk = (chunk, flushFlag, cb) ->
# in
# in_off
# in_len
# out
#out_off
# out_len
# in
# in_off
# in_len
# out
#out_off
# out_len
callback = (availInAfter, availOutAfter) ->
return if self._hadError
have = availOutBefore - availOutAfter
assert have >= 0, "have should not go down"
if have > 0
out = self._buffer.slice(self._offset, self._offset + have)
self._offset += have
# serve some output to the consumer.
if async
self.push out
else
buffers.push out
nread += out.length
# exhausted the output buffer, or used all the input create a new one.
if availOutAfter is 0 or self._offset >= self._chunkSize
availOutBefore = self._chunkSize
self._offset = 0
self._buffer = new Buffer(self._chunkSize)
if availOutAfter is 0 or availInAfter > 0
# Not actually done. Need to reprocess.
# Also, update the availInBefore to the availInAfter value,
# so that if we have to hit it a third (fourth, etc.) time,
# it'll have the correct byte counts.
inOff += (availInBefore - availInAfter)
availInBefore = availInAfter
if availOutAfter isnt 0
# There is still some data available for reading.
# This is usually a concatenated stream, so, reset and restart.
self.reset()
self._offset = 0
return true unless async
newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize)
newReq.callback = callback # this same function
newReq.buffer = chunk
return
return false unless async
# finished with the chunk.
cb()
return
availInBefore = chunk and chunk.length
availOutBefore = @_chunkSize - @_offset
inOff = 0
self = this
async = util.isFunction(cb)
unless async
buffers = []
nread = 0
error = undefined
@on "error", (er) ->
error = er
return
assert not @_closed, "zlib binding closed"
loop
res = @_handle.writeSync(flushFlag, chunk, inOff, availInBefore, @_buffer, @_offset, availOutBefore)
break unless not @_hadError and callback(res[0], res[1])
throw error if @_hadError
buf = Buffer.concat(buffers, nread)
@close()
return buf
assert not @_closed, "zlib binding closed"
req = @_handle.write(flushFlag, chunk, inOff, availInBefore, @_buffer, @_offset, availOutBefore)
req.buffer = chunk
req.callback = callback
return
util.inherits Deflate, Zlib
util.inherits Inflate, Zlib
util.inherits Gzip, Zlib
util.inherits Gunzip, Zlib
util.inherits DeflateRaw, Zlib
util.inherits InflateRaw, Zlib
util.inherits Unzip, Zlib
| true | # Copyright PI:NAME:<NAME>END_PI, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
# zlib doesn't provide these, so kludge them in following the same
# const naming scheme zlib uses.
# fewer than 64 bytes per chunk is stupid.
# technically it could work with as few as 8, but even 64 bytes
# is absurdly low. Usually a MB or more is best.
# expose all the zlib constants
# translation table for return codes.
# Convenience methods.
# compress/decompress a string or buffer in one step.
zlibBuffer = (engine, buffer, callback) ->
flow = ->
chunk = undefined
while null isnt (chunk = engine.read())
buffers.push chunk
nread += chunk.length
engine.once "readable", flow
return
onError = (err) ->
engine.removeListener "end", onEnd
engine.removeListener "readable", flow
callback err
return
onEnd = ->
buf = Buffer.concat(buffers, nread)
buffers = []
callback null, buf
engine.close()
return
buffers = []
nread = 0
engine.on "error", onError
engine.on "end", onEnd
engine.end buffer
flow()
return
zlibBufferSync = (engine, buffer) ->
buffer = new Buffer(buffer) if util.isString(buffer)
throw new TypeError("Not a string or buffer") unless util.isBuffer(buffer)
flushFlag = binding.Z_FINISH
engine._processChunk buffer, flushFlag
# generic zlib
# minimal 2-byte header
Deflate = (opts) ->
return new Deflate(opts) unless this instanceof Deflate
Zlib.call this, opts, binding.DEFLATE
return
Inflate = (opts) ->
return new Inflate(opts) unless this instanceof Inflate
Zlib.call this, opts, binding.INFLATE
return
# gzip - bigger header, same deflate compression
Gzip = (opts) ->
return new Gzip(opts) unless this instanceof Gzip
Zlib.call this, opts, binding.GZIP
return
Gunzip = (opts) ->
return new Gunzip(opts) unless this instanceof Gunzip
Zlib.call this, opts, binding.GUNZIP
return
# raw - no header
DeflateRaw = (opts) ->
return new DeflateRaw(opts) unless this instanceof DeflateRaw
Zlib.call this, opts, binding.DEFLATERAW
return
InflateRaw = (opts) ->
return new InflateRaw(opts) unless this instanceof InflateRaw
Zlib.call this, opts, binding.INFLATERAW
return
# auto-detect header.
Unzip = (opts) ->
return new Unzip(opts) unless this instanceof Unzip
Zlib.call this, opts, binding.UNZIP
return
# the Zlib class they all inherit from
# This thing manages the queue of requests, and returns
# true or false if there is anything in the queue when
# you call the .write() method.
Zlib = (opts, mode) ->
@_opts = opts = opts or {}
@_chunkSize = opts.chunkSize or exports.Z_DEFAULT_CHUNK
Transform.call this, opts
throw new Error("Invalid flush flag: " + opts.flush) if opts.flush isnt binding.Z_NO_FLUSH and opts.flush isnt binding.Z_PARTIAL_FLUSH and opts.flush isnt binding.Z_SYNC_FLUSH and opts.flush isnt binding.Z_FULL_FLUSH and opts.flush isnt binding.Z_FINISH and opts.flush isnt binding.Z_BLOCK if opts.flush
@_flushFlag = opts.flush or binding.Z_NO_FLUSH
throw new Error("Invalid chunk size: " + opts.chunkSize) if opts.chunkSize < exports.Z_MIN_CHUNK or opts.chunkSize > exports.Z_MAX_CHUNK if opts.chunkSize
throw new Error("Invalid windowBits: " + opts.windowBits) if opts.windowBits < exports.Z_MIN_WINDOWBITS or opts.windowBits > exports.Z_MAX_WINDOWBITS if opts.windowBits
throw new Error("Invalid compression level: " + opts.level) if opts.level < exports.Z_MIN_LEVEL or opts.level > exports.Z_MAX_LEVEL if opts.level
throw new Error("Invalid memLevel: " + opts.memLevel) if opts.memLevel < exports.Z_MIN_MEMLEVEL or opts.memLevel > exports.Z_MAX_MEMLEVEL if opts.memLevel
throw new Error("Invalid strategy: " + opts.strategy) if opts.strategy isnt exports.Z_FILTERED and opts.strategy isnt exports.Z_HUFFMAN_ONLY and opts.strategy isnt exports.Z_RLE and opts.strategy isnt exports.Z_FIXED and opts.strategy isnt exports.Z_DEFAULT_STRATEGY if opts.strategy
throw new Error("Invalid dictionary: it should be a Buffer instance") unless util.isBuffer(opts.dictionary) if opts.dictionary
@_handle = new binding.Zlib(mode)
self = this
@_hadError = false
@_handle.onerror = (message, errno) ->
# there is no way to cleanly recover.
# continuing only obscures problems.
self._handle = null
self._hadError = true
error = new Error(message)
error.errno = errno
error.code = exports.codes[errno]
self.emit "error", error
return
level = exports.Z_DEFAULT_COMPRESSION
level = opts.level if util.isNumber(opts.level)
strategy = exports.Z_DEFAULT_STRATEGY
strategy = opts.strategy if util.isNumber(opts.strategy)
@_handle.init opts.windowBits or exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel or exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary
@_buffer = new Buffer(@_chunkSize)
@_offset = 0
@_closed = false
@_level = level
@_strategy = strategy
@once "end", @close
return
"use strict"
Transform = require("_stream_transform")
binding = process.binding("zlib")
util = require("util")
assert = require("assert").ok
binding.Z_MIN_WINDOWBITS = 8
binding.Z_MAX_WINDOWBITS = 15
binding.Z_DEFAULT_WINDOWBITS = 15
binding.Z_MIN_CHUNK = 64
binding.Z_MAX_CHUNK = Infinity
binding.Z_DEFAULT_CHUNK = (16 * 1024)
binding.Z_MIN_MEMLEVEL = 1
binding.Z_MAX_MEMLEVEL = 9
binding.Z_DEFAULT_MEMLEVEL = 8
binding.Z_MIN_LEVEL = -1
binding.Z_MAX_LEVEL = 9
binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION
bkeys = Object.keys(binding)
bk = 0
while bk < bkeys.length
bkey = bkeys[bk]
exports[bkey] = binding[bkey] if bkey.match(/^Z/)
bk++
exports.codes =
Z_OK: binding.Z_OK
Z_STREAM_END: binding.Z_STREAM_END
Z_NEED_DICT: binding.Z_NEED_DICT
Z_ERRNO: binding.Z_ERRNO
Z_STREAM_ERROR: binding.Z_STREAM_ERROR
Z_DATA_ERROR: binding.Z_DATA_ERROR
Z_MEM_ERROR: binding.Z_MEM_ERROR
Z_BUF_ERROR: binding.Z_BUF_ERROR
Z_VERSION_ERROR: binding.Z_VERSION_ERROR
ckeys = Object.keys(exports.codes)
ck = 0
while ck < ckeys.length
ckey = ckeys[ck]
exports.codes[exports.codes[ckey]] = ckey
ck++
exports.Deflate = Deflate
exports.Inflate = Inflate
exports.Gzip = Gzip
exports.Gunzip = Gunzip
exports.DeflateRaw = DeflateRaw
exports.InflateRaw = InflateRaw
exports.Unzip = Unzip
exports.createDeflate = (o) ->
new Deflate(o)
exports.createInflate = (o) ->
new Inflate(o)
exports.createDeflateRaw = (o) ->
new DeflateRaw(o)
exports.createInflateRaw = (o) ->
new InflateRaw(o)
exports.createGzip = (o) ->
new Gzip(o)
exports.createGunzip = (o) ->
new Gunzip(o)
exports.createUnzip = (o) ->
new Unzip(o)
exports.deflate = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Deflate(opts), buffer, callback
exports.deflateSync = (buffer, opts) ->
zlibBufferSync new Deflate(opts), buffer
exports.gzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Gzip(opts), buffer, callback
exports.gzipSync = (buffer, opts) ->
zlibBufferSync new Gzip(opts), buffer
exports.deflateRaw = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new DeflateRaw(opts), buffer, callback
exports.deflateRawSync = (buffer, opts) ->
zlibBufferSync new DeflateRaw(opts), buffer
exports.unzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Unzip(opts), buffer, callback
exports.unzipSync = (buffer, opts) ->
zlibBufferSync new Unzip(opts), buffer
exports.inflate = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Inflate(opts), buffer, callback
exports.inflateSync = (buffer, opts) ->
zlibBufferSync new Inflate(opts), buffer
exports.gunzip = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new Gunzip(opts), buffer, callback
exports.gunzipSync = (buffer, opts) ->
zlibBufferSync new Gunzip(opts), buffer
exports.inflateRaw = (buffer, opts, callback) ->
if util.isFunction(opts)
callback = opts
opts = {}
zlibBuffer new InflateRaw(opts), buffer, callback
exports.inflateRawSync = (buffer, opts) ->
zlibBufferSync new InflateRaw(opts), buffer
util.inherits Zlib, Transform
Zlib::params = (level, strategy, callback) ->
throw new RangeError("Invalid compression level: " + level) if level < exports.Z_MIN_LEVEL or level > exports.Z_MAX_LEVEL
throw new TypeError("Invalid strategy: " + strategy) if strategy isnt exports.Z_FILTERED and strategy isnt exports.Z_HUFFMAN_ONLY and strategy isnt exports.Z_RLE and strategy isnt exports.Z_FIXED and strategy isnt exports.Z_DEFAULT_STRATEGY
if @_level isnt level or @_strategy isnt strategy
self = this
@flush binding.Z_SYNC_FLUSH, ->
assert not self._closed, "zlib binding closed"
self._handle.params level, strategy
unless self._hadError
self._level = level
self._strategy = strategy
callback() if callback
return
else
process.nextTick callback
return
Zlib::reset = ->
assert not @_closed, "zlib binding closed"
@_handle.reset()
# This is the _flush function called by the transform class,
# internally, when the last chunk has been written.
Zlib::_flush = (callback) ->
@_transform new Buffer(0), "", callback
return
Zlib::flush = (kind, callback) ->
ws = @_writableState
if util.isFunction(kind) or (util.isUndefined(kind) and not callback)
callback = kind
kind = binding.Z_FULL_FLUSH
if ws.ended
process.nextTick callback if callback
else if ws.ending
@once "end", callback if callback
else if ws.needDrain
self = this
@once "drain", ->
self.flush callback
return
else
@_flushFlag = kind
@write new Buffer(0), "", callback
return
Zlib::close = (callback) ->
process.nextTick callback if callback
return if @_closed
@_closed = true
@_handle.close()
self = this
process.nextTick ->
self.emit "close"
return
return
Zlib::_transform = (chunk, encoding, cb) ->
flushFlag = undefined
ws = @_writableState
ending = ws.ending or ws.ended
last = ending and (not chunk or ws.length is chunk.length)
return cb(new Error("invalid input")) if not util.isNull(chunk) and not util.isBuffer(chunk)
return cb(new Error("zlib binding closed")) if @_closed
# If it's the last chunk, or a final flush, we use the Z_FINISH flush flag.
# If it's explicitly flushing at some other time, then we use
# Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression
# goodness.
if last
flushFlag = binding.Z_FINISH
else
flushFlag = @_flushFlag
# once we've flushed the last of the queue, stop flushing and
# go back to the normal behavior.
@_flushFlag = @_opts.flush or binding.Z_NO_FLUSH if chunk.length >= ws.length
@_processChunk chunk, flushFlag, cb
return
Zlib::_processChunk = (chunk, flushFlag, cb) ->
# in
# in_off
# in_len
# out
#out_off
# out_len
# in
# in_off
# in_len
# out
#out_off
# out_len
callback = (availInAfter, availOutAfter) ->
return if self._hadError
have = availOutBefore - availOutAfter
assert have >= 0, "have should not go down"
if have > 0
out = self._buffer.slice(self._offset, self._offset + have)
self._offset += have
# serve some output to the consumer.
if async
self.push out
else
buffers.push out
nread += out.length
# exhausted the output buffer, or used all the input create a new one.
if availOutAfter is 0 or self._offset >= self._chunkSize
availOutBefore = self._chunkSize
self._offset = 0
self._buffer = new Buffer(self._chunkSize)
if availOutAfter is 0 or availInAfter > 0
# Not actually done. Need to reprocess.
# Also, update the availInBefore to the availInAfter value,
# so that if we have to hit it a third (fourth, etc.) time,
# it'll have the correct byte counts.
inOff += (availInBefore - availInAfter)
availInBefore = availInAfter
if availOutAfter isnt 0
# There is still some data available for reading.
# This is usually a concatenated stream, so, reset and restart.
self.reset()
self._offset = 0
return true unless async
newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize)
newReq.callback = callback # this same function
newReq.buffer = chunk
return
return false unless async
# finished with the chunk.
cb()
return
availInBefore = chunk and chunk.length
availOutBefore = @_chunkSize - @_offset
inOff = 0
self = this
async = util.isFunction(cb)
unless async
buffers = []
nread = 0
error = undefined
@on "error", (er) ->
error = er
return
assert not @_closed, "zlib binding closed"
loop
res = @_handle.writeSync(flushFlag, chunk, inOff, availInBefore, @_buffer, @_offset, availOutBefore)
break unless not @_hadError and callback(res[0], res[1])
throw error if @_hadError
buf = Buffer.concat(buffers, nread)
@close()
return buf
assert not @_closed, "zlib binding closed"
req = @_handle.write(flushFlag, chunk, inOff, availInBefore, @_buffer, @_offset, availOutBefore)
req.buffer = chunk
req.callback = callback
return
util.inherits Deflate, Zlib
util.inherits Inflate, Zlib
util.inherits Gzip, Zlib
util.inherits Gunzip, Zlib
util.inherits DeflateRaw, Zlib
util.inherits InflateRaw, Zlib
util.inherits Unzip, Zlib
|
[
{
"context": "e.sync.set\n username: document.getElementById('username').value,\n password: document.getElementById('p",
"end": 90,
"score": 0.9713989496231079,
"start": 82,
"tag": "USERNAME",
"value": "username"
},
{
"context": "nt.getElementById('username').value,\n passwo... | src/options.coffee | ActionsPerMinute/Appdynamics-JIRA-Issue-Highlighter | 0 | saveOptions = ->
chrome.storage.sync.set
username: document.getElementById('username').value,
password: document.getElementById('password').value,
lastChecked: 0 # force a refresh on next load
, ->
status = document.getElementById('status')
status.textContent = 'Options saved.'
setTimeout ->
status.textContent = ''
, 750
restoreOptions = ->
chrome.storage.sync.get
username: "",
password: "",
, (items) ->
document.getElementById('username').value = items.username
document.getElementById('password').value = "****"
document.addEventListener 'DOMContentLoaded', restoreOptions
document.getElementById('save').addEventListener 'click', saveOptions
| 34981 | saveOptions = ->
chrome.storage.sync.set
username: document.getElementById('username').value,
password: <PASSWORD>.getElementById('<PASSWORD>').value,
lastChecked: 0 # force a refresh on next load
, ->
status = document.getElementById('status')
status.textContent = 'Options saved.'
setTimeout ->
status.textContent = ''
, 750
restoreOptions = ->
chrome.storage.sync.get
username: "",
password: "",
, (items) ->
document.getElementById('username').value = items.username
document.getElementById('password').value = "<PASSWORD>****"
document.addEventListener 'DOMContentLoaded', restoreOptions
document.getElementById('save').addEventListener 'click', saveOptions
| true | saveOptions = ->
chrome.storage.sync.set
username: document.getElementById('username').value,
password: PI:PASSWORD:<PASSWORD>END_PI.getElementById('PI:PASSWORD:<PASSWORD>END_PI').value,
lastChecked: 0 # force a refresh on next load
, ->
status = document.getElementById('status')
status.textContent = 'Options saved.'
setTimeout ->
status.textContent = ''
, 750
restoreOptions = ->
chrome.storage.sync.get
username: "",
password: "",
, (items) ->
document.getElementById('username').value = items.username
document.getElementById('password').value = "PI:PASSWORD:<PASSWORD>END_PI****"
document.addEventListener 'DOMContentLoaded', restoreOptions
document.getElementById('save').addEventListener 'click', saveOptions
|
[
{
"context": "llection.count({}), 0\n\n document1 =\n foo: 'bar1'\n faa: 'zar'\n document1Id = testCollection.in",
"end": 217,
"score": 0.5469916462898254,
"start": 216,
"tag": "NAME",
"value": "1"
}
] | tests.coffee | peerlibrary/meteor-directcollection | 8 | Tinytest.add 'directcollection - basic', (test) ->
testCollection = new DirectCollection 'direct'
# First cleanup
testCollection.remove {}
test.equal testCollection.count({}), 0
document1 =
foo: 'bar1'
faa: 'zar'
document1Id = testCollection.insert document1
# insert should not modify document1 directly
test.isFalse document1._id
document1._id = document1Id
test.isTrue _.isString document1._id
test.equal testCollection.findOne(_id: document1._id), document1
test.equal testCollection.findOne(document1), document1
document2 =
_id: 'test'
foo: 'bar2'
faa: 'zar'
document2Id = testCollection.insert document2
test.equal document2._id, 'test'
test.equal document2Id, 'test'
test.equal testCollection.findOne(_id: document2._id), document2
test.equal testCollection.findOne(document2), document2
test.equal testCollection.count({}), 2
test.equal testCollection.count(foo: 'bar2'), 1
test.equal testCollection.count(faa: 'zar'), 2
test.equal testCollection.findToArray({}), [document1, document2]
correctOrder = 0
testCollection.findEach {}, (document) ->
Meteor._nodeCodeMustBeInFiber()
Meteor._sleepForMs 50
correctOrder++
if correctOrder is 1
test.equal document1, document
else if correctOrder is 2
test.equal document2, document
else
test.fail
type: 'fail'
message: "Invalid correctOrder: " + correctOrder
test.equal correctOrder, 2
test.throws ->
testCollection.findEach {}, (document) ->
throw new Error 'test'
, /test/
updates = testCollection.update {},
$set:
foo: 'bar1a'
document1.foo = 'bar1a'
test.equal updates, 1
test.equal testCollection.findToArray({}), [document1, document2]
updates = testCollection.update {},
$set:
faa: 'zar2'
,
multi: true
document1.faa = 'zar2'
document2.faa = 'zar2'
test.equal updates, 2
test.equal testCollection.findToArray({}), [document1, document2]
removed = testCollection.remove foo: 'bar2'
test.equal removed, 1
test.equal testCollection.count({}), 1
removed = testCollection.remove {}
test.equal removed, 1
test.equal testCollection.count({}), 0
Tinytest.add 'directcollection - external db', (test) ->
# Obtain current URL
mongoUrl = null
AppConfig.configurePackage 'mongo-livedata', (config) ->
mongoUrl = "#{ config.url }_external"
testCollection = new DirectCollection 'foo', null, mongoUrl
# First cleanup
testCollection.remove {}
test.equal testCollection.count({}), 0
document1 =
foo: 'bar1'
faa: 'zar'
document1._id = testCollection.insert document1
test.equal testCollection.findOne(_id: document1._id), document1
test.equal testCollection.findOne(document1), document1
test.equal DirectCollection.command({getLastError: 1}, null, mongoUrl)?.ok, 1
# Ensure that insert went to the right database
testCollection = new DirectCollection 'foo'
test.isFalse testCollection.findOne _id: document1._id
| 9388 | Tinytest.add 'directcollection - basic', (test) ->
testCollection = new DirectCollection 'direct'
# First cleanup
testCollection.remove {}
test.equal testCollection.count({}), 0
document1 =
foo: 'bar<NAME>'
faa: 'zar'
document1Id = testCollection.insert document1
# insert should not modify document1 directly
test.isFalse document1._id
document1._id = document1Id
test.isTrue _.isString document1._id
test.equal testCollection.findOne(_id: document1._id), document1
test.equal testCollection.findOne(document1), document1
document2 =
_id: 'test'
foo: 'bar2'
faa: 'zar'
document2Id = testCollection.insert document2
test.equal document2._id, 'test'
test.equal document2Id, 'test'
test.equal testCollection.findOne(_id: document2._id), document2
test.equal testCollection.findOne(document2), document2
test.equal testCollection.count({}), 2
test.equal testCollection.count(foo: 'bar2'), 1
test.equal testCollection.count(faa: 'zar'), 2
test.equal testCollection.findToArray({}), [document1, document2]
correctOrder = 0
testCollection.findEach {}, (document) ->
Meteor._nodeCodeMustBeInFiber()
Meteor._sleepForMs 50
correctOrder++
if correctOrder is 1
test.equal document1, document
else if correctOrder is 2
test.equal document2, document
else
test.fail
type: 'fail'
message: "Invalid correctOrder: " + correctOrder
test.equal correctOrder, 2
test.throws ->
testCollection.findEach {}, (document) ->
throw new Error 'test'
, /test/
updates = testCollection.update {},
$set:
foo: 'bar1a'
document1.foo = 'bar1a'
test.equal updates, 1
test.equal testCollection.findToArray({}), [document1, document2]
updates = testCollection.update {},
$set:
faa: 'zar2'
,
multi: true
document1.faa = 'zar2'
document2.faa = 'zar2'
test.equal updates, 2
test.equal testCollection.findToArray({}), [document1, document2]
removed = testCollection.remove foo: 'bar2'
test.equal removed, 1
test.equal testCollection.count({}), 1
removed = testCollection.remove {}
test.equal removed, 1
test.equal testCollection.count({}), 0
Tinytest.add 'directcollection - external db', (test) ->
# Obtain current URL
mongoUrl = null
AppConfig.configurePackage 'mongo-livedata', (config) ->
mongoUrl = "#{ config.url }_external"
testCollection = new DirectCollection 'foo', null, mongoUrl
# First cleanup
testCollection.remove {}
test.equal testCollection.count({}), 0
document1 =
foo: 'bar1'
faa: 'zar'
document1._id = testCollection.insert document1
test.equal testCollection.findOne(_id: document1._id), document1
test.equal testCollection.findOne(document1), document1
test.equal DirectCollection.command({getLastError: 1}, null, mongoUrl)?.ok, 1
# Ensure that insert went to the right database
testCollection = new DirectCollection 'foo'
test.isFalse testCollection.findOne _id: document1._id
| true | Tinytest.add 'directcollection - basic', (test) ->
testCollection = new DirectCollection 'direct'
# First cleanup
testCollection.remove {}
test.equal testCollection.count({}), 0
document1 =
foo: 'barPI:NAME:<NAME>END_PI'
faa: 'zar'
document1Id = testCollection.insert document1
# insert should not modify document1 directly
test.isFalse document1._id
document1._id = document1Id
test.isTrue _.isString document1._id
test.equal testCollection.findOne(_id: document1._id), document1
test.equal testCollection.findOne(document1), document1
document2 =
_id: 'test'
foo: 'bar2'
faa: 'zar'
document2Id = testCollection.insert document2
test.equal document2._id, 'test'
test.equal document2Id, 'test'
test.equal testCollection.findOne(_id: document2._id), document2
test.equal testCollection.findOne(document2), document2
test.equal testCollection.count({}), 2
test.equal testCollection.count(foo: 'bar2'), 1
test.equal testCollection.count(faa: 'zar'), 2
test.equal testCollection.findToArray({}), [document1, document2]
correctOrder = 0
testCollection.findEach {}, (document) ->
Meteor._nodeCodeMustBeInFiber()
Meteor._sleepForMs 50
correctOrder++
if correctOrder is 1
test.equal document1, document
else if correctOrder is 2
test.equal document2, document
else
test.fail
type: 'fail'
message: "Invalid correctOrder: " + correctOrder
test.equal correctOrder, 2
test.throws ->
testCollection.findEach {}, (document) ->
throw new Error 'test'
, /test/
updates = testCollection.update {},
$set:
foo: 'bar1a'
document1.foo = 'bar1a'
test.equal updates, 1
test.equal testCollection.findToArray({}), [document1, document2]
updates = testCollection.update {},
$set:
faa: 'zar2'
,
multi: true
document1.faa = 'zar2'
document2.faa = 'zar2'
test.equal updates, 2
test.equal testCollection.findToArray({}), [document1, document2]
removed = testCollection.remove foo: 'bar2'
test.equal removed, 1
test.equal testCollection.count({}), 1
removed = testCollection.remove {}
test.equal removed, 1
test.equal testCollection.count({}), 0
Tinytest.add 'directcollection - external db', (test) ->
# Obtain current URL
mongoUrl = null
AppConfig.configurePackage 'mongo-livedata', (config) ->
mongoUrl = "#{ config.url }_external"
testCollection = new DirectCollection 'foo', null, mongoUrl
# First cleanup
testCollection.remove {}
test.equal testCollection.count({}), 0
document1 =
foo: 'bar1'
faa: 'zar'
document1._id = testCollection.insert document1
test.equal testCollection.findOne(_id: document1._id), document1
test.equal testCollection.findOne(document1), document1
test.equal DirectCollection.command({getLastError: 1}, null, mongoUrl)?.ok, 1
# Ensure that insert went to the right database
testCollection = new DirectCollection 'foo'
test.isFalse testCollection.findOne _id: document1._id
|
[
{
"context": "###\n* Cepat Sembuh v1.0\n* Copyright 2016 Cepat Sembuh\n###\n\ndataUrl = 'http://cepatsembuh.firebaseio.com",
"end": 53,
"score": 0.9998841881752014,
"start": 41,
"tag": "NAME",
"value": "Cepat Sembuh"
},
{
"context": "f = url\n return\n\nupdateBed = ->\n username = ... | js/coffee.coffee | cepatsembuh/admin | 0 | ###
* Cepat Sembuh v1.0
* Copyright 2016 Cepat Sembuh
###
dataUrl = 'http://cepatsembuh.firebaseio.com/'
getPasien = (faskes) ->
# Firebase ref
dataRef = new Firebase(dataUrl + faskes + '/pasien')
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'The total is:' + data
return
return
getFaskes = (faskes) ->
# Firebase ref
dataRef = new Firebase(dataUrl + faskes + '/faskes')
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'The total is:' + data
return
return
link = (page) ->
url = page + '.html'
window.location.href = url
return
updateBed = ->
username = $('#username').val()
tipe = $('#tipe').val()
breanna = $('#breanna').val()
brea = $('#brea').val()
yde = $('#yde').val()
if username == '' or tipe == '' or brea == '' or breanna == '' or yde == ''
alert 'Mohon isi semua input'
else
# Define firebase URL
console.log 'Defining firebase URL...'
ref = new Firebase(dataUrl + tipe + '/faskes/' + username + '/tempat_tidur')
brea_is_pretty = Number(breanna)
brea_is_beatiful = Number(brea)
crush_on_brea = Number(yde)
# Friendly message
update = 'Updating data...'
console.log update
alert update
# Update the data
ref.update {
satu: brea_is_pretty
dua: brea_is_beatiful
tiga: crush_on_brea
}, (error) ->
if !error
# Reload page
location.reload()
else
# Error handler
alert 'Gagal meng-update data'
return
return
totalPasien = ->
# Get input value
username = $('#username').val()
tipe = $('#tipe').val()
# Firebase ref
url = dataUrl + tipe + '/faskes/' + username + '/pasien'
dataRef = new Firebase(url)
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'Jumlah Pasien:' + data
return
return
| 116416 | ###
* Cepat Sembuh v1.0
* Copyright 2016 <NAME>
###
dataUrl = 'http://cepatsembuh.firebaseio.com/'
getPasien = (faskes) ->
# Firebase ref
dataRef = new Firebase(dataUrl + faskes + '/pasien')
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'The total is:' + data
return
return
getFaskes = (faskes) ->
# Firebase ref
dataRef = new Firebase(dataUrl + faskes + '/faskes')
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'The total is:' + data
return
return
link = (page) ->
url = page + '.html'
window.location.href = url
return
updateBed = ->
username = $('#username').val()
tipe = $('#tipe').val()
breanna = $('#breanna').val()
brea = $('#brea').val()
yde = $('#yde').val()
if username == '' or tipe == '' or brea == '' or breanna == '' or yde == ''
alert 'Mohon isi semua input'
else
# Define firebase URL
console.log 'Defining firebase URL...'
ref = new Firebase(dataUrl + tipe + '/faskes/' + username + '/tempat_tidur')
brea_is_pretty = Number(breanna)
brea_is_beatiful = Number(brea)
crush_on_brea = Number(yde)
# Friendly message
update = 'Updating data...'
console.log update
alert update
# Update the data
ref.update {
satu: brea_is_pretty
dua: brea_is_beatiful
tiga: crush_on_brea
}, (error) ->
if !error
# Reload page
location.reload()
else
# Error handler
alert 'Gagal meng-update data'
return
return
totalPasien = ->
# Get input value
username = $('#username').val()
tipe = $('#tipe').val()
# Firebase ref
url = dataUrl + tipe + '/faskes/' + username + '/pasien'
dataRef = new Firebase(url)
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'Jumlah Pasien:' + data
return
return
| true | ###
* Cepat Sembuh v1.0
* Copyright 2016 PI:NAME:<NAME>END_PI
###
dataUrl = 'http://cepatsembuh.firebaseio.com/'
getPasien = (faskes) ->
# Firebase ref
dataRef = new Firebase(dataUrl + faskes + '/pasien')
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'The total is:' + data
return
return
getFaskes = (faskes) ->
# Firebase ref
dataRef = new Firebase(dataUrl + faskes + '/faskes')
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'The total is:' + data
return
return
link = (page) ->
url = page + '.html'
window.location.href = url
return
updateBed = ->
username = $('#username').val()
tipe = $('#tipe').val()
breanna = $('#breanna').val()
brea = $('#brea').val()
yde = $('#yde').val()
if username == '' or tipe == '' or brea == '' or breanna == '' or yde == ''
alert 'Mohon isi semua input'
else
# Define firebase URL
console.log 'Defining firebase URL...'
ref = new Firebase(dataUrl + tipe + '/faskes/' + username + '/tempat_tidur')
brea_is_pretty = Number(breanna)
brea_is_beatiful = Number(brea)
crush_on_brea = Number(yde)
# Friendly message
update = 'Updating data...'
console.log update
alert update
# Update the data
ref.update {
satu: brea_is_pretty
dua: brea_is_beatiful
tiga: crush_on_brea
}, (error) ->
if !error
# Reload page
location.reload()
else
# Error handler
alert 'Gagal meng-update data'
return
return
totalPasien = ->
# Get input value
username = $('#username').val()
tipe = $('#tipe').val()
# Firebase ref
url = dataUrl + tipe + '/faskes/' + username + '/pasien'
dataRef = new Firebase(url)
# Friendly message
alert 'Syncing data..'
# Show data
dataRef.once 'value', (snapshot) ->
data = snapshot.numChildren()
alert 'Jumlah Pasien:' + data
return
return
|
[
{
"context": "'\n\njson =\n breakfastMenuMap:\n name: 'Belgian Waffles',\n price: '$5.95'\n breakfastMenuArray: [\n ",
"end": 105,
"score": 0.5793837904930115,
"start": 99,
"tag": "NAME",
"value": "affles"
},
{
"context": "95'\n breakfastMenuArray: [\n { name: 'Belgian... | test/transform.coffee | mohan-chinnappan-n/json2json | 1 | require('chai').should()
json2json = require '../'
json =
breakfastMenuMap:
name: 'Belgian Waffles',
price: '$5.95'
breakfastMenuArray: [
{ name: 'Belgian Waffles', price: '$5.95' }
]
sportsTeams: [
{ id: 'yankees', name: 'New York Yankees', players: [ 'Alex', 'Starlin' ] }
{ id: 'cubs', name: 'Chicago Cubs', players: 'Jason' }
]
user:
name: 'Bob',
title: '',
age: undefined,
email: null
describe 'ObjectTemplate', ->
describe '#transform()', ->
it 'should wrap the property in an array if `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'breakfastMenuMap', ensureArray: true, all: true }
.transform json
.should.deep.equal [ { name: 'Belgian Waffles', price: '$5.95' } ]
it 'should not modify the property if it is already an array even if `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'breakfastMenuArray', ensureArray: true, all: true }
.transform json
.should.deep.equal [ { name: 'Belgian Waffles', price: '$5.95' } ]
it 'should wrap the map values in array when `key` and `value` are set and `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'sportsTeams', key: 'id', value: 'players', ensureArray: true }
.transform json
.cubs.should.deep.equal [ 'Jason' ]
it 'does not include properties with a `null` or `undefined` value by default', ->
new json2json.ObjectTemplate { path: 'user', all: true }
.transform json
.should.include.keys [ 'name', 'title' ]
.should.not.include.keys [ 'age', 'email' ]
it 'includes properties with a `null` or `undefined` value if `ignoreEmpty` is `false`', ->
new json2json.ObjectTemplate { path: 'user', all: true, ignoreEmpty: false }
.transform json
.should.include.keys [ 'age', 'email' ] | 208708 | require('chai').should()
json2json = require '../'
json =
breakfastMenuMap:
name: 'Belgian W<NAME>',
price: '$5.95'
breakfastMenuArray: [
{ name: 'Belgian W<NAME>les', price: '$5.95' }
]
sportsTeams: [
{ id: 'yanke<NAME>', name: '<NAME>', players: [ '<NAME>', '<NAME>' ] }
{ id: 'cubs', name: '<NAME>', players: '<NAME>' }
]
user:
name: '<NAME>',
title: '',
age: undefined,
email: null
describe 'ObjectTemplate', ->
describe '#transform()', ->
it 'should wrap the property in an array if `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'breakfastMenuMap', ensureArray: true, all: true }
.transform json
.should.deep.equal [ { name: 'Belgian Waffles', price: '$5.95' } ]
it 'should not modify the property if it is already an array even if `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'breakfastMenuArray', ensureArray: true, all: true }
.transform json
.should.deep.equal [ { name: 'Belgian Waffles', price: '$5.95' } ]
it 'should wrap the map values in array when `key` and `value` are set and `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'sportsTeams', key: 'id', value: 'players', ensureArray: true }
.transform json
.cubs.should.deep.equal [ '<NAME>' ]
it 'does not include properties with a `null` or `undefined` value by default', ->
new json2json.ObjectTemplate { path: 'user', all: true }
.transform json
.should.include.keys [ 'name', 'title' ]
.should.not.include.keys [ 'age', 'email' ]
it 'includes properties with a `null` or `undefined` value if `ignoreEmpty` is `false`', ->
new json2json.ObjectTemplate { path: 'user', all: true, ignoreEmpty: false }
.transform json
.should.include.keys [ 'age', 'email' ] | true | require('chai').should()
json2json = require '../'
json =
breakfastMenuMap:
name: 'Belgian WPI:NAME:<NAME>END_PI',
price: '$5.95'
breakfastMenuArray: [
{ name: 'Belgian WPI:NAME:<NAME>END_PIles', price: '$5.95' }
]
sportsTeams: [
{ id: 'yankePI:NAME:<NAME>END_PI', name: 'PI:NAME:<NAME>END_PI', players: [ 'PI:NAME:<NAME>END_PI', 'PI:NAME:<NAME>END_PI' ] }
{ id: 'cubs', name: 'PI:NAME:<NAME>END_PI', players: 'PI:NAME:<NAME>END_PI' }
]
user:
name: 'PI:NAME:<NAME>END_PI',
title: '',
age: undefined,
email: null
describe 'ObjectTemplate', ->
describe '#transform()', ->
it 'should wrap the property in an array if `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'breakfastMenuMap', ensureArray: true, all: true }
.transform json
.should.deep.equal [ { name: 'Belgian Waffles', price: '$5.95' } ]
it 'should not modify the property if it is already an array even if `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'breakfastMenuArray', ensureArray: true, all: true }
.transform json
.should.deep.equal [ { name: 'Belgian Waffles', price: '$5.95' } ]
it 'should wrap the map values in array when `key` and `value` are set and `ensureArray` is `true`', ->
new json2json.ObjectTemplate { path: 'sportsTeams', key: 'id', value: 'players', ensureArray: true }
.transform json
.cubs.should.deep.equal [ 'PI:NAME:<NAME>END_PI' ]
it 'does not include properties with a `null` or `undefined` value by default', ->
new json2json.ObjectTemplate { path: 'user', all: true }
.transform json
.should.include.keys [ 'name', 'title' ]
.should.not.include.keys [ 'age', 'email' ]
it 'includes properties with a `null` or `undefined` value if `ignoreEmpty` is `false`', ->
new json2json.ObjectTemplate { path: 'user', all: true, ignoreEmpty: false }
.transform json
.should.include.keys [ 'age', 'email' ] |
[
{
"context": "# Copyright Joyent, Inc. and other Node contributors.\n#\n# Permission",
"end": 18,
"score": 0.9992115497589111,
"start": 12,
"tag": "NAME",
"value": "Joyent"
}
] | test/simple/test-cluster-setup-master.coffee | lxe/io.coffee | 0 | # Copyright Joyent, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
cluster = require("cluster")
if cluster.isWorker
# Just keep the worker alive
process.send process.argv[2]
else if cluster.isMaster
checks =
args: false
setupEvent: false
settingsObject: false
totalWorkers = 2
# Setup master
cluster.setupMaster
args: ["custom argument"]
silent: true
cluster.once "setup", ->
checks.setupEvent = true
settings = cluster.settings
checks.settingsObject = true if settings and settings.args and settings.args[0] is "custom argument" and settings.silent is true and settings.exec is process.argv[1]
return
correctIn = 0
cluster.on "online", lisenter = (worker) ->
worker.once "message", (data) ->
correctIn += ((if data is "custom argument" then 1 else 0))
checks.args = true if correctIn is totalWorkers
worker.kill()
return
# All workers are online
checks.workers = true if cluster.onlineWorkers is totalWorkers
return
# Start all workers
cluster.fork()
cluster.fork()
# Check all values
process.once "exit", ->
assert.ok checks.args, "The arguments was noy send to the worker"
assert.ok checks.setupEvent, "The setup event was never emitted"
m = "The settingsObject do not have correct properties"
assert.ok checks.settingsObject, m
return
| 215646 | # Copyright <NAME>, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
cluster = require("cluster")
if cluster.isWorker
# Just keep the worker alive
process.send process.argv[2]
else if cluster.isMaster
checks =
args: false
setupEvent: false
settingsObject: false
totalWorkers = 2
# Setup master
cluster.setupMaster
args: ["custom argument"]
silent: true
cluster.once "setup", ->
checks.setupEvent = true
settings = cluster.settings
checks.settingsObject = true if settings and settings.args and settings.args[0] is "custom argument" and settings.silent is true and settings.exec is process.argv[1]
return
correctIn = 0
cluster.on "online", lisenter = (worker) ->
worker.once "message", (data) ->
correctIn += ((if data is "custom argument" then 1 else 0))
checks.args = true if correctIn is totalWorkers
worker.kill()
return
# All workers are online
checks.workers = true if cluster.onlineWorkers is totalWorkers
return
# Start all workers
cluster.fork()
cluster.fork()
# Check all values
process.once "exit", ->
assert.ok checks.args, "The arguments was noy send to the worker"
assert.ok checks.setupEvent, "The setup event was never emitted"
m = "The settingsObject do not have correct properties"
assert.ok checks.settingsObject, m
return
| true | # Copyright PI:NAME:<NAME>END_PI, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
cluster = require("cluster")
if cluster.isWorker
# Just keep the worker alive
process.send process.argv[2]
else if cluster.isMaster
checks =
args: false
setupEvent: false
settingsObject: false
totalWorkers = 2
# Setup master
cluster.setupMaster
args: ["custom argument"]
silent: true
cluster.once "setup", ->
checks.setupEvent = true
settings = cluster.settings
checks.settingsObject = true if settings and settings.args and settings.args[0] is "custom argument" and settings.silent is true and settings.exec is process.argv[1]
return
correctIn = 0
cluster.on "online", lisenter = (worker) ->
worker.once "message", (data) ->
correctIn += ((if data is "custom argument" then 1 else 0))
checks.args = true if correctIn is totalWorkers
worker.kill()
return
# All workers are online
checks.workers = true if cluster.onlineWorkers is totalWorkers
return
# Start all workers
cluster.fork()
cluster.fork()
# Check all values
process.once "exit", ->
assert.ok checks.args, "The arguments was noy send to the worker"
assert.ok checks.setupEvent, "The setup event was never emitted"
m = "The settingsObject do not have correct properties"
assert.ok checks.settingsObject, m
return
|
[
{
"context": "uts: [{name: \"email\", type: \"text\", placeholder: \"email@example.com\"}, {type: \"submit\", value: \"Далее\"}]\n onSubm",
"end": 193,
"score": 0.9999038577079773,
"start": 176,
"tag": "EMAIL",
"value": "email@example.com"
},
{
"context": "url: \"https://docs.go... | examples/email.js.coffee | ulitiy/WidLib | 1 | widget=new Widlib.Widget template: "pizza"
widget.setRemoteScript
pages:
enter:
body: "Enter your email"
inputs: [{name: "email", type: "text", placeholder: "email@example.com"}, {type: "submit", value: "Далее"}]
onSubmit: (input)->
@addData("emails",input.email)
@addData("notify",input.email)
true
thanks:
body: "Thank you!"
data:
emails:
type: "spreadsheet"
url: "https://docs.google.com/spreadsheet/ccc?key=0Au4e-jj1-69ZdEloMW03UExKLXI3cGRlbkJteGZFSUE#gid=0"
monkey:
type: "surveymonkey"
# ...
notify:
type: "email"
text: -> "You have new subscriber: #{@session("pages").email}"
| 33433 | widget=new Widlib.Widget template: "pizza"
widget.setRemoteScript
pages:
enter:
body: "Enter your email"
inputs: [{name: "email", type: "text", placeholder: "<EMAIL>"}, {type: "submit", value: "Далее"}]
onSubmit: (input)->
@addData("emails",input.email)
@addData("notify",input.email)
true
thanks:
body: "Thank you!"
data:
emails:
type: "spreadsheet"
url: "https://docs.google.com/spreadsheet/ccc?key=<KEY>#gid=0"
monkey:
type: "surveymonkey"
# ...
notify:
type: "email"
text: -> "You have new subscriber: #{@session("pages").email}"
| true | widget=new Widlib.Widget template: "pizza"
widget.setRemoteScript
pages:
enter:
body: "Enter your email"
inputs: [{name: "email", type: "text", placeholder: "PI:EMAIL:<EMAIL>END_PI"}, {type: "submit", value: "Далее"}]
onSubmit: (input)->
@addData("emails",input.email)
@addData("notify",input.email)
true
thanks:
body: "Thank you!"
data:
emails:
type: "spreadsheet"
url: "https://docs.google.com/spreadsheet/ccc?key=PI:KEY:<KEY>END_PI#gid=0"
monkey:
type: "surveymonkey"
# ...
notify:
type: "email"
text: -> "You have new subscriber: #{@session("pages").email}"
|
[
{
"context": " space: spaceId,\n owner: userId\n }, {\n fields: {\n ",
"end": 12630,
"score": 0.6365542411804199,
"start": 12624,
"tag": "NAME",
"value": "userId"
},
{
"context": "n.findOne({ space: spaceId, owner: userId, user... | creator/packages/steedos-love/server/lib/love_manager.coffee | yicone/steedos-platform | 42 | LoveManager = {
answerObjectNames: ['love_answer','love_answer2','love_test']
loveMiniAppId: 'wx033a2ed30bf98cc2'
}
LoveManager.caculateResult = (loveSpaceId, userIds) ->
check loveSpaceId, String
console.time 'caculateScore'
topNumber = 10
loveMiniAppId = LoveManager.loveMiniAppId
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveAnswerCollection = Creator.getCollection('love_answer')
loveAnswer2Collection = Creator.getCollection('love_answer2')
loveResultCollection = Creator.getCollection('love_result')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveHobbyCollection = Creator.getCollection('love_hobby')
loveEducationalExperienceCollection = Creator.getCollection('love_educational_experience')
loveWorkExperienceCollection = Creator.getCollection('love_work_experience')
loveRecommendHistoryCollection = Creator.getCollection('love_recommend_history')
loveFriendsCollection = Creator.getCollection('love_friends')
loveTestCollection = Creator.getCollection('love_test')
# 数据加载到内存
data = {}
customQuery = { space: loveSpaceId, $or: [] }
LoveManager.answerObjectNames.forEach (objName) ->
customQuery.$or.push { questionnaire_progess: objName }
# 双方必须已经填写手机号才能计算推荐
customQuery.mobile = { $exists: true }
console.log customQuery
Creator.getCollection('vip_customers').find(customQuery).forEach (cust)->
owner = cust.owner
data[owner] = {
love_about_me: loveAboutMeCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer: loveAnswerCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer2: loveAnswer2Collection.findOne({ space: loveSpaceId, owner: owner })
love_test: loveTestCollection.findOne({ space: loveSpaceId, owner: owner })
love_result: loveResultCollection.findOne({ space: loveSpaceId, userA: owner }, { fields: { _id: 1 } })
love_looking_for: loveLookingForCollection.findOne({ space: loveSpaceId, owner: owner })
# love_hobby: loveHobbyCollection.findOne({ space: loveSpaceId, owner: owner })
# love_educational_experience: loveEducationalExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
# love_work_experience: loveWorkExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_recommend_history: loveRecommendHistoryCollection.find({ space: loveSpaceId, user_a: owner }).fetch()
}
# 获取题目字段key
answerKeyObj = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
_.each data, (dv, userId) ->
if userIds and not userIds.includes(userId)
return
lookingFor = dv['love_looking_for']
if not lookingFor
return
loveAboutMe = dv['love_about_me']
if not loveAboutMe
return
resultMe = dv['love_result']
scoreA_B = []
scoreB_A = []
score = []
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: loveSpaceId, owner: { $ne: userId } }
query.sex = gender
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
query.height = { $gte: heightMin, $lte: heightMax }
# console.log 'query: ', query
loveAboutMeCollection.find(query, { fields: { owner: 1, name: 1 } }).fetch().forEach (aboutMe) ->
if not data[aboutMe.owner]
return
aboutMeLookingFor = data[aboutMe.owner]['love_looking_for']
if not aboutMeLookingFor
return
if loveAboutMe.sex isnt aboutMeLookingFor.sex or loveAboutMe.age < parseInt(aboutMeLookingFor.age) or loveAboutMe.age > parseInt(aboutMeLookingFor.age_max) or loveAboutMe.height < aboutMeLookingFor.height or loveAboutMe.height > aboutMeLookingFor.height_max
return
lrh = _.find data[userId]['love_recommend_history'], (h) ->
return h.user_b is aboutMe.owner
if lrh
return
# 好友(love_friends)不在计算范围内
if loveFriendsCollection.find({ space: loveSpaceId, owner: userId, user_b: aboutMe.owner, mini_app_id: loveMiniAppId }).count() > 0
return
# console.log userId + '>>' + aboutMe.owner
owner = aboutMe.owner
name = aboutMe.name
r = LoveManager.caculateScore(dv, data[owner], answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
if scoreA_B.length < topNumber
scoreA_B.push({userB: owner, BName: name, score: aToB})
else
i = 0
while i < scoreA_B.length
if scoreA_B[i].score < aToB
scoreA_B[i] = {userB: owner, BName: name, score: aToB}
break
i++
if scoreB_A.length < topNumber
scoreB_A.push({userB: owner, BName: name, score: bToA})
else
i = 0
while i<scoreB_A.length
if scoreB_A[i].score < bToA
scoreB_A[i] = {userB: owner, BName: name, score: bToA}
break
i++
# 互相匹配超过60%才算入匹配结果
if match > 0.6
if score.length < topNumber
score.push({userB: owner, BName: name, score: match})
else
i = 0
while i<score.length
if score[i].score < match
score[i] = {userB: owner, BName: name, score: match}
break
i++
if scoreA_B.length > 0 or scoreB_A.length > 0 or score.length > 0
if resultMe
loveResultCollection.update(resultMe._id,{$set:{
scoreA_B: scoreA_B
scoreB_A: scoreB_A
score: score
}})
else
loveResultCollection.insert({
userA: userId
scoreA_B: scoreA_B
scoreB_A: scoreB_A
score: score
owner: userId
space: loveSpaceId
})
console.timeEnd 'caculateScore'
return
LoveManager.getQuestionKeys = (objectName) ->
keys = []
_.each Creator.Objects[objectName].fields, (v, k) ->
if k.endsWith('_o') or k.endsWith('_i')
return
else
keys.push k
return keys
LoveManager.getMatchScores = (questionKeys, aAnswer, bAnswer) ->
importP = 5
normalP = 1
aFullPoints = 0
bGotPoints = 0
bFullPoints = 0
aGotPoints = 0
questionsNumber = 0
questionKeys.forEach (ak) ->
akI = ak+'_i'
akO = ak+'_o'
if aAnswer[akI] > -1 and bAnswer[akI] > -1
questionsNumber++
if aAnswer[akI] is 0
aFullPoints += normalP
bGotPoints += normalP
else if aAnswer[akI] is 1
aFullPoints += normalP
if aAnswer[akO] and aAnswer[akO].includes(bAnswer[ak])
bGotPoints += normalP
else if aAnswer[akI] is 2
aFullPoints += importP
if aAnswer[akO] and aAnswer[akO].includes(bAnswer[ak])
bGotPoints += importP
if bAnswer[akI] is 0
bFullPoints += normalP
aGotPoints += normalP
else if bAnswer[akI] is 1
bFullPoints += normalP
if bAnswer[akO] and bAnswer[akO].includes(aAnswer[ak])
aGotPoints += normalP
else if bAnswer[akI] is 2
bFullPoints += importP
if bAnswer[akO] and bAnswer[akO].includes(aAnswer[ak])
aGotPoints += importP
return { aFullPoints, bGotPoints, bFullPoints, aGotPoints, questionsNumber }
LoveManager.createResultScoreView = () ->
db = Creator.getCollection('love_result').rawDatabase()
db.createCollection('love_result_score_view', {
viewOn: 'love_result',
pipeline: [{
$unwind: '$score'
}, {
$project: {
userA: "$userA",
userB: "$score.userB",
BName: "$score.BName",
score: "$score.score"
}
}]
}).then((view) ->
LoveManager.resultScoreViewCollection = new Mongo.Collection(view.collectionName)
)
return
LoveManager.caculateRecommend = (spaceId) ->
console.time 'caculateRecommend'
Creator.getCollection('love_recommend').remove({})
newRecommendUserIds = []
limit = 10000
skip = 0
scoreCount = 0
recommendColl = Creator.getCollection('love_recommend')
recommendHistColl = Creator.getCollection('love_recommend_history')
tempScoreResult = []
Meteor.wrapAsync((callback) ->
Creator.getCollection('love_result').rawCollection().aggregate([{ $unwind: '$score' }, { $project: { userA: "$userA", userB: "$score.userB", BName: "$score.BName", score: "$score.score" } }, { $count: 'count' }], (err, data)->
if err
console.error err
return
scoreCount = data[0].count
if callback && _.isFunction(callback)
callback()
return
)
)()
console.log 'scoreCount: ', scoreCount
wrapFunc = Meteor.wrapAsync((callback) ->
console.log 'skip: ', skip
Creator.getCollection('love_result').rawCollection().aggregate([{ $unwind: '$score' }, { $project: { userA: "$userA", userB: "$score.userB", BName: "$score.BName", score: "$score.score" } }, { $sort: { 'score': -1 } }, { $skip: skip }, { $limit: limit }], { allowDiskUse: true }, (err, data)->
if err
console.error err
return
data.forEach (r) ->
tempScoreResult.push r
if callback && _.isFunction(callback)
callback()
return
)
)
while skip < scoreCount
wrapFunc()
tempScoreResult.forEach (r)->
skip++
if newRecommendUserIds.includes(r.userA) or newRecommendUserIds.includes(r.userB)
return
if r.score
user_a = r.userA
user_b = r.userB
score = r.score
if recommendColl.find({ user_a: user_a }).count() > 0 or recommendHistColl.find({ user_a: user_a, user_b: user_b }).count() > 0
return
newRecommendUserIds.push user_a
newRecommendUserIds.push user_b
now = new Date()
recommendColl.insert({
user_a: user_a
user_b: user_b
match: score
recommend_date: now
owner: user_a
space: spaceId
})
recommendHistColl.insert({
user_a: user_a
user_b: user_b
match: score
recommend_date: now
owner: user_a
space: spaceId
})
recommendColl.insert({
user_a: user_b
user_b: user_a
match: score
recommend_date: now
owner: user_b
space: spaceId
})
recommendHistColl.insert({
user_a: user_b
user_b: user_a
match: score
recommend_date: now
owner: user_b
space: spaceId
})
tempScoreResult = []
console.timeEnd 'caculateRecommend'
return
LoveManager.caculateLoveTags = (userId, spaceId, objectName) ->
vipCustomersCollection = Creator.getCollection('vip_customers')
if objectName == "love_test"
loveTestCollection = Creator.getCollection('love_test')
loveTestAnswer = loveTestCollection.findOne({
space: spaceId,
owner: userId
}, {
fields: {
education: 1,
body_type: 1,
employed: 1,
disgust_smoke: 1,
pet: 1,
messy: 1,
previous_picture: 1 ,
parents_influence: 1 ,
finance_budget: 1 ,
communicate: 1
}
})
tags = []
unless loveTestAnswer
return;
if loveTestAnswer.education
education = loveTestAnswer.education
if education != "高中及以下"
tags.push "#{education}学历"
if loveTestAnswer.body_type
tags.push "#{loveTestAnswer.body_type}身材"
if loveTestAnswer.employed
tags.push "#{loveTestAnswer.employed}"
if loveTestAnswer.disgust_smoke and loveTestAnswer.disgust_smoke == "是"
tags.push "不吸烟"
if loveTestAnswer.pet and loveTestAnswer.pet == "会"
tags.push "超爱宠物"
if (loveTestAnswer.pet and loveTestAnswer.pet == "不会") or (loveTestAnswer.messy and loveTestAnswer.messy == "介意")
tags.push "爱干净"
if loveTestAnswer.previous_picture and loveTestAnswer.previous_picture == "会"
tags.push "占有欲强"
else if loveTestAnswer.previous_picture and loveTestAnswer.previous_picture == "不会"
tags.push "宽容"
if loveTestAnswer.parents_influence and loveTestAnswer.parents_influence == "我自己做主"
tags.push "独立"
else if loveTestAnswer.parents_influence and "我通常会听父母的,完全听父母的".split(",").indexOf(loveTestAnswer.parents_influence) > -1
tags.push "乖宝宝"
if loveTestAnswer.finance_budget and loveTestAnswer.finance_budget == "会"
tags.push "未来的有钱人"
if loveTestAnswer.communicate and loveTestAnswer.communicate == "是的,雷打不动"
tags.push "粘人"
vipCustomersCollection.update({
space: spaceId,
owner: userId
}, {
$set: {
love_test_tags: tags
}
})
LoveManager.caculateFriendsScore = (userId, spaceId, rest, matchingFilterEnable) ->
customQuery = { space: spaceId, owner: {}, $or: [] }
vipCustomersCollection = Creator.getCollection('vip_customers')
loveFriendsCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
query = { space: spaceId, owner: userId, mini_app_id: loveMiniAppId }
if rest
query.match = { $exists: false }
friendsIds = _.pluck(loveFriendsCollection.find(query, { fields: { user_b: 1 } }).fetch(), 'user_b')
customQuery.owner = { $in: friendsIds }
vipCustomersCollection.find(customQuery).forEach (cust) ->
try
userB = cust.owner
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userB })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: userB, mini_app_id: loveMiniAppId }, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
loveFriendsCollection.update({ space: spaceId, owner: userB, user_b: userId, mini_app_id: loveMiniAppId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
if matchingFilterEnable
LoveManager.caculateFriendsIsLookingFor(userId, spaceId)
LoveManager.caculateFriendsIsLookingFor(userId, spaceId)
return
# 缘分榜加筛选条件功能,每次刷新调用answered接口应该计算is_looking_for属性值并保存 #572
LoveManager.caculateFriendsIsLookingFor = (userId, spaceId) ->
customQuery = { space: spaceId, owner: {}, $or: [] }
now = new Date()
loveFriendsCollection = Creator.getCollection('love_friends')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveAboutMeCollection = Creator.getCollection('love_about_me')
vipCustomersCollection = Creator.getCollection('vip_customers')
loveMiniAppId = LoveManager.loveMiniAppId
LoveManager.answerObjectNames.forEach (objName) ->
customQuery.$or.push { questionnaire_progess: objName }
customer = vipCustomersCollection.findOne({ space: spaceId, owner: userId }, { fields: { matching_filter_caculate_time: 1 } })
matchingFilterCaculateTime = customer.matching_filter_caculate_time || 0
lookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: userId })
if lookingFor
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: spaceId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
unless query
return
friendsIds = _.pluck(loveFriendsCollection.find({ space: spaceId, owner: userId, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
customQuery.owner = { $in: friendsIds }
customersIds = _.pluck(vipCustomersCollection.find(customQuery, { fields: { owner: 1 } }).fetch(), 'owner')
query.owner = { $in: customersIds }
if matchingFilterCaculateTime >= lookingFor.modified
query.modified = { $gte: matchingFilterCaculateTime }
modifiedQuery = _.pick(query, 'space', 'owner', 'modified')
filterIds = _.pluck(loveAboutMeCollection.find(query, { fields: { owner: 1 } }).fetch(), 'owner')
modifiedIds = _.pluck(loveAboutMeCollection.find(modifiedQuery, { fields: { owner: 1 } }).fetch(), 'owner')
restIds = _.difference modifiedIds, filterIds
if filterIds.length > 0
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: { $in: filterIds }, mini_app_id: loveMiniAppId }, { $set: { is_looking_for: true } }, { multi: true })
if restIds.length > 0
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: { $in: restIds }, mini_app_id: loveMiniAppId }, { $set: { is_looking_for: false } }, { multi: true })
vipCustomersCollection.update({ space: spaceId, owner: userId }, { $set: { matching_filter_caculate_time: now } })
return
# 摇一摇:计算与好友的好友匹配 #609
LoveManager.caculateShakeFriendsScore = (userId, spaceId) ->
customQuery = { space: spaceId, $or: [] }
customCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveAnswerCollection = Creator.getCollection('love_answer')
loveAnswer2Collection = Creator.getCollection('love_answer2')
loveResultCollection = Creator.getCollection('love_result')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveHobbyCollection = Creator.getCollection('love_hobby')
loveEducationalExperienceCollection = Creator.getCollection('love_educational_experience')
loveWorkExperienceCollection = Creator.getCollection('love_work_experience')
loveRecommendHistoryCollection = Creator.getCollection('love_recommend_history')
loveTestCollection = Creator.getCollection('love_test')
# 数据加载到内存
data = {}
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
customCollection.find(customQuery).forEach (cust)->
owner = cust.owner
data[owner] = {
love_about_me: loveAboutMeCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer: loveAnswerCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer2: loveAnswer2Collection.findOne({ space: loveSpaceId, owner: owner })
love_test: loveTestCollection.findOne({ space: loveSpaceId, owner: owner })
love_result: loveResultCollection.findOne({ space: loveSpaceId, userA: owner }, { fields: { _id: 1 } })
love_looking_for: loveLookingForCollection.findOne({ space: loveSpaceId, owner: owner })
love_hobby: loveHobbyCollection.findOne({ space: loveSpaceId, owner: owner })
love_educational_experience: loveEducationalExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_work_experience: loveWorkExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_recommend_history: loveRecommendHistoryCollection.find({ space: loveSpaceId, user_a: owner }).fetch()
}
# 我的好友
bIds = _.pluck(friendCollection.find({ space: spaceId, owner: userId, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
# 我的好友的好友
bFriendsIds = _.uniq _.pluck(friendCollection.find({ space: spaceId, owner: { $in: bIds }, user_b: { $ne: userId }, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
bFriendsIds.forEach (lf) ->
try
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: lf.user_b })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
friendCollection.update(lf._id, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: userId, mini_app_id: loveMiniAppId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
return
LoveManager.caculateFriendsOfFriendScore = (userId, friendId, spaceId) ->
customQuery = { space: spaceId, owner: '', $or: [] }
customCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
query = { space: spaceId, owner: friendId, mini_app_id: loveMiniAppId }
friendCollection.find(query).forEach (lf) ->
try
customQuery.owner = lf.user_b
unless customCollection.find(customQuery).count()
friendCollection.update(lf._id, { $unset: { a_to_b: 1, b_to_a: 1, match: 1 } })
friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: friendId, mini_app_id: loveMiniAppId }, { $unset: { a_to_b: 1, b_to_a: 1, match: 1 } })
return
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: lf.user_b })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
# beenFriend =
# friendCollection.update(lf._id, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
# friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: userId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
return
### 计算情敌指数 #594
前提:
在friends范围内
两个人的总匹配度小于60%,且互相不满足筛选条件
两个人都喜欢男生/女生
###
LoveManager.caculateLoveEnemyScore = (userId, friendId, spaceId) ->
customQuery = { space: spaceId, owner: '', $or: [] }
vipCustomersCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveMiniAppId = LoveManager.loveMiniAppId
# 两个人的总匹配度小于60%
friend = friendCollection.findOne({ space: spaceId, owner: userId, user_b: friendId, mini_app_id: loveMiniAppId })
if not friend
# console.log 'not friend'
return
if friend.match >= 0.6
# console.log 'friend.match >= 0.6'
return
# 互相不满足筛选条件
lookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: userId })
if lookingFor
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: spaceId, owner: friendId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
if loveAboutMeCollection.find(query).count()
# console.log 'loveAboutMe match lookingFor'
return
else
# console.log 'no lookingFor'
return
friendLookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: friendId })
if friendLookingFor
gender = friendLookingFor.sex
ageMin = friendLookingFor.age
ageMax = friendLookingFor.age_max
heightMin = friendLookingFor.height
heightMax = friendLookingFor.height_max
query = { space: spaceId, owner: userId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
if loveAboutMeCollection.find(query).count()
# console.log 'loveAboutMe match friendLookingFor'
return
else
# console.log 'no friendLookingFor'
return
# 两个人都喜欢男生/女生
if (lookingFor.sex isnt friendLookingFor.sex) or not lookingFor.sex or not friendLookingFor.sex
# console.log 'not both like male/female'
return
# 获取题目字段key
answerKeyObj = {}
dv = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
dv[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
customer = vipCustomersCollection.findOne({ space: spaceId, owner: userId }, { fields: { questionnaire_progess: 1 } })
friendCustomer = vipCustomersCollection.findOne({ space: spaceId, owner: friendId }, { fields: { questionnaire_progess: 1 } })
questionnaireProgess = customer.questionnaire_progess || []
friendQuestionnaireProgess = friendCustomer.questionnaire_progess || []
# console.log 'questionnaireProgess: ', questionnaireProgess
# console.log 'friendQuestionnaireProgess: ', friendQuestionnaireProgess
# 计算分子、分母
score = 0
questionsNumber = 0
LoveManager.answerObjectNames.forEach (objName) ->
if questionnaireProgess.includes(objName) and friendQuestionnaireProgess.includes(objName)
console.log 'objName: ', objName
bAnswer = Creator.getCollection(objName).findOne({ space: spaceId, owner: friendId })
if dv[objName] and bAnswer # 当两人都做了同一套问卷时计算分数
r = LoveManager.getLoveEnemyScore(answerKeyObj[objName], dv[objName], bAnswer)
# console.log r
score += r.score
questionsNumber += r.questionsNumber
return score/questionsNumber || 0
LoveManager.getLoveEnemyScore = (questionKeys, aAnswer, bAnswer) ->
score = 0
questionsNumber = 0
questionKeys.forEach (ak) ->
akI = ak+'_i'
akO = ak+'_o'
if aAnswer[akI] > -1 and bAnswer[akI] > -1
# console.log 'aAnswer[akO]: '
# console.log aAnswer[akO]
# console.log 'bAnswer[akO]: '
# console.log bAnswer[akO]
# console.log '--------------------------------------'
questionsNumber++
if aAnswer[akO].toString() is bAnswer[akO].toString()
score += 1
else
common = _.intersection aAnswer[akO], bAnswer[akO]
score += common.length/aAnswer[akO].length
return { score: score, questionsNumber: questionsNumber }
LoveManager.caculateOneToOneScore = (userId, userB, spaceId) ->
customQuery = { space: spaceId, owner: userB, $or: [] }
customCollection = Creator.getCollection('vip_customers')
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userB })
customQuery.$or.push { questionnaire_progess: objName }
unless customCollection.find(customQuery).count()
return
return LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
LoveManager.caculateScore = (aAnswers, bAnswers, answerKeyObj) ->
# 计算分子、分母
aFullPoints = 0
bGotPoints = 0
bFullPoints = 0
aGotPoints = 0
questionsNumber = 0
_.each answerKeyObj, (keys, objName) ->
if aAnswers[objName] and bAnswers[objName] # 当两人都做了同一套问卷时计算分数
r = LoveManager.getMatchScores(keys, aAnswers[objName], bAnswers[objName])
aFullPoints += r.aFullPoints
bGotPoints += r.bGotPoints
bFullPoints += r.bFullPoints
aGotPoints += r.aGotPoints
questionsNumber += r.questionsNumber
# 共同答题少于5题不计算匹配度。#703
if questionsNumber >= 5
a_to_b = bGotPoints/aFullPoints || 0
b_to_a = aGotPoints/bFullPoints || 0
match = Math.pow(a_to_b*b_to_a, 1/2)
else
a_to_b = b_to_a = match = 0
return { a_to_b, b_to_a, match }
| 219579 | LoveManager = {
answerObjectNames: ['love_answer','love_answer2','love_test']
loveMiniAppId: 'wx033a2ed30bf98cc2'
}
LoveManager.caculateResult = (loveSpaceId, userIds) ->
check loveSpaceId, String
console.time 'caculateScore'
topNumber = 10
loveMiniAppId = LoveManager.loveMiniAppId
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveAnswerCollection = Creator.getCollection('love_answer')
loveAnswer2Collection = Creator.getCollection('love_answer2')
loveResultCollection = Creator.getCollection('love_result')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveHobbyCollection = Creator.getCollection('love_hobby')
loveEducationalExperienceCollection = Creator.getCollection('love_educational_experience')
loveWorkExperienceCollection = Creator.getCollection('love_work_experience')
loveRecommendHistoryCollection = Creator.getCollection('love_recommend_history')
loveFriendsCollection = Creator.getCollection('love_friends')
loveTestCollection = Creator.getCollection('love_test')
# 数据加载到内存
data = {}
customQuery = { space: loveSpaceId, $or: [] }
LoveManager.answerObjectNames.forEach (objName) ->
customQuery.$or.push { questionnaire_progess: objName }
# 双方必须已经填写手机号才能计算推荐
customQuery.mobile = { $exists: true }
console.log customQuery
Creator.getCollection('vip_customers').find(customQuery).forEach (cust)->
owner = cust.owner
data[owner] = {
love_about_me: loveAboutMeCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer: loveAnswerCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer2: loveAnswer2Collection.findOne({ space: loveSpaceId, owner: owner })
love_test: loveTestCollection.findOne({ space: loveSpaceId, owner: owner })
love_result: loveResultCollection.findOne({ space: loveSpaceId, userA: owner }, { fields: { _id: 1 } })
love_looking_for: loveLookingForCollection.findOne({ space: loveSpaceId, owner: owner })
# love_hobby: loveHobbyCollection.findOne({ space: loveSpaceId, owner: owner })
# love_educational_experience: loveEducationalExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
# love_work_experience: loveWorkExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_recommend_history: loveRecommendHistoryCollection.find({ space: loveSpaceId, user_a: owner }).fetch()
}
# 获取题目字段key
answerKeyObj = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
_.each data, (dv, userId) ->
if userIds and not userIds.includes(userId)
return
lookingFor = dv['love_looking_for']
if not lookingFor
return
loveAboutMe = dv['love_about_me']
if not loveAboutMe
return
resultMe = dv['love_result']
scoreA_B = []
scoreB_A = []
score = []
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: loveSpaceId, owner: { $ne: userId } }
query.sex = gender
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
query.height = { $gte: heightMin, $lte: heightMax }
# console.log 'query: ', query
loveAboutMeCollection.find(query, { fields: { owner: 1, name: 1 } }).fetch().forEach (aboutMe) ->
if not data[aboutMe.owner]
return
aboutMeLookingFor = data[aboutMe.owner]['love_looking_for']
if not aboutMeLookingFor
return
if loveAboutMe.sex isnt aboutMeLookingFor.sex or loveAboutMe.age < parseInt(aboutMeLookingFor.age) or loveAboutMe.age > parseInt(aboutMeLookingFor.age_max) or loveAboutMe.height < aboutMeLookingFor.height or loveAboutMe.height > aboutMeLookingFor.height_max
return
lrh = _.find data[userId]['love_recommend_history'], (h) ->
return h.user_b is aboutMe.owner
if lrh
return
# 好友(love_friends)不在计算范围内
if loveFriendsCollection.find({ space: loveSpaceId, owner: userId, user_b: aboutMe.owner, mini_app_id: loveMiniAppId }).count() > 0
return
# console.log userId + '>>' + aboutMe.owner
owner = aboutMe.owner
name = aboutMe.name
r = LoveManager.caculateScore(dv, data[owner], answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
if scoreA_B.length < topNumber
scoreA_B.push({userB: owner, BName: name, score: aToB})
else
i = 0
while i < scoreA_B.length
if scoreA_B[i].score < aToB
scoreA_B[i] = {userB: owner, BName: name, score: aToB}
break
i++
if scoreB_A.length < topNumber
scoreB_A.push({userB: owner, BName: name, score: bToA})
else
i = 0
while i<scoreB_A.length
if scoreB_A[i].score < bToA
scoreB_A[i] = {userB: owner, BName: name, score: bToA}
break
i++
# 互相匹配超过60%才算入匹配结果
if match > 0.6
if score.length < topNumber
score.push({userB: owner, BName: name, score: match})
else
i = 0
while i<score.length
if score[i].score < match
score[i] = {userB: owner, BName: name, score: match}
break
i++
if scoreA_B.length > 0 or scoreB_A.length > 0 or score.length > 0
if resultMe
loveResultCollection.update(resultMe._id,{$set:{
scoreA_B: scoreA_B
scoreB_A: scoreB_A
score: score
}})
else
loveResultCollection.insert({
userA: userId
scoreA_B: scoreA_B
scoreB_A: scoreB_A
score: score
owner: userId
space: loveSpaceId
})
console.timeEnd 'caculateScore'
return
LoveManager.getQuestionKeys = (objectName) ->
keys = []
_.each Creator.Objects[objectName].fields, (v, k) ->
if k.endsWith('_o') or k.endsWith('_i')
return
else
keys.push k
return keys
LoveManager.getMatchScores = (questionKeys, aAnswer, bAnswer) ->
importP = 5
normalP = 1
aFullPoints = 0
bGotPoints = 0
bFullPoints = 0
aGotPoints = 0
questionsNumber = 0
questionKeys.forEach (ak) ->
akI = ak+'_i'
akO = ak+'_o'
if aAnswer[akI] > -1 and bAnswer[akI] > -1
questionsNumber++
if aAnswer[akI] is 0
aFullPoints += normalP
bGotPoints += normalP
else if aAnswer[akI] is 1
aFullPoints += normalP
if aAnswer[akO] and aAnswer[akO].includes(bAnswer[ak])
bGotPoints += normalP
else if aAnswer[akI] is 2
aFullPoints += importP
if aAnswer[akO] and aAnswer[akO].includes(bAnswer[ak])
bGotPoints += importP
if bAnswer[akI] is 0
bFullPoints += normalP
aGotPoints += normalP
else if bAnswer[akI] is 1
bFullPoints += normalP
if bAnswer[akO] and bAnswer[akO].includes(aAnswer[ak])
aGotPoints += normalP
else if bAnswer[akI] is 2
bFullPoints += importP
if bAnswer[akO] and bAnswer[akO].includes(aAnswer[ak])
aGotPoints += importP
return { aFullPoints, bGotPoints, bFullPoints, aGotPoints, questionsNumber }
LoveManager.createResultScoreView = () ->
db = Creator.getCollection('love_result').rawDatabase()
db.createCollection('love_result_score_view', {
viewOn: 'love_result',
pipeline: [{
$unwind: '$score'
}, {
$project: {
userA: "$userA",
userB: "$score.userB",
BName: "$score.BName",
score: "$score.score"
}
}]
}).then((view) ->
LoveManager.resultScoreViewCollection = new Mongo.Collection(view.collectionName)
)
return
LoveManager.caculateRecommend = (spaceId) ->
console.time 'caculateRecommend'
Creator.getCollection('love_recommend').remove({})
newRecommendUserIds = []
limit = 10000
skip = 0
scoreCount = 0
recommendColl = Creator.getCollection('love_recommend')
recommendHistColl = Creator.getCollection('love_recommend_history')
tempScoreResult = []
Meteor.wrapAsync((callback) ->
Creator.getCollection('love_result').rawCollection().aggregate([{ $unwind: '$score' }, { $project: { userA: "$userA", userB: "$score.userB", BName: "$score.BName", score: "$score.score" } }, { $count: 'count' }], (err, data)->
if err
console.error err
return
scoreCount = data[0].count
if callback && _.isFunction(callback)
callback()
return
)
)()
console.log 'scoreCount: ', scoreCount
wrapFunc = Meteor.wrapAsync((callback) ->
console.log 'skip: ', skip
Creator.getCollection('love_result').rawCollection().aggregate([{ $unwind: '$score' }, { $project: { userA: "$userA", userB: "$score.userB", BName: "$score.BName", score: "$score.score" } }, { $sort: { 'score': -1 } }, { $skip: skip }, { $limit: limit }], { allowDiskUse: true }, (err, data)->
if err
console.error err
return
data.forEach (r) ->
tempScoreResult.push r
if callback && _.isFunction(callback)
callback()
return
)
)
while skip < scoreCount
wrapFunc()
tempScoreResult.forEach (r)->
skip++
if newRecommendUserIds.includes(r.userA) or newRecommendUserIds.includes(r.userB)
return
if r.score
user_a = r.userA
user_b = r.userB
score = r.score
if recommendColl.find({ user_a: user_a }).count() > 0 or recommendHistColl.find({ user_a: user_a, user_b: user_b }).count() > 0
return
newRecommendUserIds.push user_a
newRecommendUserIds.push user_b
now = new Date()
recommendColl.insert({
user_a: user_a
user_b: user_b
match: score
recommend_date: now
owner: user_a
space: spaceId
})
recommendHistColl.insert({
user_a: user_a
user_b: user_b
match: score
recommend_date: now
owner: user_a
space: spaceId
})
recommendColl.insert({
user_a: user_b
user_b: user_a
match: score
recommend_date: now
owner: user_b
space: spaceId
})
recommendHistColl.insert({
user_a: user_b
user_b: user_a
match: score
recommend_date: now
owner: user_b
space: spaceId
})
tempScoreResult = []
console.timeEnd 'caculateRecommend'
return
LoveManager.caculateLoveTags = (userId, spaceId, objectName) ->
vipCustomersCollection = Creator.getCollection('vip_customers')
if objectName == "love_test"
loveTestCollection = Creator.getCollection('love_test')
loveTestAnswer = loveTestCollection.findOne({
space: spaceId,
owner: <NAME>
}, {
fields: {
education: 1,
body_type: 1,
employed: 1,
disgust_smoke: 1,
pet: 1,
messy: 1,
previous_picture: 1 ,
parents_influence: 1 ,
finance_budget: 1 ,
communicate: 1
}
})
tags = []
unless loveTestAnswer
return;
if loveTestAnswer.education
education = loveTestAnswer.education
if education != "高中及以下"
tags.push "#{education}学历"
if loveTestAnswer.body_type
tags.push "#{loveTestAnswer.body_type}身材"
if loveTestAnswer.employed
tags.push "#{loveTestAnswer.employed}"
if loveTestAnswer.disgust_smoke and loveTestAnswer.disgust_smoke == "是"
tags.push "不吸烟"
if loveTestAnswer.pet and loveTestAnswer.pet == "会"
tags.push "超爱宠物"
if (loveTestAnswer.pet and loveTestAnswer.pet == "不会") or (loveTestAnswer.messy and loveTestAnswer.messy == "介意")
tags.push "爱干净"
if loveTestAnswer.previous_picture and loveTestAnswer.previous_picture == "会"
tags.push "占有欲强"
else if loveTestAnswer.previous_picture and loveTestAnswer.previous_picture == "不会"
tags.push "宽容"
if loveTestAnswer.parents_influence and loveTestAnswer.parents_influence == "我自己做主"
tags.push "独立"
else if loveTestAnswer.parents_influence and "我通常会听父母的,完全听父母的".split(",").indexOf(loveTestAnswer.parents_influence) > -1
tags.push "乖宝宝"
if loveTestAnswer.finance_budget and loveTestAnswer.finance_budget == "会"
tags.push "未来的有钱人"
if loveTestAnswer.communicate and loveTestAnswer.communicate == "是的,雷打不动"
tags.push "粘人"
vipCustomersCollection.update({
space: spaceId,
owner: userId
}, {
$set: {
love_test_tags: tags
}
})
LoveManager.caculateFriendsScore = (userId, spaceId, rest, matchingFilterEnable) ->
customQuery = { space: spaceId, owner: {}, $or: [] }
vipCustomersCollection = Creator.getCollection('vip_customers')
loveFriendsCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
query = { space: spaceId, owner: userId, mini_app_id: loveMiniAppId }
if rest
query.match = { $exists: false }
friendsIds = _.pluck(loveFriendsCollection.find(query, { fields: { user_b: 1 } }).fetch(), 'user_b')
customQuery.owner = { $in: friendsIds }
vipCustomersCollection.find(customQuery).forEach (cust) ->
try
userB = cust.owner
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userB })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: userB, mini_app_id: loveMiniAppId }, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
loveFriendsCollection.update({ space: spaceId, owner: userB, user_b: userId, mini_app_id: loveMiniAppId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
if matchingFilterEnable
LoveManager.caculateFriendsIsLookingFor(userId, spaceId)
LoveManager.caculateFriendsIsLookingFor(userId, spaceId)
return
# 缘分榜加筛选条件功能,每次刷新调用answered接口应该计算is_looking_for属性值并保存 #572
LoveManager.caculateFriendsIsLookingFor = (userId, spaceId) ->
customQuery = { space: spaceId, owner: {}, $or: [] }
now = new Date()
loveFriendsCollection = Creator.getCollection('love_friends')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveAboutMeCollection = Creator.getCollection('love_about_me')
vipCustomersCollection = Creator.getCollection('vip_customers')
loveMiniAppId = LoveManager.loveMiniAppId
LoveManager.answerObjectNames.forEach (objName) ->
customQuery.$or.push { questionnaire_progess: objName }
customer = vipCustomersCollection.findOne({ space: spaceId, owner: userId }, { fields: { matching_filter_caculate_time: 1 } })
matchingFilterCaculateTime = customer.matching_filter_caculate_time || 0
lookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: userId })
if lookingFor
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: spaceId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
unless query
return
friendsIds = _.pluck(loveFriendsCollection.find({ space: spaceId, owner: userId, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
customQuery.owner = { $in: friendsIds }
customersIds = _.pluck(vipCustomersCollection.find(customQuery, { fields: { owner: 1 } }).fetch(), 'owner')
query.owner = { $in: customersIds }
if matchingFilterCaculateTime >= lookingFor.modified
query.modified = { $gte: matchingFilterCaculateTime }
modifiedQuery = _.pick(query, 'space', 'owner', 'modified')
filterIds = _.pluck(loveAboutMeCollection.find(query, { fields: { owner: 1 } }).fetch(), 'owner')
modifiedIds = _.pluck(loveAboutMeCollection.find(modifiedQuery, { fields: { owner: 1 } }).fetch(), 'owner')
restIds = _.difference modifiedIds, filterIds
if filterIds.length > 0
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: { $in: filterIds }, mini_app_id: loveMiniAppId }, { $set: { is_looking_for: true } }, { multi: true })
if restIds.length > 0
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: { $in: restIds }, mini_app_id: loveMiniAppId }, { $set: { is_looking_for: false } }, { multi: true })
vipCustomersCollection.update({ space: spaceId, owner: userId }, { $set: { matching_filter_caculate_time: now } })
return
# 摇一摇:计算与好友的好友匹配 #609
LoveManager.caculateShakeFriendsScore = (userId, spaceId) ->
customQuery = { space: spaceId, $or: [] }
customCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveAnswerCollection = Creator.getCollection('love_answer')
loveAnswer2Collection = Creator.getCollection('love_answer2')
loveResultCollection = Creator.getCollection('love_result')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveHobbyCollection = Creator.getCollection('love_hobby')
loveEducationalExperienceCollection = Creator.getCollection('love_educational_experience')
loveWorkExperienceCollection = Creator.getCollection('love_work_experience')
loveRecommendHistoryCollection = Creator.getCollection('love_recommend_history')
loveTestCollection = Creator.getCollection('love_test')
# 数据加载到内存
data = {}
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
customCollection.find(customQuery).forEach (cust)->
owner = cust.owner
data[owner] = {
love_about_me: loveAboutMeCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer: loveAnswerCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer2: loveAnswer2Collection.findOne({ space: loveSpaceId, owner: owner })
love_test: loveTestCollection.findOne({ space: loveSpaceId, owner: owner })
love_result: loveResultCollection.findOne({ space: loveSpaceId, userA: owner }, { fields: { _id: 1 } })
love_looking_for: loveLookingForCollection.findOne({ space: loveSpaceId, owner: owner })
love_hobby: loveHobbyCollection.findOne({ space: loveSpaceId, owner: owner })
love_educational_experience: loveEducationalExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_work_experience: loveWorkExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_recommend_history: loveRecommendHistoryCollection.find({ space: loveSpaceId, user_a: owner }).fetch()
}
# 我的好友
bIds = _.pluck(friendCollection.find({ space: spaceId, owner: userId, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
# 我的好友的好友
bFriendsIds = _.uniq _.pluck(friendCollection.find({ space: spaceId, owner: { $in: bIds }, user_b: { $ne: userId }, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
bFriendsIds.forEach (lf) ->
try
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: lf.user_b })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
friendCollection.update(lf._id, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: userId, mini_app_id: loveMiniAppId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
return
LoveManager.caculateFriendsOfFriendScore = (userId, friendId, spaceId) ->
customQuery = { space: spaceId, owner: '', $or: [] }
customCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
query = { space: spaceId, owner: friendId, mini_app_id: loveMiniAppId }
friendCollection.find(query).forEach (lf) ->
try
customQuery.owner = lf.user_b
unless customCollection.find(customQuery).count()
friendCollection.update(lf._id, { $unset: { a_to_b: 1, b_to_a: 1, match: 1 } })
friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: friendId, mini_app_id: loveMiniAppId }, { $unset: { a_to_b: 1, b_to_a: 1, match: 1 } })
return
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: lf.user_b })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
# beenFriend =
# friendCollection.update(lf._id, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
# friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: userId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
return
### 计算情敌指数 #594
前提:
在friends范围内
两个人的总匹配度小于60%,且互相不满足筛选条件
两个人都喜欢男生/女生
###
LoveManager.caculateLoveEnemyScore = (userId, friendId, spaceId) ->
customQuery = { space: spaceId, owner: '', $or: [] }
vipCustomersCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveMiniAppId = LoveManager.loveMiniAppId
# 两个人的总匹配度小于60%
friend = friendCollection.findOne({ space: spaceId, owner: userId, user_b: <NAME>, mini_app_id: loveMiniAppId })
if not friend
# console.log 'not friend'
return
if friend.match >= 0.6
# console.log 'friend.match >= 0.6'
return
# 互相不满足筛选条件
lookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: userId })
if lookingFor
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: spaceId, owner: friendId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
if loveAboutMeCollection.find(query).count()
# console.log 'loveAboutMe match lookingFor'
return
else
# console.log 'no lookingFor'
return
friendLookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: friendId })
if friendLookingFor
gender = friendLookingFor.sex
ageMin = friendLookingFor.age
ageMax = friendLookingFor.age_max
heightMin = friendLookingFor.height
heightMax = friendLookingFor.height_max
query = { space: spaceId, owner: userId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
if loveAboutMeCollection.find(query).count()
# console.log 'loveAboutMe match friendLookingFor'
return
else
# console.log 'no friendLookingFor'
return
# 两个人都喜欢男生/女生
if (lookingFor.sex isnt friendLookingFor.sex) or not lookingFor.sex or not friendLookingFor.sex
# console.log 'not both like male/female'
return
# 获取题目字段key
answerKeyObj = {}
dv = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
dv[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
customer = vipCustomersCollection.findOne({ space: spaceId, owner: userId }, { fields: { questionnaire_progess: 1 } })
friendCustomer = vipCustomersCollection.findOne({ space: spaceId, owner: friendId }, { fields: { questionnaire_progess: 1 } })
questionnaireProgess = customer.questionnaire_progess || []
friendQuestionnaireProgess = friendCustomer.questionnaire_progess || []
# console.log 'questionnaireProgess: ', questionnaireProgess
# console.log 'friendQuestionnaireProgess: ', friendQuestionnaireProgess
# 计算分子、分母
score = 0
questionsNumber = 0
LoveManager.answerObjectNames.forEach (objName) ->
if questionnaireProgess.includes(objName) and friendQuestionnaireProgess.includes(objName)
console.log 'objName: ', objName
bAnswer = Creator.getCollection(objName).findOne({ space: spaceId, owner: friendId })
if dv[objName] and bAnswer # 当两人都做了同一套问卷时计算分数
r = LoveManager.getLoveEnemyScore(answerKeyObj[objName], dv[objName], bAnswer)
# console.log r
score += r.score
questionsNumber += r.questionsNumber
return score/questionsNumber || 0
LoveManager.getLoveEnemyScore = (questionKeys, aAnswer, bAnswer) ->
score = 0
questionsNumber = 0
questionKeys.forEach (ak) ->
akI = ak+'_i'
akO = ak+'_o'
if aAnswer[akI] > -1 and bAnswer[akI] > -1
# console.log 'aAnswer[akO]: '
# console.log aAnswer[akO]
# console.log 'bAnswer[akO]: '
# console.log bAnswer[akO]
# console.log '--------------------------------------'
questionsNumber++
if aAnswer[akO].toString() is bAnswer[akO].toString()
score += 1
else
common = _.intersection aAnswer[akO], bAnswer[akO]
score += common.length/aAnswer[akO].length
return { score: score, questionsNumber: questionsNumber }
LoveManager.caculateOneToOneScore = (userId, userB, spaceId) ->
customQuery = { space: spaceId, owner: userB, $or: [] }
customCollection = Creator.getCollection('vip_customers')
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userB })
customQuery.$or.push { questionnaire_progess: objName }
unless customCollection.find(customQuery).count()
return
return LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
LoveManager.caculateScore = (aAnswers, bAnswers, answerKeyObj) ->
# 计算分子、分母
aFullPoints = 0
bGotPoints = 0
bFullPoints = 0
aGotPoints = 0
questionsNumber = 0
_.each answerKeyObj, (keys, objName) ->
if aAnswers[objName] and bAnswers[objName] # 当两人都做了同一套问卷时计算分数
r = LoveManager.getMatchScores(keys, aAnswers[objName], bAnswers[objName])
aFullPoints += r.aFullPoints
bGotPoints += r.bGotPoints
bFullPoints += r.bFullPoints
aGotPoints += r.aGotPoints
questionsNumber += r.questionsNumber
# 共同答题少于5题不计算匹配度。#703
if questionsNumber >= 5
a_to_b = bGotPoints/aFullPoints || 0
b_to_a = aGotPoints/bFullPoints || 0
match = Math.pow(a_to_b*b_to_a, 1/2)
else
a_to_b = b_to_a = match = 0
return { a_to_b, b_to_a, match }
| true | LoveManager = {
answerObjectNames: ['love_answer','love_answer2','love_test']
loveMiniAppId: 'wx033a2ed30bf98cc2'
}
LoveManager.caculateResult = (loveSpaceId, userIds) ->
check loveSpaceId, String
console.time 'caculateScore'
topNumber = 10
loveMiniAppId = LoveManager.loveMiniAppId
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveAnswerCollection = Creator.getCollection('love_answer')
loveAnswer2Collection = Creator.getCollection('love_answer2')
loveResultCollection = Creator.getCollection('love_result')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveHobbyCollection = Creator.getCollection('love_hobby')
loveEducationalExperienceCollection = Creator.getCollection('love_educational_experience')
loveWorkExperienceCollection = Creator.getCollection('love_work_experience')
loveRecommendHistoryCollection = Creator.getCollection('love_recommend_history')
loveFriendsCollection = Creator.getCollection('love_friends')
loveTestCollection = Creator.getCollection('love_test')
# 数据加载到内存
data = {}
customQuery = { space: loveSpaceId, $or: [] }
LoveManager.answerObjectNames.forEach (objName) ->
customQuery.$or.push { questionnaire_progess: objName }
# 双方必须已经填写手机号才能计算推荐
customQuery.mobile = { $exists: true }
console.log customQuery
Creator.getCollection('vip_customers').find(customQuery).forEach (cust)->
owner = cust.owner
data[owner] = {
love_about_me: loveAboutMeCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer: loveAnswerCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer2: loveAnswer2Collection.findOne({ space: loveSpaceId, owner: owner })
love_test: loveTestCollection.findOne({ space: loveSpaceId, owner: owner })
love_result: loveResultCollection.findOne({ space: loveSpaceId, userA: owner }, { fields: { _id: 1 } })
love_looking_for: loveLookingForCollection.findOne({ space: loveSpaceId, owner: owner })
# love_hobby: loveHobbyCollection.findOne({ space: loveSpaceId, owner: owner })
# love_educational_experience: loveEducationalExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
# love_work_experience: loveWorkExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_recommend_history: loveRecommendHistoryCollection.find({ space: loveSpaceId, user_a: owner }).fetch()
}
# 获取题目字段key
answerKeyObj = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
_.each data, (dv, userId) ->
if userIds and not userIds.includes(userId)
return
lookingFor = dv['love_looking_for']
if not lookingFor
return
loveAboutMe = dv['love_about_me']
if not loveAboutMe
return
resultMe = dv['love_result']
scoreA_B = []
scoreB_A = []
score = []
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: loveSpaceId, owner: { $ne: userId } }
query.sex = gender
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
query.height = { $gte: heightMin, $lte: heightMax }
# console.log 'query: ', query
loveAboutMeCollection.find(query, { fields: { owner: 1, name: 1 } }).fetch().forEach (aboutMe) ->
if not data[aboutMe.owner]
return
aboutMeLookingFor = data[aboutMe.owner]['love_looking_for']
if not aboutMeLookingFor
return
if loveAboutMe.sex isnt aboutMeLookingFor.sex or loveAboutMe.age < parseInt(aboutMeLookingFor.age) or loveAboutMe.age > parseInt(aboutMeLookingFor.age_max) or loveAboutMe.height < aboutMeLookingFor.height or loveAboutMe.height > aboutMeLookingFor.height_max
return
lrh = _.find data[userId]['love_recommend_history'], (h) ->
return h.user_b is aboutMe.owner
if lrh
return
# 好友(love_friends)不在计算范围内
if loveFriendsCollection.find({ space: loveSpaceId, owner: userId, user_b: aboutMe.owner, mini_app_id: loveMiniAppId }).count() > 0
return
# console.log userId + '>>' + aboutMe.owner
owner = aboutMe.owner
name = aboutMe.name
r = LoveManager.caculateScore(dv, data[owner], answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
if scoreA_B.length < topNumber
scoreA_B.push({userB: owner, BName: name, score: aToB})
else
i = 0
while i < scoreA_B.length
if scoreA_B[i].score < aToB
scoreA_B[i] = {userB: owner, BName: name, score: aToB}
break
i++
if scoreB_A.length < topNumber
scoreB_A.push({userB: owner, BName: name, score: bToA})
else
i = 0
while i<scoreB_A.length
if scoreB_A[i].score < bToA
scoreB_A[i] = {userB: owner, BName: name, score: bToA}
break
i++
# 互相匹配超过60%才算入匹配结果
if match > 0.6
if score.length < topNumber
score.push({userB: owner, BName: name, score: match})
else
i = 0
while i<score.length
if score[i].score < match
score[i] = {userB: owner, BName: name, score: match}
break
i++
if scoreA_B.length > 0 or scoreB_A.length > 0 or score.length > 0
if resultMe
loveResultCollection.update(resultMe._id,{$set:{
scoreA_B: scoreA_B
scoreB_A: scoreB_A
score: score
}})
else
loveResultCollection.insert({
userA: userId
scoreA_B: scoreA_B
scoreB_A: scoreB_A
score: score
owner: userId
space: loveSpaceId
})
console.timeEnd 'caculateScore'
return
LoveManager.getQuestionKeys = (objectName) ->
keys = []
_.each Creator.Objects[objectName].fields, (v, k) ->
if k.endsWith('_o') or k.endsWith('_i')
return
else
keys.push k
return keys
LoveManager.getMatchScores = (questionKeys, aAnswer, bAnswer) ->
importP = 5
normalP = 1
aFullPoints = 0
bGotPoints = 0
bFullPoints = 0
aGotPoints = 0
questionsNumber = 0
questionKeys.forEach (ak) ->
akI = ak+'_i'
akO = ak+'_o'
if aAnswer[akI] > -1 and bAnswer[akI] > -1
questionsNumber++
if aAnswer[akI] is 0
aFullPoints += normalP
bGotPoints += normalP
else if aAnswer[akI] is 1
aFullPoints += normalP
if aAnswer[akO] and aAnswer[akO].includes(bAnswer[ak])
bGotPoints += normalP
else if aAnswer[akI] is 2
aFullPoints += importP
if aAnswer[akO] and aAnswer[akO].includes(bAnswer[ak])
bGotPoints += importP
if bAnswer[akI] is 0
bFullPoints += normalP
aGotPoints += normalP
else if bAnswer[akI] is 1
bFullPoints += normalP
if bAnswer[akO] and bAnswer[akO].includes(aAnswer[ak])
aGotPoints += normalP
else if bAnswer[akI] is 2
bFullPoints += importP
if bAnswer[akO] and bAnswer[akO].includes(aAnswer[ak])
aGotPoints += importP
return { aFullPoints, bGotPoints, bFullPoints, aGotPoints, questionsNumber }
LoveManager.createResultScoreView = () ->
db = Creator.getCollection('love_result').rawDatabase()
db.createCollection('love_result_score_view', {
viewOn: 'love_result',
pipeline: [{
$unwind: '$score'
}, {
$project: {
userA: "$userA",
userB: "$score.userB",
BName: "$score.BName",
score: "$score.score"
}
}]
}).then((view) ->
LoveManager.resultScoreViewCollection = new Mongo.Collection(view.collectionName)
)
return
LoveManager.caculateRecommend = (spaceId) ->
console.time 'caculateRecommend'
Creator.getCollection('love_recommend').remove({})
newRecommendUserIds = []
limit = 10000
skip = 0
scoreCount = 0
recommendColl = Creator.getCollection('love_recommend')
recommendHistColl = Creator.getCollection('love_recommend_history')
tempScoreResult = []
Meteor.wrapAsync((callback) ->
Creator.getCollection('love_result').rawCollection().aggregate([{ $unwind: '$score' }, { $project: { userA: "$userA", userB: "$score.userB", BName: "$score.BName", score: "$score.score" } }, { $count: 'count' }], (err, data)->
if err
console.error err
return
scoreCount = data[0].count
if callback && _.isFunction(callback)
callback()
return
)
)()
console.log 'scoreCount: ', scoreCount
wrapFunc = Meteor.wrapAsync((callback) ->
console.log 'skip: ', skip
Creator.getCollection('love_result').rawCollection().aggregate([{ $unwind: '$score' }, { $project: { userA: "$userA", userB: "$score.userB", BName: "$score.BName", score: "$score.score" } }, { $sort: { 'score': -1 } }, { $skip: skip }, { $limit: limit }], { allowDiskUse: true }, (err, data)->
if err
console.error err
return
data.forEach (r) ->
tempScoreResult.push r
if callback && _.isFunction(callback)
callback()
return
)
)
while skip < scoreCount
wrapFunc()
tempScoreResult.forEach (r)->
skip++
if newRecommendUserIds.includes(r.userA) or newRecommendUserIds.includes(r.userB)
return
if r.score
user_a = r.userA
user_b = r.userB
score = r.score
if recommendColl.find({ user_a: user_a }).count() > 0 or recommendHistColl.find({ user_a: user_a, user_b: user_b }).count() > 0
return
newRecommendUserIds.push user_a
newRecommendUserIds.push user_b
now = new Date()
recommendColl.insert({
user_a: user_a
user_b: user_b
match: score
recommend_date: now
owner: user_a
space: spaceId
})
recommendHistColl.insert({
user_a: user_a
user_b: user_b
match: score
recommend_date: now
owner: user_a
space: spaceId
})
recommendColl.insert({
user_a: user_b
user_b: user_a
match: score
recommend_date: now
owner: user_b
space: spaceId
})
recommendHistColl.insert({
user_a: user_b
user_b: user_a
match: score
recommend_date: now
owner: user_b
space: spaceId
})
tempScoreResult = []
console.timeEnd 'caculateRecommend'
return
LoveManager.caculateLoveTags = (userId, spaceId, objectName) ->
vipCustomersCollection = Creator.getCollection('vip_customers')
if objectName == "love_test"
loveTestCollection = Creator.getCollection('love_test')
loveTestAnswer = loveTestCollection.findOne({
space: spaceId,
owner: PI:NAME:<NAME>END_PI
}, {
fields: {
education: 1,
body_type: 1,
employed: 1,
disgust_smoke: 1,
pet: 1,
messy: 1,
previous_picture: 1 ,
parents_influence: 1 ,
finance_budget: 1 ,
communicate: 1
}
})
tags = []
unless loveTestAnswer
return;
if loveTestAnswer.education
education = loveTestAnswer.education
if education != "高中及以下"
tags.push "#{education}学历"
if loveTestAnswer.body_type
tags.push "#{loveTestAnswer.body_type}身材"
if loveTestAnswer.employed
tags.push "#{loveTestAnswer.employed}"
if loveTestAnswer.disgust_smoke and loveTestAnswer.disgust_smoke == "是"
tags.push "不吸烟"
if loveTestAnswer.pet and loveTestAnswer.pet == "会"
tags.push "超爱宠物"
if (loveTestAnswer.pet and loveTestAnswer.pet == "不会") or (loveTestAnswer.messy and loveTestAnswer.messy == "介意")
tags.push "爱干净"
if loveTestAnswer.previous_picture and loveTestAnswer.previous_picture == "会"
tags.push "占有欲强"
else if loveTestAnswer.previous_picture and loveTestAnswer.previous_picture == "不会"
tags.push "宽容"
if loveTestAnswer.parents_influence and loveTestAnswer.parents_influence == "我自己做主"
tags.push "独立"
else if loveTestAnswer.parents_influence and "我通常会听父母的,完全听父母的".split(",").indexOf(loveTestAnswer.parents_influence) > -1
tags.push "乖宝宝"
if loveTestAnswer.finance_budget and loveTestAnswer.finance_budget == "会"
tags.push "未来的有钱人"
if loveTestAnswer.communicate and loveTestAnswer.communicate == "是的,雷打不动"
tags.push "粘人"
vipCustomersCollection.update({
space: spaceId,
owner: userId
}, {
$set: {
love_test_tags: tags
}
})
LoveManager.caculateFriendsScore = (userId, spaceId, rest, matchingFilterEnable) ->
customQuery = { space: spaceId, owner: {}, $or: [] }
vipCustomersCollection = Creator.getCollection('vip_customers')
loveFriendsCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
query = { space: spaceId, owner: userId, mini_app_id: loveMiniAppId }
if rest
query.match = { $exists: false }
friendsIds = _.pluck(loveFriendsCollection.find(query, { fields: { user_b: 1 } }).fetch(), 'user_b')
customQuery.owner = { $in: friendsIds }
vipCustomersCollection.find(customQuery).forEach (cust) ->
try
userB = cust.owner
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userB })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: userB, mini_app_id: loveMiniAppId }, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
loveFriendsCollection.update({ space: spaceId, owner: userB, user_b: userId, mini_app_id: loveMiniAppId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
if matchingFilterEnable
LoveManager.caculateFriendsIsLookingFor(userId, spaceId)
LoveManager.caculateFriendsIsLookingFor(userId, spaceId)
return
# 缘分榜加筛选条件功能,每次刷新调用answered接口应该计算is_looking_for属性值并保存 #572
LoveManager.caculateFriendsIsLookingFor = (userId, spaceId) ->
customQuery = { space: spaceId, owner: {}, $or: [] }
now = new Date()
loveFriendsCollection = Creator.getCollection('love_friends')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveAboutMeCollection = Creator.getCollection('love_about_me')
vipCustomersCollection = Creator.getCollection('vip_customers')
loveMiniAppId = LoveManager.loveMiniAppId
LoveManager.answerObjectNames.forEach (objName) ->
customQuery.$or.push { questionnaire_progess: objName }
customer = vipCustomersCollection.findOne({ space: spaceId, owner: userId }, { fields: { matching_filter_caculate_time: 1 } })
matchingFilterCaculateTime = customer.matching_filter_caculate_time || 0
lookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: userId })
if lookingFor
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: spaceId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
unless query
return
friendsIds = _.pluck(loveFriendsCollection.find({ space: spaceId, owner: userId, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
customQuery.owner = { $in: friendsIds }
customersIds = _.pluck(vipCustomersCollection.find(customQuery, { fields: { owner: 1 } }).fetch(), 'owner')
query.owner = { $in: customersIds }
if matchingFilterCaculateTime >= lookingFor.modified
query.modified = { $gte: matchingFilterCaculateTime }
modifiedQuery = _.pick(query, 'space', 'owner', 'modified')
filterIds = _.pluck(loveAboutMeCollection.find(query, { fields: { owner: 1 } }).fetch(), 'owner')
modifiedIds = _.pluck(loveAboutMeCollection.find(modifiedQuery, { fields: { owner: 1 } }).fetch(), 'owner')
restIds = _.difference modifiedIds, filterIds
if filterIds.length > 0
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: { $in: filterIds }, mini_app_id: loveMiniAppId }, { $set: { is_looking_for: true } }, { multi: true })
if restIds.length > 0
loveFriendsCollection.update({ space: spaceId, owner: userId, user_b: { $in: restIds }, mini_app_id: loveMiniAppId }, { $set: { is_looking_for: false } }, { multi: true })
vipCustomersCollection.update({ space: spaceId, owner: userId }, { $set: { matching_filter_caculate_time: now } })
return
# 摇一摇:计算与好友的好友匹配 #609
LoveManager.caculateShakeFriendsScore = (userId, spaceId) ->
customQuery = { space: spaceId, $or: [] }
customCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveAnswerCollection = Creator.getCollection('love_answer')
loveAnswer2Collection = Creator.getCollection('love_answer2')
loveResultCollection = Creator.getCollection('love_result')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveHobbyCollection = Creator.getCollection('love_hobby')
loveEducationalExperienceCollection = Creator.getCollection('love_educational_experience')
loveWorkExperienceCollection = Creator.getCollection('love_work_experience')
loveRecommendHistoryCollection = Creator.getCollection('love_recommend_history')
loveTestCollection = Creator.getCollection('love_test')
# 数据加载到内存
data = {}
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
customCollection.find(customQuery).forEach (cust)->
owner = cust.owner
data[owner] = {
love_about_me: loveAboutMeCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer: loveAnswerCollection.findOne({ space: loveSpaceId, owner: owner })
love_answer2: loveAnswer2Collection.findOne({ space: loveSpaceId, owner: owner })
love_test: loveTestCollection.findOne({ space: loveSpaceId, owner: owner })
love_result: loveResultCollection.findOne({ space: loveSpaceId, userA: owner }, { fields: { _id: 1 } })
love_looking_for: loveLookingForCollection.findOne({ space: loveSpaceId, owner: owner })
love_hobby: loveHobbyCollection.findOne({ space: loveSpaceId, owner: owner })
love_educational_experience: loveEducationalExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_work_experience: loveWorkExperienceCollection.findOne({ space: loveSpaceId, owner: owner })
love_recommend_history: loveRecommendHistoryCollection.find({ space: loveSpaceId, user_a: owner }).fetch()
}
# 我的好友
bIds = _.pluck(friendCollection.find({ space: spaceId, owner: userId, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
# 我的好友的好友
bFriendsIds = _.uniq _.pluck(friendCollection.find({ space: spaceId, owner: { $in: bIds }, user_b: { $ne: userId }, mini_app_id: loveMiniAppId }, { fields: { user_b: 1 } }).fetch(), 'user_b')
bFriendsIds.forEach (lf) ->
try
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: lf.user_b })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
aToB = r.a_to_b
bToA = r.b_to_a
match = r.match
friendCollection.update(lf._id, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: userId, mini_app_id: loveMiniAppId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
return
LoveManager.caculateFriendsOfFriendScore = (userId, friendId, spaceId) ->
customQuery = { space: spaceId, owner: '', $or: [] }
customCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveMiniAppId = LoveManager.loveMiniAppId
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
query = { space: spaceId, owner: friendId, mini_app_id: loveMiniAppId }
friendCollection.find(query).forEach (lf) ->
try
customQuery.owner = lf.user_b
unless customCollection.find(customQuery).count()
friendCollection.update(lf._id, { $unset: { a_to_b: 1, b_to_a: 1, match: 1 } })
friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: friendId, mini_app_id: loveMiniAppId }, { $unset: { a_to_b: 1, b_to_a: 1, match: 1 } })
return
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: lf.user_b })
r = LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
# beenFriend =
# friendCollection.update(lf._id, { $set: { a_to_b: aToB, b_to_a: bToA, match: match } })
# friendCollection.update({ space: spaceId, owner: lf.user_b, user_b: userId }, { $set: { a_to_b: bToA, b_to_a: aToB, match: match } })
catch e
console.error e.stack
return
### 计算情敌指数 #594
前提:
在friends范围内
两个人的总匹配度小于60%,且互相不满足筛选条件
两个人都喜欢男生/女生
###
LoveManager.caculateLoveEnemyScore = (userId, friendId, spaceId) ->
customQuery = { space: spaceId, owner: '', $or: [] }
vipCustomersCollection = Creator.getCollection('vip_customers')
friendCollection = Creator.getCollection('love_friends')
loveLookingForCollection = Creator.getCollection('love_looking_for')
loveAboutMeCollection = Creator.getCollection('love_about_me')
loveMiniAppId = LoveManager.loveMiniAppId
# 两个人的总匹配度小于60%
friend = friendCollection.findOne({ space: spaceId, owner: userId, user_b: PI:NAME:<NAME>END_PI, mini_app_id: loveMiniAppId })
if not friend
# console.log 'not friend'
return
if friend.match >= 0.6
# console.log 'friend.match >= 0.6'
return
# 互相不满足筛选条件
lookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: userId })
if lookingFor
gender = lookingFor.sex
ageMin = lookingFor.age
ageMax = lookingFor.age_max
heightMin = lookingFor.height
heightMax = lookingFor.height_max
query = { space: spaceId, owner: friendId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
if loveAboutMeCollection.find(query).count()
# console.log 'loveAboutMe match lookingFor'
return
else
# console.log 'no lookingFor'
return
friendLookingFor = loveLookingForCollection.findOne({ space: spaceId, owner: friendId })
if friendLookingFor
gender = friendLookingFor.sex
ageMin = friendLookingFor.age
ageMax = friendLookingFor.age_max
heightMin = friendLookingFor.height
heightMax = friendLookingFor.height_max
query = { space: spaceId, owner: userId }
if gender
query.sex = gender
if ageMin and ageMax
query.age = { $gte: parseInt(ageMin), $lte: parseInt(ageMax) }
if heightMin and heightMax
query.height = { $gte: heightMin, $lte: heightMax }
if loveAboutMeCollection.find(query).count()
# console.log 'loveAboutMe match friendLookingFor'
return
else
# console.log 'no friendLookingFor'
return
# 两个人都喜欢男生/女生
if (lookingFor.sex isnt friendLookingFor.sex) or not lookingFor.sex or not friendLookingFor.sex
# console.log 'not both like male/female'
return
# 获取题目字段key
answerKeyObj = {}
dv = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
dv[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
customQuery.$or.push { questionnaire_progess: objName }
customer = vipCustomersCollection.findOne({ space: spaceId, owner: userId }, { fields: { questionnaire_progess: 1 } })
friendCustomer = vipCustomersCollection.findOne({ space: spaceId, owner: friendId }, { fields: { questionnaire_progess: 1 } })
questionnaireProgess = customer.questionnaire_progess || []
friendQuestionnaireProgess = friendCustomer.questionnaire_progess || []
# console.log 'questionnaireProgess: ', questionnaireProgess
# console.log 'friendQuestionnaireProgess: ', friendQuestionnaireProgess
# 计算分子、分母
score = 0
questionsNumber = 0
LoveManager.answerObjectNames.forEach (objName) ->
if questionnaireProgess.includes(objName) and friendQuestionnaireProgess.includes(objName)
console.log 'objName: ', objName
bAnswer = Creator.getCollection(objName).findOne({ space: spaceId, owner: friendId })
if dv[objName] and bAnswer # 当两人都做了同一套问卷时计算分数
r = LoveManager.getLoveEnemyScore(answerKeyObj[objName], dv[objName], bAnswer)
# console.log r
score += r.score
questionsNumber += r.questionsNumber
return score/questionsNumber || 0
LoveManager.getLoveEnemyScore = (questionKeys, aAnswer, bAnswer) ->
score = 0
questionsNumber = 0
questionKeys.forEach (ak) ->
akI = ak+'_i'
akO = ak+'_o'
if aAnswer[akI] > -1 and bAnswer[akI] > -1
# console.log 'aAnswer[akO]: '
# console.log aAnswer[akO]
# console.log 'bAnswer[akO]: '
# console.log bAnswer[akO]
# console.log '--------------------------------------'
questionsNumber++
if aAnswer[akO].toString() is bAnswer[akO].toString()
score += 1
else
common = _.intersection aAnswer[akO], bAnswer[akO]
score += common.length/aAnswer[akO].length
return { score: score, questionsNumber: questionsNumber }
LoveManager.caculateOneToOneScore = (userId, userB, spaceId) ->
customQuery = { space: spaceId, owner: userB, $or: [] }
customCollection = Creator.getCollection('vip_customers')
# 获取题目字段key
answerKeyObj = {}
aAnswers = {}
bAnswers = {}
LoveManager.answerObjectNames.forEach (objName) ->
answerKeyObj[objName] = LoveManager.getQuestionKeys(objName)
aAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userId })
bAnswers[objName] = Creator.getCollection(objName).findOne({ space: spaceId, owner: userB })
customQuery.$or.push { questionnaire_progess: objName }
unless customCollection.find(customQuery).count()
return
return LoveManager.caculateScore(aAnswers, bAnswers, answerKeyObj)
LoveManager.caculateScore = (aAnswers, bAnswers, answerKeyObj) ->
# 计算分子、分母
aFullPoints = 0
bGotPoints = 0
bFullPoints = 0
aGotPoints = 0
questionsNumber = 0
_.each answerKeyObj, (keys, objName) ->
if aAnswers[objName] and bAnswers[objName] # 当两人都做了同一套问卷时计算分数
r = LoveManager.getMatchScores(keys, aAnswers[objName], bAnswers[objName])
aFullPoints += r.aFullPoints
bGotPoints += r.bGotPoints
bFullPoints += r.bFullPoints
aGotPoints += r.aGotPoints
questionsNumber += r.questionsNumber
# 共同答题少于5题不计算匹配度。#703
if questionsNumber >= 5
a_to_b = bGotPoints/aFullPoints || 0
b_to_a = aGotPoints/bFullPoints || 0
match = Math.pow(a_to_b*b_to_a, 1/2)
else
a_to_b = b_to_a = match = 0
return { a_to_b, b_to_a, match }
|
[
{
"context": "###\n * @author \t\tAbdelhakim RAFIK\n * @version \tv1.0.1\n * @license \tMIT License\n * @",
"end": 33,
"score": 0.9998911619186401,
"start": 17,
"tag": "NAME",
"value": "Abdelhakim RAFIK"
},
{
"context": "nse \tMIT License\n * @copyright \tCopyright (c) 2021 Abdelhaki... | src/database/seeders/manufactures/tags.coffee | AbdelhakimRafik/Project | 1 | ###
* @author Abdelhakim RAFIK
* @version v1.0.1
* @license MIT License
* @copyright Copyright (c) 2021 Abdelhakim RAFIK
* @date June 2021
###
faker = require 'faker'
###
Create tags demo data
###
module.exports = (number) ->
# demo data container
demoData = []
# create articles for each user
for i in [0..number-1]
demoData.push
name: faker.lorem.words 3
status: true
createdAt: createdDate = faker.date.between new Date('01-01-2000'), new Date()
updatedAt: faker.date.future 1, createdDate
# return generated data
return demoData | 139903 | ###
* @author <NAME>
* @version v1.0.1
* @license MIT License
* @copyright Copyright (c) 2021 <NAME>
* @date June 2021
###
faker = require 'faker'
###
Create tags demo data
###
module.exports = (number) ->
# demo data container
demoData = []
# create articles for each user
for i in [0..number-1]
demoData.push
name: faker.lorem.words 3
status: true
createdAt: createdDate = faker.date.between new Date('01-01-2000'), new Date()
updatedAt: faker.date.future 1, createdDate
# return generated data
return demoData | true | ###
* @author PI:NAME:<NAME>END_PI
* @version v1.0.1
* @license MIT License
* @copyright Copyright (c) 2021 PI:NAME:<NAME>END_PI
* @date June 2021
###
faker = require 'faker'
###
Create tags demo data
###
module.exports = (number) ->
# demo data container
demoData = []
# create articles for each user
for i in [0..number-1]
demoData.push
name: faker.lorem.words 3
status: true
createdAt: createdDate = faker.date.between new Date('01-01-2000'), new Date()
updatedAt: faker.date.future 1, createdDate
# return generated data
return demoData |
[
{
"context": "nId:'0123456789012345678900aa'\n\n validPassword: 'mw123456789!'\n\n validAuthorization:\n provider : \"facebook\"\n",
"end": 228,
"score": 0.9991371631622314,
"start": 217,
"tag": "PASSWORD",
"value": "mw123456789"
},
{
"context": " 'tesrt'\n providerType : \"X... | test/support/fixtures.coffee | codedoctor/hapi-routes-users-authorizations | 1 |
module.exports =
clientId: '01234567890123456789000a'
_tenantId: '01234567890123456789000b'
invalidUserId: '0123456789012345678900aa'
invalidAuthorizationId:'0123456789012345678900aa'
validPassword: 'mw123456789!'
validAuthorization:
provider : "facebook"
key : "this is a long key"
v1 : "01234"
v2 : "56789"
profile:
id: 'thisistheid'
x : 'tesrt'
providerType : "XXX"
username : "test"
displayName : "Test User"
profileImage : "http://graph.com/me/image.jpg"
user1:
username: 'user1'
password: 'martin12345'
email: "user1@user.com"
name: "user 1"
| 219086 |
module.exports =
clientId: '01234567890123456789000a'
_tenantId: '01234567890123456789000b'
invalidUserId: '0123456789012345678900aa'
invalidAuthorizationId:'0123456789012345678900aa'
validPassword: '<PASSWORD>!'
validAuthorization:
provider : "facebook"
key : "this is a long key"
v1 : "01234"
v2 : "56789"
profile:
id: 'thisistheid'
x : 'tesrt'
providerType : "XXX"
username : "test"
displayName : "<NAME> User"
profileImage : "http://graph.com/me/image.jpg"
user1:
username: 'user1'
password: '<PASSWORD>'
email: "<EMAIL>"
name: "user 1"
| true |
module.exports =
clientId: '01234567890123456789000a'
_tenantId: '01234567890123456789000b'
invalidUserId: '0123456789012345678900aa'
invalidAuthorizationId:'0123456789012345678900aa'
validPassword: 'PI:PASSWORD:<PASSWORD>END_PI!'
validAuthorization:
provider : "facebook"
key : "this is a long key"
v1 : "01234"
v2 : "56789"
profile:
id: 'thisistheid'
x : 'tesrt'
providerType : "XXX"
username : "test"
displayName : "PI:NAME:<NAME>END_PI User"
profileImage : "http://graph.com/me/image.jpg"
user1:
username: 'user1'
password: 'PI:PASSWORD:<PASSWORD>END_PI'
email: "PI:EMAIL:<EMAIL>END_PI"
name: "user 1"
|
[
{
"context": "method. Should return an object like { username: 'username', balance: balanceInSatoshis }\"))\n\n updateBalanc",
"end": 3767,
"score": 0.9967118501663208,
"start": 3759,
"tag": "USERNAME",
"value": "username"
},
{
"context": " =>\n @setBalance(p.balance)\n @u... | js/martingala.coffee | eromirou/martingala | 0 | class Evented
emit: (eventName, args...) -> $(@).trigger(eventName, args...)
on: (eventName, callback) -> $(@).on(eventName, callback.bind(@))
one: (eventName, callback) -> $(@).one(eventName, callback.bind(@))
window.Martingala = class Martingala extends Evented
@accessor 'multiplier',
set: (v) -> @_multiplier = _.max [ +v, 1.0102 ]
get: -> @_multiplier
@accessor 'initialBet',
set: (v) -> @_initialBet = (+v).toSatoshis()
get: -> @_initialBet?.toBitcoin()
@accessor 'stopLoss',
set: (v) -> @_stopLoss = (+v).toSatoshis()
get: -> @_stopLoss?.toBitcoin()
constructor: (multiplier, initialBet, streakReset, stopLoss, minRolls, @client) ->
@multiplier = multiplier || 2
@initialBet = +initialBet || (100).toBitcoin()
@streakReset = +streakReset || 1
@stopLoss = stopLoss
@minRolls = +minRolls
@updateOdds()
@client.one 'balanceUpdated', @recalcInitialBet.bind(@)
@client.init()
updateOdds: ->
[ @rollBelow, @multiplier ] = @client.calcOdds(@multiplier)
@emit('oddsUpdated')
recalcInitialBet: ->
if @minRolls
minRolls = _.min([ @maxRolls(@client.MINBET)[0], @minRolls ])
@_initialBet = @client.MINBET
@_initialBet += 1 until @maxRolls(@_initialBet + 1)[0] < minRolls
@emit('betRecalculated', @initialBet)
@initialBet
inspect: ->
"Roll below: #{@rollBelow} - Chances: #{+(@rollBelow / @client.MAXROLL * 100).toFixed(3)}%"
run: (@totalBets = 0) ->
@running = true
@symmetricStreak ||= 0
@streak ||= 0
@client.startRound().then(@placeBet.bind(@))
stop: -> @running = false
placeBet: ->
@calculateBet()
if @stopLoss and (@client._balance - @bet) < @_stopLoss
return
if @bet > @client._balance
puts "ERROR! - Insufficient funds!"
return
@client.placebet(@bet, @rollBelow)
.then(@updateStreakCount.bind(@))
.then(=>
@totalBets += @bet
@emit('betPlaced', @client.lastGame.bet)
@prepareNextRound()
return if !@running && @client.lastGameWon()
@placeBet()
).catch((error) =>
puts "ERROR! - #{JSON.stringify error}"
@client.startRound().then(@placeBet.bind(@))
)
calculateBet: ->
@bet = _.max([ @neededBet(@totalBets), @client.MINBET ])
neededBet: (amount, minBet = @_initialBet) ->
#_.max([ Math.ceil( ( amount + minBet ) / ( @multiplier - 1 ) ), minBet ])
_.max([ Math.ceil( amount / ( @multiplier - 1 ) ), minBet ])
updateStreakCount: ->
if @client.lastGameWon()
@streak = 0 if @streak < 0
@streak += 1
else
@streak = 0 if @streak > 0
@streak -= 1
prepareNextRound: ->
if @client.lastGameWon()
@totalBets = if @symmetricStreak >= @streakReset
@recalcInitialBet()
@symmetricStreak = 0
else
@symmetricStreak -= 1 if @symmetricStreak > 0
bets = @totalBets - @bet
lastBet = Math.floor(bets / @multiplier)
_.max([ bets - _.max([ lastBet, @client.MINBET, @_initialBet ]), 0 ])
else
@symmetricStreak += 1
@emit('nextRoundPrepared')
maxRolls: (minBet, balance = @client._balance) ->
count = 0
total = 0
loop
bet = @neededBet(total, minBet)
total += bet
break if total > balance
count += 1
[ count, total ]
window.BaseClient = class BaseClient extends Evented
MINBET: 100
@accessor 'balance',
set: (v) -> @_balance = (+v).toSatoshis()
get: -> @_balance?.toBitcoin()
constructor: (@secret) ->
@balance = 0
init: ->
@updateProfile().then => setInterval(@updateBalance.bind(@), 5000)
getProfile: ->
rej(new Error("Clients should implement #getProfile method. Should return an object like { username: 'username', balance: balanceInSatoshis }"))
updateBalance: (force) ->
diff = Date.now() - ( @lastBalanceAt || 0 )
return r(@balance) unless force || diff >= 3000
@getProfile().then (p) => @setBalance(p.balance)
updateProfile: ->
@getProfile().then (p) =>
@setBalance(p.balance)
@username = p.username
@emit('profileUpdated', p)
p
setBalance: (@_balance) ->
@lastBalanceAt = Date.now()
@emit('balanceUpdated', @balance)
@_balance
lastGameFailed: ->
@lastGameStatus() == 'failed'
lastGameWon: ->
@lastGameStatus() == 'won'
lastGameLost: ->
@lastGameStatus() == 'lost'
calcOdds: (multiplier) ->
kept = 1 - @HOUSEEDGE / 100
rollBelow = Math.floor(@MAXROLL / multiplier * kept)
payout = +(@MAXROLL / rollBelow * kept).toFixed(5)
[ rollBelow, payout ]
window.SatoshiDice = class SatoshiDice extends BaseClient
HOUSEEDGE: 1.9
MAXROLL: 65536.0
getProfile: ->
@call('userbalance').then (res) ->
{ username: res.nick, balance: res.balanceInSatoshis }
startRound: ->
@call('startround').then((@round) =>)
placebet: (bet, rollBelow, clientRoll = 3245, id = @round['id'], serverHash = @round['hash']) ->
@call('placebet', betInSatoshis: bet, id: id, serverHash: serverHash, clientRoll: clientRoll, belowRollToWin: rollBelow)
.then((@lastGame) =>
return rej(@lastGame) if @lastGameFailed()
@setBalance(@lastGame.userBalanceInSatoshis)
@round = @lastGame['nextRound']
@lastGame
)
lastGameStatus: ->
return 'empty' unless @lastGame
return 'failed' if @lastGame['status'] == 'fail'
return 'won' if @lastGame['bet']['result'] == 'win'
'lost'
lastGameProfit: ->
@lastGame?.bet.profitInSatoshis
call: (method, params = { }) ->
jqXHR = $.ajax(
url: "https://session.satoshidice.com/userapi/#{method}"
data: $.extend({ secret: @secret }, params)
dataType: 'jsonp')
r(jqXHR)
window.Primedice = class Primedice extends BaseClient
HOUSEEDGE: 1
MAXROLL: 100.0
getProfile: ->
@call('users/1').then (res) ->
{ username: res.user.username, balance: res.user.balance }
startRound: -> r()
placebet: (bet, rollBelow) ->
@call('bet', { amount: bet, target: rollBelow, condition: '<' }, 'post')
.then((@lastGame) =>
return rej(@lastGame) if @lastGameFailed()
@setBalance(@lastGame.user.balance)
@lastGame
)
lastGameStatus: ->
if @lastGame.bet.win then 'won' else 'lost'
lastGameProfit: ->
@lastGame.bet.profit
calcOdds: (multiplier) ->
kept = 1 - @HOUSEEDGE / 100
rollBelow = (@MAXROLL / multiplier * kept).truncate(2)
payout = (@MAXROLL / rollBelow * kept).truncate(5)
[ rollBelow, payout ]
call: (method, params = { }, verb = 'get') ->
verb = verb.toUpperCase()
proxy = if location.protocol is 'https:'
"https://martingala-proxy.herokuapp.com"
else
"http://localhost:5000"
jqXHR = $.ajax(
type: verb
url: "#{proxy}/primedice/#{method}"
data: $.extend({ access_token: @secret }, params)
)
r(jqXHR)
| 176483 | class Evented
emit: (eventName, args...) -> $(@).trigger(eventName, args...)
on: (eventName, callback) -> $(@).on(eventName, callback.bind(@))
one: (eventName, callback) -> $(@).one(eventName, callback.bind(@))
window.Martingala = class Martingala extends Evented
@accessor 'multiplier',
set: (v) -> @_multiplier = _.max [ +v, 1.0102 ]
get: -> @_multiplier
@accessor 'initialBet',
set: (v) -> @_initialBet = (+v).toSatoshis()
get: -> @_initialBet?.toBitcoin()
@accessor 'stopLoss',
set: (v) -> @_stopLoss = (+v).toSatoshis()
get: -> @_stopLoss?.toBitcoin()
constructor: (multiplier, initialBet, streakReset, stopLoss, minRolls, @client) ->
@multiplier = multiplier || 2
@initialBet = +initialBet || (100).toBitcoin()
@streakReset = +streakReset || 1
@stopLoss = stopLoss
@minRolls = +minRolls
@updateOdds()
@client.one 'balanceUpdated', @recalcInitialBet.bind(@)
@client.init()
updateOdds: ->
[ @rollBelow, @multiplier ] = @client.calcOdds(@multiplier)
@emit('oddsUpdated')
recalcInitialBet: ->
if @minRolls
minRolls = _.min([ @maxRolls(@client.MINBET)[0], @minRolls ])
@_initialBet = @client.MINBET
@_initialBet += 1 until @maxRolls(@_initialBet + 1)[0] < minRolls
@emit('betRecalculated', @initialBet)
@initialBet
inspect: ->
"Roll below: #{@rollBelow} - Chances: #{+(@rollBelow / @client.MAXROLL * 100).toFixed(3)}%"
run: (@totalBets = 0) ->
@running = true
@symmetricStreak ||= 0
@streak ||= 0
@client.startRound().then(@placeBet.bind(@))
stop: -> @running = false
placeBet: ->
@calculateBet()
if @stopLoss and (@client._balance - @bet) < @_stopLoss
return
if @bet > @client._balance
puts "ERROR! - Insufficient funds!"
return
@client.placebet(@bet, @rollBelow)
.then(@updateStreakCount.bind(@))
.then(=>
@totalBets += @bet
@emit('betPlaced', @client.lastGame.bet)
@prepareNextRound()
return if !@running && @client.lastGameWon()
@placeBet()
).catch((error) =>
puts "ERROR! - #{JSON.stringify error}"
@client.startRound().then(@placeBet.bind(@))
)
calculateBet: ->
@bet = _.max([ @neededBet(@totalBets), @client.MINBET ])
neededBet: (amount, minBet = @_initialBet) ->
#_.max([ Math.ceil( ( amount + minBet ) / ( @multiplier - 1 ) ), minBet ])
_.max([ Math.ceil( amount / ( @multiplier - 1 ) ), minBet ])
updateStreakCount: ->
if @client.lastGameWon()
@streak = 0 if @streak < 0
@streak += 1
else
@streak = 0 if @streak > 0
@streak -= 1
prepareNextRound: ->
if @client.lastGameWon()
@totalBets = if @symmetricStreak >= @streakReset
@recalcInitialBet()
@symmetricStreak = 0
else
@symmetricStreak -= 1 if @symmetricStreak > 0
bets = @totalBets - @bet
lastBet = Math.floor(bets / @multiplier)
_.max([ bets - _.max([ lastBet, @client.MINBET, @_initialBet ]), 0 ])
else
@symmetricStreak += 1
@emit('nextRoundPrepared')
maxRolls: (minBet, balance = @client._balance) ->
count = 0
total = 0
loop
bet = @neededBet(total, minBet)
total += bet
break if total > balance
count += 1
[ count, total ]
window.BaseClient = class BaseClient extends Evented
MINBET: 100
@accessor 'balance',
set: (v) -> @_balance = (+v).toSatoshis()
get: -> @_balance?.toBitcoin()
constructor: (@secret) ->
@balance = 0
init: ->
@updateProfile().then => setInterval(@updateBalance.bind(@), 5000)
getProfile: ->
rej(new Error("Clients should implement #getProfile method. Should return an object like { username: 'username', balance: balanceInSatoshis }"))
updateBalance: (force) ->
diff = Date.now() - ( @lastBalanceAt || 0 )
return r(@balance) unless force || diff >= 3000
@getProfile().then (p) => @setBalance(p.balance)
updateProfile: ->
@getProfile().then (p) =>
@setBalance(p.balance)
@username = p.username
@emit('profileUpdated', p)
p
setBalance: (@_balance) ->
@lastBalanceAt = Date.now()
@emit('balanceUpdated', @balance)
@_balance
lastGameFailed: ->
@lastGameStatus() == 'failed'
lastGameWon: ->
@lastGameStatus() == 'won'
lastGameLost: ->
@lastGameStatus() == 'lost'
calcOdds: (multiplier) ->
kept = 1 - @HOUSEEDGE / 100
rollBelow = Math.floor(@MAXROLL / multiplier * kept)
payout = +(@MAXROLL / rollBelow * kept).toFixed(5)
[ rollBelow, payout ]
window.SatoshiDice = class SatoshiDice extends BaseClient
HOUSEEDGE: 1.9
MAXROLL: 65536.0
getProfile: ->
@call('userbalance').then (res) ->
{ username: res.nick, balance: res.balanceInSatoshis }
startRound: ->
@call('startround').then((@round) =>)
placebet: (bet, rollBelow, clientRoll = 3245, id = @round['id'], serverHash = @round['hash']) ->
@call('placebet', betInSatoshis: bet, id: id, serverHash: serverHash, clientRoll: clientRoll, belowRollToWin: rollBelow)
.then((@lastGame) =>
return rej(@lastGame) if @lastGameFailed()
@setBalance(@lastGame.userBalanceInSatoshis)
@round = @lastGame['nextRound']
@lastGame
)
lastGameStatus: ->
return 'empty' unless @lastGame
return 'failed' if @lastGame['status'] == 'fail'
return 'won' if @lastGame['bet']['result'] == 'win'
'lost'
lastGameProfit: ->
@lastGame?.bet.profitInSatoshis
call: (method, params = { }) ->
jqXHR = $.ajax(
url: "https://session.satoshidice.com/userapi/#{method}"
data: $.extend({ secret: @secret }, params)
dataType: 'jsonp')
r(jqXHR)
window.Primedice = class Primedice extends BaseClient
HOUSEEDGE: 1
MAXROLL: 100.0
getProfile: ->
@call('users/1').then (res) ->
{ username: res.user.username, balance: res.user.balance }
startRound: -> r()
placebet: (bet, rollBelow) ->
@call('bet', { amount: bet, target: rollBelow, condition: '<' }, 'post')
.then((@lastGame) =>
return rej(@lastGame) if @lastGameFailed()
@setBalance(@lastGame.user.balance)
@lastGame
)
lastGameStatus: ->
if @lastGame.bet.win then 'won' else 'lost'
lastGameProfit: ->
@lastGame.bet.profit
calcOdds: (multiplier) ->
kept = 1 - @HOUSEEDGE / 100
rollBelow = (@MAXROLL / multiplier * kept).truncate(2)
payout = (@MAXROLL / rollBelow * kept).truncate(5)
[ rollBelow, payout ]
call: (method, params = { }, verb = 'get') ->
verb = verb.toUpperCase()
proxy = if location.protocol is 'https:'
"https://martingala-proxy.herokuapp.com"
else
"http://localhost:5000"
jqXHR = $.ajax(
type: verb
url: "#{proxy}/primedice/#{method}"
data: $.extend({ access_token:<PASSWORD> @secret }, params)
)
r(jqXHR)
| true | class Evented
emit: (eventName, args...) -> $(@).trigger(eventName, args...)
on: (eventName, callback) -> $(@).on(eventName, callback.bind(@))
one: (eventName, callback) -> $(@).one(eventName, callback.bind(@))
window.Martingala = class Martingala extends Evented
@accessor 'multiplier',
set: (v) -> @_multiplier = _.max [ +v, 1.0102 ]
get: -> @_multiplier
@accessor 'initialBet',
set: (v) -> @_initialBet = (+v).toSatoshis()
get: -> @_initialBet?.toBitcoin()
@accessor 'stopLoss',
set: (v) -> @_stopLoss = (+v).toSatoshis()
get: -> @_stopLoss?.toBitcoin()
constructor: (multiplier, initialBet, streakReset, stopLoss, minRolls, @client) ->
@multiplier = multiplier || 2
@initialBet = +initialBet || (100).toBitcoin()
@streakReset = +streakReset || 1
@stopLoss = stopLoss
@minRolls = +minRolls
@updateOdds()
@client.one 'balanceUpdated', @recalcInitialBet.bind(@)
@client.init()
updateOdds: ->
[ @rollBelow, @multiplier ] = @client.calcOdds(@multiplier)
@emit('oddsUpdated')
recalcInitialBet: ->
if @minRolls
minRolls = _.min([ @maxRolls(@client.MINBET)[0], @minRolls ])
@_initialBet = @client.MINBET
@_initialBet += 1 until @maxRolls(@_initialBet + 1)[0] < minRolls
@emit('betRecalculated', @initialBet)
@initialBet
inspect: ->
"Roll below: #{@rollBelow} - Chances: #{+(@rollBelow / @client.MAXROLL * 100).toFixed(3)}%"
run: (@totalBets = 0) ->
@running = true
@symmetricStreak ||= 0
@streak ||= 0
@client.startRound().then(@placeBet.bind(@))
stop: -> @running = false
placeBet: ->
@calculateBet()
if @stopLoss and (@client._balance - @bet) < @_stopLoss
return
if @bet > @client._balance
puts "ERROR! - Insufficient funds!"
return
@client.placebet(@bet, @rollBelow)
.then(@updateStreakCount.bind(@))
.then(=>
@totalBets += @bet
@emit('betPlaced', @client.lastGame.bet)
@prepareNextRound()
return if !@running && @client.lastGameWon()
@placeBet()
).catch((error) =>
puts "ERROR! - #{JSON.stringify error}"
@client.startRound().then(@placeBet.bind(@))
)
calculateBet: ->
@bet = _.max([ @neededBet(@totalBets), @client.MINBET ])
neededBet: (amount, minBet = @_initialBet) ->
#_.max([ Math.ceil( ( amount + minBet ) / ( @multiplier - 1 ) ), minBet ])
_.max([ Math.ceil( amount / ( @multiplier - 1 ) ), minBet ])
updateStreakCount: ->
if @client.lastGameWon()
@streak = 0 if @streak < 0
@streak += 1
else
@streak = 0 if @streak > 0
@streak -= 1
prepareNextRound: ->
if @client.lastGameWon()
@totalBets = if @symmetricStreak >= @streakReset
@recalcInitialBet()
@symmetricStreak = 0
else
@symmetricStreak -= 1 if @symmetricStreak > 0
bets = @totalBets - @bet
lastBet = Math.floor(bets / @multiplier)
_.max([ bets - _.max([ lastBet, @client.MINBET, @_initialBet ]), 0 ])
else
@symmetricStreak += 1
@emit('nextRoundPrepared')
maxRolls: (minBet, balance = @client._balance) ->
count = 0
total = 0
loop
bet = @neededBet(total, minBet)
total += bet
break if total > balance
count += 1
[ count, total ]
window.BaseClient = class BaseClient extends Evented
MINBET: 100
@accessor 'balance',
set: (v) -> @_balance = (+v).toSatoshis()
get: -> @_balance?.toBitcoin()
constructor: (@secret) ->
@balance = 0
init: ->
@updateProfile().then => setInterval(@updateBalance.bind(@), 5000)
getProfile: ->
rej(new Error("Clients should implement #getProfile method. Should return an object like { username: 'username', balance: balanceInSatoshis }"))
updateBalance: (force) ->
diff = Date.now() - ( @lastBalanceAt || 0 )
return r(@balance) unless force || diff >= 3000
@getProfile().then (p) => @setBalance(p.balance)
updateProfile: ->
@getProfile().then (p) =>
@setBalance(p.balance)
@username = p.username
@emit('profileUpdated', p)
p
setBalance: (@_balance) ->
@lastBalanceAt = Date.now()
@emit('balanceUpdated', @balance)
@_balance
lastGameFailed: ->
@lastGameStatus() == 'failed'
lastGameWon: ->
@lastGameStatus() == 'won'
lastGameLost: ->
@lastGameStatus() == 'lost'
calcOdds: (multiplier) ->
kept = 1 - @HOUSEEDGE / 100
rollBelow = Math.floor(@MAXROLL / multiplier * kept)
payout = +(@MAXROLL / rollBelow * kept).toFixed(5)
[ rollBelow, payout ]
window.SatoshiDice = class SatoshiDice extends BaseClient
HOUSEEDGE: 1.9
MAXROLL: 65536.0
getProfile: ->
@call('userbalance').then (res) ->
{ username: res.nick, balance: res.balanceInSatoshis }
startRound: ->
@call('startround').then((@round) =>)
placebet: (bet, rollBelow, clientRoll = 3245, id = @round['id'], serverHash = @round['hash']) ->
@call('placebet', betInSatoshis: bet, id: id, serverHash: serverHash, clientRoll: clientRoll, belowRollToWin: rollBelow)
.then((@lastGame) =>
return rej(@lastGame) if @lastGameFailed()
@setBalance(@lastGame.userBalanceInSatoshis)
@round = @lastGame['nextRound']
@lastGame
)
lastGameStatus: ->
return 'empty' unless @lastGame
return 'failed' if @lastGame['status'] == 'fail'
return 'won' if @lastGame['bet']['result'] == 'win'
'lost'
lastGameProfit: ->
@lastGame?.bet.profitInSatoshis
call: (method, params = { }) ->
jqXHR = $.ajax(
url: "https://session.satoshidice.com/userapi/#{method}"
data: $.extend({ secret: @secret }, params)
dataType: 'jsonp')
r(jqXHR)
window.Primedice = class Primedice extends BaseClient
HOUSEEDGE: 1
MAXROLL: 100.0
getProfile: ->
@call('users/1').then (res) ->
{ username: res.user.username, balance: res.user.balance }
startRound: -> r()
placebet: (bet, rollBelow) ->
@call('bet', { amount: bet, target: rollBelow, condition: '<' }, 'post')
.then((@lastGame) =>
return rej(@lastGame) if @lastGameFailed()
@setBalance(@lastGame.user.balance)
@lastGame
)
lastGameStatus: ->
if @lastGame.bet.win then 'won' else 'lost'
lastGameProfit: ->
@lastGame.bet.profit
calcOdds: (multiplier) ->
kept = 1 - @HOUSEEDGE / 100
rollBelow = (@MAXROLL / multiplier * kept).truncate(2)
payout = (@MAXROLL / rollBelow * kept).truncate(5)
[ rollBelow, payout ]
call: (method, params = { }, verb = 'get') ->
verb = verb.toUpperCase()
proxy = if location.protocol is 'https:'
"https://martingala-proxy.herokuapp.com"
else
"http://localhost:5000"
jqXHR = $.ajax(
type: verb
url: "#{proxy}/primedice/#{method}"
data: $.extend({ access_token:PI:PASSWORD:<PASSWORD>END_PI @secret }, params)
)
r(jqXHR)
|
[
{
"context": "ash\n\t\t\t# Hash of 'testpassword'\n\t\t\t@testPassword = '$2a$12$zhtThy3R5tLtw5sCwr5XD.zhPENGn4ecjeMcP87oYSYrIICFqBpei'\n\n\t\tdescribe \"authenticate\", ->\n\t\t\tbeforeEach ->\n",
"end": 1149,
"score": 0.9995067715644836,
"start": 1088,
"tag": "PASSWORD",
"value": "'$2a$12$... | test/unit/coffee/Authentication/AuthenticationManagerTests.coffee | shyoshyo/web-sharelatex | 1 | sinon = require('sinon')
chai = require('chai')
should = chai.should()
expect = chai.expect
modulePath = "../../../../app/js/Features/Authentication/AuthenticationManager.js"
SandboxedModule = require('sandboxed-module')
events = require "events"
ObjectId = require("mongojs").ObjectId
Errors = require "../../../../app/js/Features/Errors/Errors"
describe "AuthenticationManager", ->
beforeEach ->
@settings = { security: { bcryptRounds: 12 } }
@AuthenticationManager = SandboxedModule.require modulePath, requires:
"../../models/User": User: @User = {}
"../../infrastructure/mongojs":
db: @db =
users: {}
ObjectId: ObjectId
"bcrypt": @bcrypt = {}
"settings-sharelatex": @settings
"../V1/V1Handler": @V1Handler = {}
"../User/UserGetter": @UserGetter = {}
@callback = sinon.stub()
describe "with real bcrypt", ->
beforeEach ->
bcrypt = require('bcrypt')
@bcrypt.compare = bcrypt.compare
@bcrypt.getRounds = bcrypt.getRounds
@bcrypt.genSalt = bcrypt.genSalt
@bcrypt.hash = bcrypt.hash
# Hash of 'testpassword'
@testPassword = '$2a$12$zhtThy3R5tLtw5sCwr5XD.zhPENGn4ecjeMcP87oYSYrIICFqBpei'
describe "authenticate", ->
beforeEach ->
@user =
_id: "user-id"
email: @email = "USER@sharelatex.com"
@User.findOne = sinon.stub().callsArgWith(1, null, @user)
describe "when the hashed password matches", ->
beforeEach (done) ->
@unencryptedPassword = "testpassword"
@user.hashedPassword = @testPassword
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the encrypted passwords do not match", ->
beforeEach ->
@AuthenticationManager.authenticate(email: @email, "notthecorrectpassword", @callback)
it "should not return the user", ->
@callback.calledWith(null, null).should.equal true
describe "setUserPasswordInV2", ->
beforeEach ->
@user =
_id: "5c8791477192a80b5e76ca7e"
email: @email = "USER@sharelatex.com"
@db.users.update = sinon.stub().callsArgWith(2, null, {nModified: 1})
it "should not produce an error", (done) ->
@AuthenticationManager.setUserPasswordInV2 @user._id, "testpassword", (err, updated) =>
expect(err).to.not.exist
expect(updated).to.equal true
done()
it "should set the hashed password", (done) ->
@AuthenticationManager.setUserPasswordInV2 @user._id, "testpassword", (err, updated) =>
expect(err).to.not.exist
hashedPassword = @db.users.update.lastCall.args[1].$set.hashedPassword
expect(hashedPassword).to.exist
expect(hashedPassword.length).to.equal 60
expect(hashedPassword).to.match /^\$2a\$12\$[a-zA-Z0-9\/.]{53}$/
done()
describe "authenticate", ->
describe "when the user exists in the database", ->
beforeEach ->
@user =
_id: "user-id"
email: @email = "USER@sharelatex.com"
@unencryptedPassword = "banana"
@User.findOne = sinon.stub().callsArgWith(1, null, @user)
describe "when the hashed password matches", ->
beforeEach (done) ->
@user.hashedPassword = @hashedPassword = "asdfjadflasdf"
@bcrypt.compare = sinon.stub().callsArgWith(2, null, true)
@bcrypt.getRounds = sinon.stub().returns 12
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should check that the passwords match", ->
@bcrypt.compare
.calledWith(@unencryptedPassword, @hashedPassword)
.should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the encrypted passwords do not match", ->
beforeEach ->
@AuthenticationManager.authenticate(email: @email, @unencryptedPassword, @callback)
it "should not return the user", ->
@callback.calledWith(null, null).should.equal true
describe "when the hashed password matches but the number of rounds is too low", ->
beforeEach (done) ->
@user.hashedPassword = @hashedPassword = "asdfjadflasdf"
@bcrypt.compare = sinon.stub().callsArgWith(2, null, true)
@bcrypt.getRounds = sinon.stub().returns 7
@AuthenticationManager.setUserPassword = sinon.stub().callsArgWith(2, null)
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should check that the passwords match", ->
@bcrypt.compare
.calledWith(@unencryptedPassword, @hashedPassword)
.should.equal true
it "should check the number of rounds", ->
@bcrypt.getRounds.called.should.equal true
it "should set the users password (with a higher number of rounds)", ->
@AuthenticationManager.setUserPassword
.calledWith("user-id", @unencryptedPassword)
.should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the user does not exist in the database", ->
beforeEach ->
@User.findOne = sinon.stub().callsArgWith(1, null, null)
@AuthenticationManager.authenticate(email: @email, @unencrpytedPassword, @callback)
it "should not return a user", ->
@callback.calledWith(null, null).should.equal true
describe "validateEmail", ->
describe "valid", ->
it "should return null", ->
result = @AuthenticationManager.validateEmail 'foo@example.com'
expect(result).to.equal null
describe "invalid", ->
it "should return validation error object for no email", ->
result = @AuthenticationManager.validateEmail ''
expect(result).to.not.equal null
expect(result.message).to.equal 'email not valid'
it "should return validation error object for invalid", ->
result = @AuthenticationManager.validateEmail 'notanemail'
expect(result).to.not.equal null
expect(result.message).to.equal 'email not valid'
describe "validatePassword", ->
beforeEach ->
# 73 characters:
@longPassword = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678'
describe "with a null password", ->
it "should return an error", ->
expect(@AuthenticationManager.validatePassword()).to.eql { message: 'password not set' }
describe "password length", ->
describe "with the default password length options", ->
it "should reject passwords that are too short", ->
expect(@AuthenticationManager.validatePassword('')).to.eql { message: 'password is too short' }
expect(@AuthenticationManager.validatePassword('foo')).to.eql { message: 'password is too short' }
it "should reject passwords that are too long", ->
expect(@AuthenticationManager.validatePassword(@longPassword)).to.eql { message: 'password is too long' }
it "should accept passwords that are a good length", ->
expect(@AuthenticationManager.validatePassword('l337h4x0r')).to.equal null
describe "when the password length is specified in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
min: 10
max: 12
it "should reject passwords that are too short", ->
expect(@AuthenticationManager.validatePassword('012345678')).to.eql { message: 'password is too short' }
it "should accept passwords of exactly minimum length", ->
expect(@AuthenticationManager.validatePassword('0123456789')).to.equal null
it "should reject passwords that are too long", ->
expect(@AuthenticationManager.validatePassword('0123456789abc')).to.eql { message: 'password is too long' }
it "should accept passwords of exactly maximum length", ->
expect(@AuthenticationManager.validatePassword('0123456789ab')).to.equal null
describe "when the maximum password length is set to >72 characters in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max: 128
it "should still reject passwords > 72 characters in length", ->
expect(@AuthenticationManager.validatePassword(@longPassword)).to.eql { message: 'password is too long' }
describe "allowed characters", ->
describe "with the default settings for allowed characters", ->
it "should allow passwords with valid characters", ->
expect(@AuthenticationManager.validatePassword("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")).to.equal null
expect(@AuthenticationManager.validatePassword("1234567890@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.equal null
it "should not allow passwords with invalid characters", ->
expect(@AuthenticationManager.validatePassword("correct horse battery staple")).to.eql { message: 'password contains an invalid character' }
describe "when valid characters are overridden in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
chars:
symbols: " "
it "should allow passwords with valid characters", ->
expect(@AuthenticationManager.validatePassword("correct horse battery staple")).to.equal null
it "should disallow passwords with invalid characters", ->
expect(@AuthenticationManager.validatePassword("1234567890@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.eql { message: 'password contains an invalid character' }
describe "when allowAnyChars is set", ->
beforeEach ->
@settings.passwordStrengthOptions =
allowAnyChars: true
it "should allow any characters", ->
expect(@AuthenticationManager.validatePassword("correct horse battery staple")).to.equal null
expect(@AuthenticationManager.validatePassword("1234567890@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.equal null
describe "setUserPassword", ->
beforeEach ->
@user_id = ObjectId()
@password = "banana"
@hashedPassword = "asdkjfa;osiuvandf"
@salt = "saltaasdfasdfasdf"
@bcrypt.genSalt = sinon.stub().callsArgWith(1, null, @salt)
@bcrypt.hash = sinon.stub().callsArgWith(2, null, @hashedPassword)
@db.users.update = sinon.stub().callsArg(2)
describe "too long", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max:10
@password = "dsdsadsadsadsadsadkjsadjsadjsadljs"
it "should return and error", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)->
expect(err).to.exist
done()
it "should not start the bcrypt process", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)=>
@bcrypt.genSalt.called.should.equal false
@bcrypt.hash.called.should.equal false
done()
describe "too short", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max:10
min:6
@password = "dsd"
it "should return and error", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)->
expect(err).to.exist
done()
it "should not start the bcrypt process", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)=>
@bcrypt.genSalt.called.should.equal false
@bcrypt.hash.called.should.equal false
done()
describe "password set attempt", ->
describe "with SL user in SL", ->
beforeEach ->
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: null })
@AuthenticationManager.setUserPassword(@user_id, @password, @callback)
it 'should look up the user', ->
@UserGetter.getUser.calledWith(@user_id).should.equal true
it "should update the user's password in the database", ->
args = @db.users.update.lastCall.args
expect(args[0]).to.deep.equal {_id: ObjectId(@user_id.toString())}
expect(args[1]).to.deep.equal {
$set: {
"hashedPassword": @hashedPassword
}
$unset: password: true
}
it "should hash the password", ->
@bcrypt.genSalt
.calledWith(12)
.should.equal true
@bcrypt.hash
.calledWith(@password, @salt)
.should.equal true
it "should call the callback", ->
@callback.called.should.equal true
describe "with SL user in v2", ->
beforeEach (done) ->
@settings.overleaf = true
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: null })
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should error", ->
@callback.calledWith(new Errors.SLInV2Error("Password Reset Attempt")).should.equal true
describe "with v2 user in SL", ->
beforeEach (done) ->
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: {id: 1} })
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should error", ->
@callback.calledWith(new Errors.NotInV2Error("Password Reset Attempt")).should.equal true
describe "with v2 user in v2", ->
beforeEach (done) ->
@settings.overleaf = true
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: {id: 1} })
@V1Handler.doPasswordReset = sinon.stub().yields(null, true)
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should set the password in v2", ->
@callback.calledWith(null, true).should.equal true
| 37007 | sinon = require('sinon')
chai = require('chai')
should = chai.should()
expect = chai.expect
modulePath = "../../../../app/js/Features/Authentication/AuthenticationManager.js"
SandboxedModule = require('sandboxed-module')
events = require "events"
ObjectId = require("mongojs").ObjectId
Errors = require "../../../../app/js/Features/Errors/Errors"
describe "AuthenticationManager", ->
beforeEach ->
@settings = { security: { bcryptRounds: 12 } }
@AuthenticationManager = SandboxedModule.require modulePath, requires:
"../../models/User": User: @User = {}
"../../infrastructure/mongojs":
db: @db =
users: {}
ObjectId: ObjectId
"bcrypt": @bcrypt = {}
"settings-sharelatex": @settings
"../V1/V1Handler": @V1Handler = {}
"../User/UserGetter": @UserGetter = {}
@callback = sinon.stub()
describe "with real bcrypt", ->
beforeEach ->
bcrypt = require('bcrypt')
@bcrypt.compare = bcrypt.compare
@bcrypt.getRounds = bcrypt.getRounds
@bcrypt.genSalt = bcrypt.genSalt
@bcrypt.hash = bcrypt.hash
# Hash of 'testpassword'
@testPassword = <PASSWORD>'
describe "authenticate", ->
beforeEach ->
@user =
_id: "user-id"
email: @email = "<EMAIL>"
@User.findOne = sinon.stub().callsArgWith(1, null, @user)
describe "when the hashed password matches", ->
beforeEach (done) ->
@unencryptedPassword = "<PASSWORD>"
@user.hashedPassword = <PASSWORD>
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the encrypted passwords do not match", ->
beforeEach ->
@AuthenticationManager.authenticate(email: @email, "notthe<PASSWORD>password", @callback)
it "should not return the user", ->
@callback.calledWith(null, null).should.equal true
describe "setUserPasswordInV2", ->
beforeEach ->
@user =
_id: "5<PASSWORD>2a80b5e7<PASSWORD>ca7e"
email: @email = "<EMAIL>"
@db.users.update = sinon.stub().callsArgWith(2, null, {nModified: 1})
it "should not produce an error", (done) ->
@AuthenticationManager.setUserPasswordInV2 @user._id, "<PASSWORD>", (err, updated) =>
expect(err).to.not.exist
expect(updated).to.equal true
done()
it "should set the hashed password", (done) ->
@AuthenticationManager.setUserPasswordInV2 @user._id, "<PASSWORD>", (err, updated) =>
expect(err).to.not.exist
hashedPassword = @db.users.update.lastCall.args[1].$set.hashedPassword
expect(hashedPassword).to.exist
expect(hashedPassword.length).to.equal 60
expect(hashedPassword).to.match /^\$2a\$12\$[a-zA-Z0-9\/.]{53}$/
done()
describe "authenticate", ->
describe "when the user exists in the database", ->
beforeEach ->
@user =
_id: "user-id"
email: @email = "<EMAIL>"
@unencryptedPassword = "<PASSWORD>"
@User.findOne = sinon.stub().callsArgWith(1, null, @user)
describe "when the hashed password matches", ->
beforeEach (done) ->
@user.hashedPassword = @hashedPassword = "<PASSWORD>"
@bcrypt.compare = sinon.stub().callsArgWith(2, null, true)
@bcrypt.getRounds = sinon.stub().returns 12
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should check that the passwords match", ->
@bcrypt.compare
.calledWith(@unencryptedPassword, @hashedPassword)
.should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the encrypted passwords do not match", ->
beforeEach ->
@AuthenticationManager.authenticate(email: @email, @unencryptedPassword, @callback)
it "should not return the user", ->
@callback.calledWith(null, null).should.equal true
describe "when the hashed password matches but the number of rounds is too low", ->
beforeEach (done) ->
@user.hashedPassword = @hashedPassword = "<PASSWORD>"
@bcrypt.compare = sinon.stub().callsArgWith(2, null, true)
@bcrypt.getRounds = sinon.stub().returns 7
@AuthenticationManager.setUserPassword = sinon.stub().callsArgWith(2, null)
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should check that the passwords match", ->
@bcrypt.compare
.calledWith(@unencryptedPassword, @hashedPassword)
.should.equal true
it "should check the number of rounds", ->
@bcrypt.getRounds.called.should.equal true
it "should set the users password (with a higher number of rounds)", ->
@AuthenticationManager.setUserPassword
.calledWith("user-id", @unencryptedPassword)
.should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the user does not exist in the database", ->
beforeEach ->
@User.findOne = sinon.stub().callsArgWith(1, null, null)
@AuthenticationManager.authenticate(email: @email, @unencrpytedPassword, @callback)
it "should not return a user", ->
@callback.calledWith(null, null).should.equal true
describe "validateEmail", ->
describe "valid", ->
it "should return null", ->
result = @AuthenticationManager.validateEmail '<EMAIL>'
expect(result).to.equal null
describe "invalid", ->
it "should return validation error object for no email", ->
result = @AuthenticationManager.validateEmail ''
expect(result).to.not.equal null
expect(result.message).to.equal 'email not valid'
it "should return validation error object for invalid", ->
result = @AuthenticationManager.validateEmail 'notanemail'
expect(result).to.not.equal null
expect(result.message).to.equal 'email not valid'
describe "validatePassword", ->
beforeEach ->
# 73 characters:
@longPassword = '<PASSWORD>'
describe "with a null password", ->
it "should return an error", ->
expect(@AuthenticationManager.validatePassword()).to.eql { message: 'password not set' }
describe "password length", ->
describe "with the default password length options", ->
it "should reject passwords that are too short", ->
expect(@AuthenticationManager.validatePassword('')).to.eql { message: 'password is too short' }
expect(@AuthenticationManager.validatePassword('foo')).to.eql { message: 'password is too short' }
it "should reject passwords that are too long", ->
expect(@AuthenticationManager.validatePassword(@longPassword)).to.eql { message: 'password is too long' }
it "should accept passwords that are a good length", ->
expect(@AuthenticationManager.validatePassword('<PASSWORD>')).to.equal null
describe "when the password length is specified in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
min: 10
max: 12
it "should reject passwords that are too short", ->
expect(@AuthenticationManager.validatePassword('<PASSWORD>')).to.eql { message: 'password is too short' }
it "should accept passwords of exactly minimum length", ->
expect(@AuthenticationManager.validatePassword('<PASSWORD>')).to.equal null
it "should reject passwords that are too long", ->
expect(@AuthenticationManager.validatePassword('<PASSWORD>')).to.eql { message: 'password is too long' }
it "should accept passwords of exactly maximum length", ->
expect(@AuthenticationManager.validatePassword('<PASSWORD>')).to.equal null
describe "when the maximum password length is set to >72 characters in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max: 128
it "should still reject passwords > 72 characters in length", ->
expect(@AuthenticationManager.validatePassword(@longPassword)).to.eql { message: 'password is too long' }
describe "allowed characters", ->
describe "with the default settings for allowed characters", ->
it "should allow passwords with valid characters", ->
expect(@AuthenticationManager.validatePassword("<PASSWORD>xyzABCDEFGHIJKLMN<PASSWORD>")).to.equal null
expect(@AuthenticationManager.validatePassword("<PASSWORD>0@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.equal null
it "should not allow passwords with invalid characters", ->
expect(@AuthenticationManager.validatePassword("<PASSWORD>")).to.eql { message: 'password contains an invalid character' }
describe "when valid characters are overridden in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
chars:
symbols: " "
it "should allow passwords with valid characters", ->
expect(@AuthenticationManager.validatePassword("<PASSWORD>")).to.equal null
it "should disallow passwords with invalid characters", ->
expect(@AuthenticationManager.validatePassword("<PASSWORD>@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.eql { message: 'password contains an invalid character' }
describe "when allowAnyChars is set", ->
beforeEach ->
@settings.passwordStrengthOptions =
allowAnyChars: true
it "should allow any characters", ->
expect(@AuthenticationManager.validatePassword("<PASSWORD>")).to.equal null
expect(@AuthenticationManager.validatePassword("<PASSWORD>@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.equal null
describe "setUserPassword", ->
beforeEach ->
@user_id = ObjectId()
@password = "<PASSWORD>"
@hashedPassword = "<PASSWORD>"
@salt = "salta<PASSWORD>"
@bcrypt.genSalt = sinon.stub().callsArgWith(1, null, @salt)
@bcrypt.hash = sinon.stub().callsArgWith(2, null, @hashedPassword)
@db.users.update = sinon.stub().callsArg(2)
describe "too long", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max:10
@password = "<PASSWORD>"
it "should return and error", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)->
expect(err).to.exist
done()
it "should not start the bcrypt process", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)=>
@bcrypt.genSalt.called.should.equal false
@bcrypt.hash.called.should.equal false
done()
describe "too short", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max:10
min:6
@password = "<PASSWORD>"
it "should return and error", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)->
expect(err).to.exist
done()
it "should not start the bcrypt process", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)=>
@bcrypt.genSalt.called.should.equal false
@bcrypt.hash.called.should.equal false
done()
describe "password set attempt", ->
describe "with SL user in SL", ->
beforeEach ->
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: null })
@AuthenticationManager.setUserPassword(@user_id, @password, @callback)
it 'should look up the user', ->
@UserGetter.getUser.calledWith(@user_id).should.equal true
it "should update the user's password in the database", ->
args = @db.users.update.lastCall.args
expect(args[0]).to.deep.equal {_id: ObjectId(@user_id.toString())}
expect(args[1]).to.deep.equal {
$set: {
"hashedPassword": <PASSWORD>
}
$unset: password: true
}
it "should hash the password", ->
@bcrypt.genSalt
.calledWith(12)
.should.equal true
@bcrypt.hash
.calledWith(@password, @salt)
.should.equal true
it "should call the callback", ->
@callback.called.should.equal true
describe "with SL user in v2", ->
beforeEach (done) ->
@settings.overleaf = true
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: null })
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should error", ->
@callback.calledWith(new Errors.SLInV2Error("Password Reset Attempt")).should.equal true
describe "with v2 user in SL", ->
beforeEach (done) ->
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: {id: 1} })
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should error", ->
@callback.calledWith(new Errors.NotInV2Error("Password Reset Attempt")).should.equal true
describe "with v2 user in v2", ->
beforeEach (done) ->
@settings.overleaf = true
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: {id: 1} })
@V1Handler.doPasswordReset = sinon.stub().yields(null, true)
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should set the password in v2", ->
@callback.calledWith(null, true).should.equal true
| true | sinon = require('sinon')
chai = require('chai')
should = chai.should()
expect = chai.expect
modulePath = "../../../../app/js/Features/Authentication/AuthenticationManager.js"
SandboxedModule = require('sandboxed-module')
events = require "events"
ObjectId = require("mongojs").ObjectId
Errors = require "../../../../app/js/Features/Errors/Errors"
describe "AuthenticationManager", ->
beforeEach ->
@settings = { security: { bcryptRounds: 12 } }
@AuthenticationManager = SandboxedModule.require modulePath, requires:
"../../models/User": User: @User = {}
"../../infrastructure/mongojs":
db: @db =
users: {}
ObjectId: ObjectId
"bcrypt": @bcrypt = {}
"settings-sharelatex": @settings
"../V1/V1Handler": @V1Handler = {}
"../User/UserGetter": @UserGetter = {}
@callback = sinon.stub()
describe "with real bcrypt", ->
beforeEach ->
bcrypt = require('bcrypt')
@bcrypt.compare = bcrypt.compare
@bcrypt.getRounds = bcrypt.getRounds
@bcrypt.genSalt = bcrypt.genSalt
@bcrypt.hash = bcrypt.hash
# Hash of 'testpassword'
@testPassword = PI:PASSWORD:<PASSWORD>END_PI'
describe "authenticate", ->
beforeEach ->
@user =
_id: "user-id"
email: @email = "PI:EMAIL:<EMAIL>END_PI"
@User.findOne = sinon.stub().callsArgWith(1, null, @user)
describe "when the hashed password matches", ->
beforeEach (done) ->
@unencryptedPassword = "PI:PASSWORD:<PASSWORD>END_PI"
@user.hashedPassword = PI:PASSWORD:<PASSWORD>END_PI
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the encrypted passwords do not match", ->
beforeEach ->
@AuthenticationManager.authenticate(email: @email, "notthePI:PASSWORD:<PASSWORD>END_PIpassword", @callback)
it "should not return the user", ->
@callback.calledWith(null, null).should.equal true
describe "setUserPasswordInV2", ->
beforeEach ->
@user =
_id: "5PI:PASSWORD:<PASSWORD>END_PI2a80b5e7PI:PASSWORD:<PASSWORD>END_PIca7e"
email: @email = "PI:EMAIL:<EMAIL>END_PI"
@db.users.update = sinon.stub().callsArgWith(2, null, {nModified: 1})
it "should not produce an error", (done) ->
@AuthenticationManager.setUserPasswordInV2 @user._id, "PI:PASSWORD:<PASSWORD>END_PI", (err, updated) =>
expect(err).to.not.exist
expect(updated).to.equal true
done()
it "should set the hashed password", (done) ->
@AuthenticationManager.setUserPasswordInV2 @user._id, "PI:PASSWORD:<PASSWORD>END_PI", (err, updated) =>
expect(err).to.not.exist
hashedPassword = @db.users.update.lastCall.args[1].$set.hashedPassword
expect(hashedPassword).to.exist
expect(hashedPassword.length).to.equal 60
expect(hashedPassword).to.match /^\$2a\$12\$[a-zA-Z0-9\/.]{53}$/
done()
describe "authenticate", ->
describe "when the user exists in the database", ->
beforeEach ->
@user =
_id: "user-id"
email: @email = "PI:EMAIL:<EMAIL>END_PI"
@unencryptedPassword = "PI:PASSWORD:<PASSWORD>END_PI"
@User.findOne = sinon.stub().callsArgWith(1, null, @user)
describe "when the hashed password matches", ->
beforeEach (done) ->
@user.hashedPassword = @hashedPassword = "PI:PASSWORD:<PASSWORD>END_PI"
@bcrypt.compare = sinon.stub().callsArgWith(2, null, true)
@bcrypt.getRounds = sinon.stub().returns 12
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should check that the passwords match", ->
@bcrypt.compare
.calledWith(@unencryptedPassword, @hashedPassword)
.should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the encrypted passwords do not match", ->
beforeEach ->
@AuthenticationManager.authenticate(email: @email, @unencryptedPassword, @callback)
it "should not return the user", ->
@callback.calledWith(null, null).should.equal true
describe "when the hashed password matches but the number of rounds is too low", ->
beforeEach (done) ->
@user.hashedPassword = @hashedPassword = "PI:PASSWORD:<PASSWORD>END_PI"
@bcrypt.compare = sinon.stub().callsArgWith(2, null, true)
@bcrypt.getRounds = sinon.stub().returns 7
@AuthenticationManager.setUserPassword = sinon.stub().callsArgWith(2, null)
@AuthenticationManager.authenticate email: @email, @unencryptedPassword, (error, user) =>
@callback(error, user)
done()
it "should look up the correct user in the database", ->
@User.findOne.calledWith(email: @email).should.equal true
it "should check that the passwords match", ->
@bcrypt.compare
.calledWith(@unencryptedPassword, @hashedPassword)
.should.equal true
it "should check the number of rounds", ->
@bcrypt.getRounds.called.should.equal true
it "should set the users password (with a higher number of rounds)", ->
@AuthenticationManager.setUserPassword
.calledWith("user-id", @unencryptedPassword)
.should.equal true
it "should return the user", ->
@callback.calledWith(null, @user).should.equal true
describe "when the user does not exist in the database", ->
beforeEach ->
@User.findOne = sinon.stub().callsArgWith(1, null, null)
@AuthenticationManager.authenticate(email: @email, @unencrpytedPassword, @callback)
it "should not return a user", ->
@callback.calledWith(null, null).should.equal true
describe "validateEmail", ->
describe "valid", ->
it "should return null", ->
result = @AuthenticationManager.validateEmail 'PI:EMAIL:<EMAIL>END_PI'
expect(result).to.equal null
describe "invalid", ->
it "should return validation error object for no email", ->
result = @AuthenticationManager.validateEmail ''
expect(result).to.not.equal null
expect(result.message).to.equal 'email not valid'
it "should return validation error object for invalid", ->
result = @AuthenticationManager.validateEmail 'notanemail'
expect(result).to.not.equal null
expect(result.message).to.equal 'email not valid'
describe "validatePassword", ->
beforeEach ->
# 73 characters:
@longPassword = 'PI:PASSWORD:<PASSWORD>END_PI'
describe "with a null password", ->
it "should return an error", ->
expect(@AuthenticationManager.validatePassword()).to.eql { message: 'password not set' }
describe "password length", ->
describe "with the default password length options", ->
it "should reject passwords that are too short", ->
expect(@AuthenticationManager.validatePassword('')).to.eql { message: 'password is too short' }
expect(@AuthenticationManager.validatePassword('foo')).to.eql { message: 'password is too short' }
it "should reject passwords that are too long", ->
expect(@AuthenticationManager.validatePassword(@longPassword)).to.eql { message: 'password is too long' }
it "should accept passwords that are a good length", ->
expect(@AuthenticationManager.validatePassword('PI:PASSWORD:<PASSWORD>END_PI')).to.equal null
describe "when the password length is specified in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
min: 10
max: 12
it "should reject passwords that are too short", ->
expect(@AuthenticationManager.validatePassword('PI:PASSWORD:<PASSWORD>END_PI')).to.eql { message: 'password is too short' }
it "should accept passwords of exactly minimum length", ->
expect(@AuthenticationManager.validatePassword('PI:PASSWORD:<PASSWORD>END_PI')).to.equal null
it "should reject passwords that are too long", ->
expect(@AuthenticationManager.validatePassword('PI:PASSWORD:<PASSWORD>END_PI')).to.eql { message: 'password is too long' }
it "should accept passwords of exactly maximum length", ->
expect(@AuthenticationManager.validatePassword('PI:PASSWORD:<PASSWORD>END_PI')).to.equal null
describe "when the maximum password length is set to >72 characters in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max: 128
it "should still reject passwords > 72 characters in length", ->
expect(@AuthenticationManager.validatePassword(@longPassword)).to.eql { message: 'password is too long' }
describe "allowed characters", ->
describe "with the default settings for allowed characters", ->
it "should allow passwords with valid characters", ->
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PIxyzABCDEFGHIJKLMNPI:PASSWORD:<PASSWORD>END_PI")).to.equal null
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PI0@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.equal null
it "should not allow passwords with invalid characters", ->
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PI")).to.eql { message: 'password contains an invalid character' }
describe "when valid characters are overridden in settings", ->
beforeEach ->
@settings.passwordStrengthOptions =
chars:
symbols: " "
it "should allow passwords with valid characters", ->
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PI")).to.equal null
it "should disallow passwords with invalid characters", ->
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PI@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.eql { message: 'password contains an invalid character' }
describe "when allowAnyChars is set", ->
beforeEach ->
@settings.passwordStrengthOptions =
allowAnyChars: true
it "should allow any characters", ->
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PI")).to.equal null
expect(@AuthenticationManager.validatePassword("PI:PASSWORD:<PASSWORD>END_PI@#$%^&*()-_=+[]{};:<>/?!£€.,")).to.equal null
describe "setUserPassword", ->
beforeEach ->
@user_id = ObjectId()
@password = "PI:PASSWORD:<PASSWORD>END_PI"
@hashedPassword = "PI:PASSWORD:<PASSWORD>END_PI"
@salt = "saltaPI:PASSWORD:<PASSWORD>END_PI"
@bcrypt.genSalt = sinon.stub().callsArgWith(1, null, @salt)
@bcrypt.hash = sinon.stub().callsArgWith(2, null, @hashedPassword)
@db.users.update = sinon.stub().callsArg(2)
describe "too long", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max:10
@password = "PI:PASSWORD:<PASSWORD>END_PI"
it "should return and error", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)->
expect(err).to.exist
done()
it "should not start the bcrypt process", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)=>
@bcrypt.genSalt.called.should.equal false
@bcrypt.hash.called.should.equal false
done()
describe "too short", ->
beforeEach ->
@settings.passwordStrengthOptions =
length:
max:10
min:6
@password = "PI:PASSWORD:<PASSWORD>END_PI"
it "should return and error", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)->
expect(err).to.exist
done()
it "should not start the bcrypt process", (done)->
@AuthenticationManager.setUserPassword @user_id, @password, (err)=>
@bcrypt.genSalt.called.should.equal false
@bcrypt.hash.called.should.equal false
done()
describe "password set attempt", ->
describe "with SL user in SL", ->
beforeEach ->
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: null })
@AuthenticationManager.setUserPassword(@user_id, @password, @callback)
it 'should look up the user', ->
@UserGetter.getUser.calledWith(@user_id).should.equal true
it "should update the user's password in the database", ->
args = @db.users.update.lastCall.args
expect(args[0]).to.deep.equal {_id: ObjectId(@user_id.toString())}
expect(args[1]).to.deep.equal {
$set: {
"hashedPassword": PI:PASSWORD:<PASSWORD>END_PI
}
$unset: password: true
}
it "should hash the password", ->
@bcrypt.genSalt
.calledWith(12)
.should.equal true
@bcrypt.hash
.calledWith(@password, @salt)
.should.equal true
it "should call the callback", ->
@callback.called.should.equal true
describe "with SL user in v2", ->
beforeEach (done) ->
@settings.overleaf = true
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: null })
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should error", ->
@callback.calledWith(new Errors.SLInV2Error("Password Reset Attempt")).should.equal true
describe "with v2 user in SL", ->
beforeEach (done) ->
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: {id: 1} })
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should error", ->
@callback.calledWith(new Errors.NotInV2Error("Password Reset Attempt")).should.equal true
describe "with v2 user in v2", ->
beforeEach (done) ->
@settings.overleaf = true
@UserGetter.getUser = sinon.stub().yields(null, { overleaf: {id: 1} })
@V1Handler.doPasswordReset = sinon.stub().yields(null, true)
@AuthenticationManager.setUserPassword @user_id, @password, (err, changed) =>
@callback(err, changed)
done()
it "should set the password in v2", ->
@callback.calledWith(null, true).should.equal true
|
[
{
"context": "min\"\n\ngoodtoken = querystring.stringify({ token: 'abc123' })\nbadtoken = querystring.stringify({ token: 'f'",
"end": 303,
"score": 0.9696382880210876,
"start": 297,
"tag": "KEY",
"value": "abc123"
},
{
"context": "time', ->\n beforeEach ->\n @room.user.say 'a... | tests/scripts/test_diagnostics.coffee | fangamer/ibizan | 0 |
Helper = require('hubot-test-helper')
expect = require('chai').expect
http = require('http')
querystring = require('querystring')
helper = new Helper('../../src/scripts/diagnostics.coffee')
process.env.ORG_NAME = "test"
process.env.ADMINS = "admin"
goodtoken = querystring.stringify({ token: 'abc123' })
badtoken = querystring.stringify({ token: 'f' })
describe 'diagnostics', ->
beforeEach ->
@room = helper.createRoom()
afterEach ->
@room.destroy()
context 'user says: hubot uptime', ->
beforeEach ->
@room.user.say 'aaronsky', 'hubot uptime'
it 'should reply with uptime', ->
expect(@room.messages[0]).to.eql(['aaronsky', 'hubot uptime'])
expect(@room.messages[1][1]).to.include('has been up')
# context 'user says: hubot users', ->
# beforeEach ->
# @room.user.say 'aaronsky', 'hubot users'
# it 'should shun the non-admin', ->
# expect(@room.messages[0]).to.eql(['aaronsky', 'hubot users'])
# expect(@room.messages[1][1]).to.include('must be an admin')
# context 'admin says: hubot users', ->
# beforeEach ->
# @room.user.say 'admin', 'hubot users'
# it 'should reply with a list of users', ->
# expect(@room.messages[0]).to.eql(['admin', 'hubot users'])
# expect(@room.messages[1][1]).to.include('users')
| 176670 |
Helper = require('hubot-test-helper')
expect = require('chai').expect
http = require('http')
querystring = require('querystring')
helper = new Helper('../../src/scripts/diagnostics.coffee')
process.env.ORG_NAME = "test"
process.env.ADMINS = "admin"
goodtoken = querystring.stringify({ token: '<KEY>' })
badtoken = querystring.stringify({ token: 'f' })
describe 'diagnostics', ->
beforeEach ->
@room = helper.createRoom()
afterEach ->
@room.destroy()
context 'user says: hubot uptime', ->
beforeEach ->
@room.user.say 'aaronsky', 'hubot uptime'
it 'should reply with uptime', ->
expect(@room.messages[0]).to.eql(['aaronsky', 'hubot uptime'])
expect(@room.messages[1][1]).to.include('has been up')
# context 'user says: hubot users', ->
# beforeEach ->
# @room.user.say 'aaronsky', 'hubot users'
# it 'should shun the non-admin', ->
# expect(@room.messages[0]).to.eql(['aaronsky', 'hubot users'])
# expect(@room.messages[1][1]).to.include('must be an admin')
# context 'admin says: hubot users', ->
# beforeEach ->
# @room.user.say 'admin', 'hubot users'
# it 'should reply with a list of users', ->
# expect(@room.messages[0]).to.eql(['admin', 'hubot users'])
# expect(@room.messages[1][1]).to.include('users')
| true |
Helper = require('hubot-test-helper')
expect = require('chai').expect
http = require('http')
querystring = require('querystring')
helper = new Helper('../../src/scripts/diagnostics.coffee')
process.env.ORG_NAME = "test"
process.env.ADMINS = "admin"
goodtoken = querystring.stringify({ token: 'PI:KEY:<KEY>END_PI' })
badtoken = querystring.stringify({ token: 'f' })
describe 'diagnostics', ->
beforeEach ->
@room = helper.createRoom()
afterEach ->
@room.destroy()
context 'user says: hubot uptime', ->
beforeEach ->
@room.user.say 'aaronsky', 'hubot uptime'
it 'should reply with uptime', ->
expect(@room.messages[0]).to.eql(['aaronsky', 'hubot uptime'])
expect(@room.messages[1][1]).to.include('has been up')
# context 'user says: hubot users', ->
# beforeEach ->
# @room.user.say 'aaronsky', 'hubot users'
# it 'should shun the non-admin', ->
# expect(@room.messages[0]).to.eql(['aaronsky', 'hubot users'])
# expect(@room.messages[1][1]).to.include('must be an admin')
# context 'admin says: hubot users', ->
# beforeEach ->
# @room.user.say 'admin', 'hubot users'
# it 'should reply with a list of users', ->
# expect(@room.messages[0]).to.eql(['admin', 'hubot users'])
# expect(@room.messages[1][1]).to.include('users')
|
[
{
"context": " notebooks: 1\n accessToken: 'abc'\n timeout: 8000\n de",
"end": 4363,
"score": 0.884092390537262,
"start": 4360,
"tag": "KEY",
"value": "abc"
},
{
"context": "id is 1\n assert client.accessToken is 'abc'\n ... | spec/loopback-promised.coffee | CureApp/loopback-promised | 10 |
LoopbackPromised = require '../src/loopback-promised'
LoopbackClient = require '../src/loopback-client'
LoopbackUserClient = require '../src/loopback-user-client'
LoopbackRelatedClient = require '../src/loopback-related-client'
PushManager = require '../src/push-manager'
before ->
@timeout 5000
require('./init')
debug = false
baseURL = 'localhost:4157/test-api'
describe 'LoopbackPromised', ->
describe 'request', ->
it 'cannot request to the server when baseURL is not set', ->
lbPromised = LoopbackPromised.createInstance()
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.match /baseURL/ # TODO: should return error
)
it 'fails if baseURL is not valid (port)', ->
lbPromised = LoopbackPromised.createInstance
baseURL: 'localhost:4158/api' # invalid URL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.code is 'ECONNREFUSED'
)
it 'fails if baseURL is not valid (path)', ->
lbPromised = LoopbackPromised.createInstance
baseURL: 'localhost:4157/api' # invalid URL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.message.match /Cannot GET/
)
it 'requests to the server', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then (responseBody) ->
assert responseBody instanceof Array
it 'timeouts when timeout msec is given and exceeds', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
timeout: 1
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).catch (e) ->
assert e.message.match /timeout/
describe 'createClient', ->
it 'creates client for one model', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
clientInfo =
accessToken: null
timeout: 8000
debug: debug
client = lbPromised.createClient(pluralModelName, clientInfo)
assert client instanceof LoopbackClient
assert client.timeout is 8000
it 'creates related client when "belongsTo" option is set', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
client = lbPromised.createClient('leaves',
belongsTo:
notebooks: 1
accessToken: 'abc'
timeout: 8000
debug: debug
isUserModel: true # ignored
)
assert client instanceof LoopbackRelatedClient
assert client.id is 1
assert client.accessToken is 'abc'
assert client.debug is debug
assert client.pluralModelName is 'notebooks'
assert client.pluralModelNameMany is 'leaves'
assert client.timeout is 8000
it 'creates user client when "isUserModel" option is set', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
client = lbPromised.createClient('leaves',
isUserModel: true
accessToken: 'abc'
timeout: 8000
debug: debug
)
assert client instanceof LoopbackUserClient
assert client.accessToken is 'abc'
assert client.debug is debug
assert client.pluralModelName is 'leaves'
assert client.timeout is 8000
describe 'createUserClient', ->
it 'creates user client for one model', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'authors'
clientInfo =
accessToken: null
debug: debug
client = lbPromised.createUserClient(pluralModelName, clientInfo)
assert client instanceof LoopbackClient
assert client instanceof LoopbackUserClient
describe 'createPushManager', ->
it 'creates push notification manager', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
clientInfo =
accessToken: null
debug: debug
client = lbPromised.createPushManager(clientInfo)
assert client instanceof PushManager
describe '@isDebugMode', ->
before ->
@LBP_DEBUG = process.env.LBP_DEBUG
after ->
process.env.LBP_DEBUG = @LBP_DEBUG
it 'returns true when given param is true', ->
assert LoopbackPromised.isDebugMode(true) is true
it 'returns true when given param is false but process.env.LBP_DEBUG exists', ->
process.env.LBP_DEBUG = '1'
assert LoopbackPromised.isDebugMode(false) is true
it 'returns false when given param is false and process.env.LBP_DEBUG does not exist', ->
delete process.env.LBP_DEBUG
assert LoopbackPromised.isDebugMode(false) is false
| 115979 |
LoopbackPromised = require '../src/loopback-promised'
LoopbackClient = require '../src/loopback-client'
LoopbackUserClient = require '../src/loopback-user-client'
LoopbackRelatedClient = require '../src/loopback-related-client'
PushManager = require '../src/push-manager'
before ->
@timeout 5000
require('./init')
debug = false
baseURL = 'localhost:4157/test-api'
describe 'LoopbackPromised', ->
describe 'request', ->
it 'cannot request to the server when baseURL is not set', ->
lbPromised = LoopbackPromised.createInstance()
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.match /baseURL/ # TODO: should return error
)
it 'fails if baseURL is not valid (port)', ->
lbPromised = LoopbackPromised.createInstance
baseURL: 'localhost:4158/api' # invalid URL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.code is 'ECONNREFUSED'
)
it 'fails if baseURL is not valid (path)', ->
lbPromised = LoopbackPromised.createInstance
baseURL: 'localhost:4157/api' # invalid URL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.message.match /Cannot GET/
)
it 'requests to the server', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then (responseBody) ->
assert responseBody instanceof Array
it 'timeouts when timeout msec is given and exceeds', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
timeout: 1
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).catch (e) ->
assert e.message.match /timeout/
describe 'createClient', ->
it 'creates client for one model', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
clientInfo =
accessToken: null
timeout: 8000
debug: debug
client = lbPromised.createClient(pluralModelName, clientInfo)
assert client instanceof LoopbackClient
assert client.timeout is 8000
it 'creates related client when "belongsTo" option is set', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
client = lbPromised.createClient('leaves',
belongsTo:
notebooks: 1
accessToken: '<KEY>'
timeout: 8000
debug: debug
isUserModel: true # ignored
)
assert client instanceof LoopbackRelatedClient
assert client.id is 1
assert client.accessToken is '<KEY>'
assert client.debug is debug
assert client.pluralModelName is 'notebooks'
assert client.pluralModelNameMany is 'leaves'
assert client.timeout is 8000
it 'creates user client when "isUserModel" option is set', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
client = lbPromised.createClient('leaves',
isUserModel: true
accessToken: '<KEY>'
timeout: 8000
debug: debug
)
assert client instanceof LoopbackUserClient
assert client.accessToken is '<KEY>'
assert client.debug is debug
assert client.pluralModelName is 'leaves'
assert client.timeout is 8000
describe 'createUserClient', ->
it 'creates user client for one model', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'authors'
clientInfo =
accessToken: null
debug: debug
client = lbPromised.createUserClient(pluralModelName, clientInfo)
assert client instanceof LoopbackClient
assert client instanceof LoopbackUserClient
describe 'createPushManager', ->
it 'creates push notification manager', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
clientInfo =
accessToken: null
debug: debug
client = lbPromised.createPushManager(clientInfo)
assert client instanceof PushManager
describe '@isDebugMode', ->
before ->
@LBP_DEBUG = process.env.LBP_DEBUG
after ->
process.env.LBP_DEBUG = @LBP_DEBUG
it 'returns true when given param is true', ->
assert LoopbackPromised.isDebugMode(true) is true
it 'returns true when given param is false but process.env.LBP_DEBUG exists', ->
process.env.LBP_DEBUG = '1'
assert LoopbackPromised.isDebugMode(false) is true
it 'returns false when given param is false and process.env.LBP_DEBUG does not exist', ->
delete process.env.LBP_DEBUG
assert LoopbackPromised.isDebugMode(false) is false
| true |
LoopbackPromised = require '../src/loopback-promised'
LoopbackClient = require '../src/loopback-client'
LoopbackUserClient = require '../src/loopback-user-client'
LoopbackRelatedClient = require '../src/loopback-related-client'
PushManager = require '../src/push-manager'
before ->
@timeout 5000
require('./init')
debug = false
baseURL = 'localhost:4157/test-api'
describe 'LoopbackPromised', ->
describe 'request', ->
it 'cannot request to the server when baseURL is not set', ->
lbPromised = LoopbackPromised.createInstance()
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.match /baseURL/ # TODO: should return error
)
it 'fails if baseURL is not valid (port)', ->
lbPromised = LoopbackPromised.createInstance
baseURL: 'localhost:4158/api' # invalid URL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.code is 'ECONNREFUSED'
)
it 'fails if baseURL is not valid (path)', ->
lbPromised = LoopbackPromised.createInstance
baseURL: 'localhost:4157/api' # invalid URL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then((responseBody) ->
throw new Error('this cannot occur')
, (e) ->
assert e.message.match /Cannot GET/
)
it 'requests to the server', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).then (responseBody) ->
assert responseBody instanceof Array
it 'timeouts when timeout msec is given and exceeds', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
path = ''
params = null
http_method = 'GET'
clientInfo =
accessToken: null
debug: debug
timeout: 1
lbPromised.request(pluralModelName, path, params, http_method, clientInfo).catch (e) ->
assert e.message.match /timeout/
describe 'createClient', ->
it 'creates client for one model', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'notebooks'
clientInfo =
accessToken: null
timeout: 8000
debug: debug
client = lbPromised.createClient(pluralModelName, clientInfo)
assert client instanceof LoopbackClient
assert client.timeout is 8000
it 'creates related client when "belongsTo" option is set', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
client = lbPromised.createClient('leaves',
belongsTo:
notebooks: 1
accessToken: 'PI:KEY:<KEY>END_PI'
timeout: 8000
debug: debug
isUserModel: true # ignored
)
assert client instanceof LoopbackRelatedClient
assert client.id is 1
assert client.accessToken is 'PI:KEY:<KEY>END_PI'
assert client.debug is debug
assert client.pluralModelName is 'notebooks'
assert client.pluralModelNameMany is 'leaves'
assert client.timeout is 8000
it 'creates user client when "isUserModel" option is set', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
client = lbPromised.createClient('leaves',
isUserModel: true
accessToken: 'PI:KEY:<KEY>END_PI'
timeout: 8000
debug: debug
)
assert client instanceof LoopbackUserClient
assert client.accessToken is 'PI:KEY:<KEY>END_PI'
assert client.debug is debug
assert client.pluralModelName is 'leaves'
assert client.timeout is 8000
describe 'createUserClient', ->
it 'creates user client for one model', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
pluralModelName = 'authors'
clientInfo =
accessToken: null
debug: debug
client = lbPromised.createUserClient(pluralModelName, clientInfo)
assert client instanceof LoopbackClient
assert client instanceof LoopbackUserClient
describe 'createPushManager', ->
it 'creates push notification manager', ->
lbPromised = LoopbackPromised.createInstance
baseURL: baseURL
clientInfo =
accessToken: null
debug: debug
client = lbPromised.createPushManager(clientInfo)
assert client instanceof PushManager
describe '@isDebugMode', ->
before ->
@LBP_DEBUG = process.env.LBP_DEBUG
after ->
process.env.LBP_DEBUG = @LBP_DEBUG
it 'returns true when given param is true', ->
assert LoopbackPromised.isDebugMode(true) is true
it 'returns true when given param is false but process.env.LBP_DEBUG exists', ->
process.env.LBP_DEBUG = '1'
assert LoopbackPromised.isDebugMode(false) is true
it 'returns false when given param is false and process.env.LBP_DEBUG does not exist', ->
delete process.env.LBP_DEBUG
assert LoopbackPromised.isDebugMode(false) is false
|
[
{
"context": " color conversions\n * \n * Copyright (c) 2011-2015, Gregor Aisch\n * All rights reserved.\n * \n * Redistribution and",
"end": 120,
"score": 0.999865710735321,
"start": 108,
"tag": "NAME",
"value": "Gregor Aisch"
},
{
"context": "provided with the distribution.\n * \n ... | node_modules/chroma-js/docs/license.coffee | Dozacode/ResumeChain | 4 | ###*
* @license
*
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2015, Gregor Aisch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
###
| 208262 | ###*
* @license
*
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2015, <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name <NAME> may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <NAME> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
###
| true | ###*
* @license
*
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2015, PI:NAME:<NAME>END_PI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name PI:NAME:<NAME>END_PI may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL PI:NAME:<NAME>END_PI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
###
|
[
{
"context": ".ajax\n method: 'POST'\n url: 'http://54.169.214.119:3000/changes'\n dataType: 'json'\n da",
"end": 2721,
"score": 0.9986683130264282,
"start": 2707,
"tag": "IP_ADDRESS",
"value": "54.169.214.119"
}
] | public/js/docs.coffee | coadotvn/clicklion-docs-generator | 0 | unless ClickLion? then window.ClickLion = {}
ClickLion['docs'] =
ready: () ->
lockBody = () ->
$ 'body'
.addClass 'locked'
$ '.fixed-menu'
.removeClass 'hfso'
unlockBody = () ->
$ 'body'
.removeClass 'locked'
$ '.fixed-menu'
.addClass 'hfso'
initAnchorLinks = () ->
$ window
.on 'hashchange', (e) ->
unlockBody()
initScrollSpy = () ->
tops = {}
wrapperCalcTops = () ->
top = {}
blocks = $ '.content'
.find 'section, article'
for block in blocks
tops[$(block).attr('id')] = $(block).offset().top
wrapperScrollBind = (e) ->
wrapperCalcTops()
min = 100000
blockId = null
for id, top of tops
if 0 <= top < min
min = top
blockId = id
$ '.content'
.find 'section, article'
.removeClass 'a'
.end()
.find "##{blockId}"
.addClass 'a'
.parents 'article, section'
.addClass 'a'
$ '.doc-index ul.sections'
.find 'li'
.removeClass 'a'
.end()
.find "a[href$=##{blockId}]"
.parents 'li'
.addClass 'a'
wrapperScrollTimeout = null
$ '.wrapper'
.on 'scroll', (e) ->
if wrapperScrollTimeout? then clearTimeout wrapperScrollTimeout
wrapperScrollTimeout = setTimeout () ->
wrapperScrollBind e
, 50
.scroll()
initFixedMenu = () ->
$ 'a.menu'
.click (e) ->
lockBody()
e.preventDefault()
$ 'a.close'
.click (e) ->
unlockBody()
e.preventDefault()
initEditor = () ->
$ '.document'
.on 'click', 'p, h1.title, h2.title', (e) ->
$ @
.attr 'data-text', $(@).text()
.prop 'contenteditable', true
.unbind 'focusout'
.focusout (e) ->
newText = $(@).text()
oldText = $(@).attr 'data-text'
if newText != oldText
json =
oldText: oldText
newText: newText
element: $(@).get(0).tagName
section: $(@).parents('section[id]').attr 'id'
article: $(@).parents('article[id]').attr 'id'
url: $('.meta-url').text()
push json
$(@).css
backgroundColor: 'yellow'
return
.focus()
push = (json) ->
$.ajax
method: 'POST'
url: 'http://54.169.214.119:3000/changes'
dataType: 'json'
data: json
initFixedMenu()
initAnchorLinks()
initScrollSpy()
initEditor()
if $?
$ document
.ready ClickLion['docs'].ready | 29900 | unless ClickLion? then window.ClickLion = {}
ClickLion['docs'] =
ready: () ->
lockBody = () ->
$ 'body'
.addClass 'locked'
$ '.fixed-menu'
.removeClass 'hfso'
unlockBody = () ->
$ 'body'
.removeClass 'locked'
$ '.fixed-menu'
.addClass 'hfso'
initAnchorLinks = () ->
$ window
.on 'hashchange', (e) ->
unlockBody()
initScrollSpy = () ->
tops = {}
wrapperCalcTops = () ->
top = {}
blocks = $ '.content'
.find 'section, article'
for block in blocks
tops[$(block).attr('id')] = $(block).offset().top
wrapperScrollBind = (e) ->
wrapperCalcTops()
min = 100000
blockId = null
for id, top of tops
if 0 <= top < min
min = top
blockId = id
$ '.content'
.find 'section, article'
.removeClass 'a'
.end()
.find "##{blockId}"
.addClass 'a'
.parents 'article, section'
.addClass 'a'
$ '.doc-index ul.sections'
.find 'li'
.removeClass 'a'
.end()
.find "a[href$=##{blockId}]"
.parents 'li'
.addClass 'a'
wrapperScrollTimeout = null
$ '.wrapper'
.on 'scroll', (e) ->
if wrapperScrollTimeout? then clearTimeout wrapperScrollTimeout
wrapperScrollTimeout = setTimeout () ->
wrapperScrollBind e
, 50
.scroll()
initFixedMenu = () ->
$ 'a.menu'
.click (e) ->
lockBody()
e.preventDefault()
$ 'a.close'
.click (e) ->
unlockBody()
e.preventDefault()
initEditor = () ->
$ '.document'
.on 'click', 'p, h1.title, h2.title', (e) ->
$ @
.attr 'data-text', $(@).text()
.prop 'contenteditable', true
.unbind 'focusout'
.focusout (e) ->
newText = $(@).text()
oldText = $(@).attr 'data-text'
if newText != oldText
json =
oldText: oldText
newText: newText
element: $(@).get(0).tagName
section: $(@).parents('section[id]').attr 'id'
article: $(@).parents('article[id]').attr 'id'
url: $('.meta-url').text()
push json
$(@).css
backgroundColor: 'yellow'
return
.focus()
push = (json) ->
$.ajax
method: 'POST'
url: 'http://192.168.127.12:3000/changes'
dataType: 'json'
data: json
initFixedMenu()
initAnchorLinks()
initScrollSpy()
initEditor()
if $?
$ document
.ready ClickLion['docs'].ready | true | unless ClickLion? then window.ClickLion = {}
ClickLion['docs'] =
ready: () ->
lockBody = () ->
$ 'body'
.addClass 'locked'
$ '.fixed-menu'
.removeClass 'hfso'
unlockBody = () ->
$ 'body'
.removeClass 'locked'
$ '.fixed-menu'
.addClass 'hfso'
initAnchorLinks = () ->
$ window
.on 'hashchange', (e) ->
unlockBody()
initScrollSpy = () ->
tops = {}
wrapperCalcTops = () ->
top = {}
blocks = $ '.content'
.find 'section, article'
for block in blocks
tops[$(block).attr('id')] = $(block).offset().top
wrapperScrollBind = (e) ->
wrapperCalcTops()
min = 100000
blockId = null
for id, top of tops
if 0 <= top < min
min = top
blockId = id
$ '.content'
.find 'section, article'
.removeClass 'a'
.end()
.find "##{blockId}"
.addClass 'a'
.parents 'article, section'
.addClass 'a'
$ '.doc-index ul.sections'
.find 'li'
.removeClass 'a'
.end()
.find "a[href$=##{blockId}]"
.parents 'li'
.addClass 'a'
wrapperScrollTimeout = null
$ '.wrapper'
.on 'scroll', (e) ->
if wrapperScrollTimeout? then clearTimeout wrapperScrollTimeout
wrapperScrollTimeout = setTimeout () ->
wrapperScrollBind e
, 50
.scroll()
initFixedMenu = () ->
$ 'a.menu'
.click (e) ->
lockBody()
e.preventDefault()
$ 'a.close'
.click (e) ->
unlockBody()
e.preventDefault()
initEditor = () ->
$ '.document'
.on 'click', 'p, h1.title, h2.title', (e) ->
$ @
.attr 'data-text', $(@).text()
.prop 'contenteditable', true
.unbind 'focusout'
.focusout (e) ->
newText = $(@).text()
oldText = $(@).attr 'data-text'
if newText != oldText
json =
oldText: oldText
newText: newText
element: $(@).get(0).tagName
section: $(@).parents('section[id]').attr 'id'
article: $(@).parents('article[id]').attr 'id'
url: $('.meta-url').text()
push json
$(@).css
backgroundColor: 'yellow'
return
.focus()
push = (json) ->
$.ajax
method: 'POST'
url: 'http://PI:IP_ADDRESS:192.168.127.12END_PI:3000/changes'
dataType: 'json'
data: json
initFixedMenu()
initAnchorLinks()
initScrollSpy()
initEditor()
if $?
$ document
.ready ClickLion['docs'].ready |
[
{
"context": "roup\"]\n [\"bravo\", \"Bravo Group\"]\n [\"charlie\",\"Charlie Group\"]\n ]\n ,\n type: \"card\"",
"end": 2146,
"score": 0.9182879328727722,
"start": 2142,
"tag": "NAME",
"value": "char"
},
{
"context": " [\"bravo\", \"Bravo Group\"]\n ... | site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee | datapimp/luca | 4 | # The `Docs.views.ComplexLayoutForm` is an example of a `Luca.components.FormView` which contains
# a nested container, and which uses the bootstrap grid helper properties `@rowFluid` and `@span`
# to arrange the nested components inside of a grid layout.
#
# In addition to laying out the form components visually, there is a nested `Luca.containers.CardView`
# component which shows / hides various field sets depending on what options you select on the form.
# This is an example of how Luca framework components can be assembled together arbitrarily to build
# whatever type of user interface you can imagine.
form = Docs.register "Docs.views.ComplexLayoutForm"
form.extends "Luca.components.FormView"
form.privateConfiguration
# By setting `@rowFluid` to true, this container
# will support the twitter bootstrap grid layout. Applying
# the `@span` property to the direct children of this component
# will control their width
rowFluid: true
# Here is an example of using the `@componentEvents` property to listen
# to the change event on the select field identified by the role 'group_selector'.
# once that field emits its change event, we change the active display card in the
# nested card selector.
componentEvents:
"group_selector on:change" : "selectGroup"
form.privateMethods
# The selectGroup method is bound to the componentEvent listener. Whenever
# the group_selector field changes its value, we want to change which field
# group is visible on the form.
selectGroup: ()->
desiredGroup = @getGroupSelector().getValue()
selector = @getGroupDisplaySelector()
selector.activate(desiredGroup)
form.contains
type: "container"
span: 6
components:[
type: "text"
label: "Field One"
,
type: "text"
label: "Field Two"
,
type: "text"
label: "Field Three"
]
,
type: "container"
span: 6
components:[
label: "Select a Group"
type: "select"
role: "group_selector"
includeBlank: false
valueType: "string"
collection:
data:[
["alpha","Alpha Group"]
["bravo", "Bravo Group"]
["charlie","Charlie Group"]
]
,
type: "card"
role: "group_display_selector"
components:[
name: "alpha"
defaults:
type: "text"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group One"
,
label: "Alpha"
,
label: "Bravo"
,
label: "Charlie"
]
,
name: "bravo"
defaults:
type: "checkbox_field"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group Two"
,
label: "One"
,
label: "Two"
]
,
name: "charlie"
defaults:
type: "button_field"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group Three"
,
input_value: "Button One"
icon_class: "chevron-up"
,
input_value: "Button Two"
icon_class: "pencil"
]
]
] | 198158 | # The `Docs.views.ComplexLayoutForm` is an example of a `Luca.components.FormView` which contains
# a nested container, and which uses the bootstrap grid helper properties `@rowFluid` and `@span`
# to arrange the nested components inside of a grid layout.
#
# In addition to laying out the form components visually, there is a nested `Luca.containers.CardView`
# component which shows / hides various field sets depending on what options you select on the form.
# This is an example of how Luca framework components can be assembled together arbitrarily to build
# whatever type of user interface you can imagine.
form = Docs.register "Docs.views.ComplexLayoutForm"
form.extends "Luca.components.FormView"
form.privateConfiguration
# By setting `@rowFluid` to true, this container
# will support the twitter bootstrap grid layout. Applying
# the `@span` property to the direct children of this component
# will control their width
rowFluid: true
# Here is an example of using the `@componentEvents` property to listen
# to the change event on the select field identified by the role 'group_selector'.
# once that field emits its change event, we change the active display card in the
# nested card selector.
componentEvents:
"group_selector on:change" : "selectGroup"
form.privateMethods
# The selectGroup method is bound to the componentEvent listener. Whenever
# the group_selector field changes its value, we want to change which field
# group is visible on the form.
selectGroup: ()->
desiredGroup = @getGroupSelector().getValue()
selector = @getGroupDisplaySelector()
selector.activate(desiredGroup)
form.contains
type: "container"
span: 6
components:[
type: "text"
label: "Field One"
,
type: "text"
label: "Field Two"
,
type: "text"
label: "Field Three"
]
,
type: "container"
span: 6
components:[
label: "Select a Group"
type: "select"
role: "group_selector"
includeBlank: false
valueType: "string"
collection:
data:[
["alpha","Alpha Group"]
["bravo", "Bravo Group"]
["<NAME>lie","<NAME> Group"]
]
,
type: "card"
role: "group_display_selector"
components:[
name: "alpha"
defaults:
type: "text"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group One"
,
label: "Alpha"
,
label: "Bravo"
,
label: "<NAME>"
]
,
name: "<NAME>avo"
defaults:
type: "checkbox_field"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group Two"
,
label: "One"
,
label: "Two"
]
,
name: "<NAME>"
defaults:
type: "button_field"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group Three"
,
input_value: "Button One"
icon_class: "chevron-up"
,
input_value: "Button Two"
icon_class: "pencil"
]
]
] | true | # The `Docs.views.ComplexLayoutForm` is an example of a `Luca.components.FormView` which contains
# a nested container, and which uses the bootstrap grid helper properties `@rowFluid` and `@span`
# to arrange the nested components inside of a grid layout.
#
# In addition to laying out the form components visually, there is a nested `Luca.containers.CardView`
# component which shows / hides various field sets depending on what options you select on the form.
# This is an example of how Luca framework components can be assembled together arbitrarily to build
# whatever type of user interface you can imagine.
form = Docs.register "Docs.views.ComplexLayoutForm"
form.extends "Luca.components.FormView"
form.privateConfiguration
# By setting `@rowFluid` to true, this container
# will support the twitter bootstrap grid layout. Applying
# the `@span` property to the direct children of this component
# will control their width
rowFluid: true
# Here is an example of using the `@componentEvents` property to listen
# to the change event on the select field identified by the role 'group_selector'.
# once that field emits its change event, we change the active display card in the
# nested card selector.
componentEvents:
"group_selector on:change" : "selectGroup"
form.privateMethods
# The selectGroup method is bound to the componentEvent listener. Whenever
# the group_selector field changes its value, we want to change which field
# group is visible on the form.
selectGroup: ()->
desiredGroup = @getGroupSelector().getValue()
selector = @getGroupDisplaySelector()
selector.activate(desiredGroup)
form.contains
type: "container"
span: 6
components:[
type: "text"
label: "Field One"
,
type: "text"
label: "Field Two"
,
type: "text"
label: "Field Three"
]
,
type: "container"
span: 6
components:[
label: "Select a Group"
type: "select"
role: "group_selector"
includeBlank: false
valueType: "string"
collection:
data:[
["alpha","Alpha Group"]
["bravo", "Bravo Group"]
["PI:NAME:<NAME>END_PIlie","PI:NAME:<NAME>END_PI Group"]
]
,
type: "card"
role: "group_display_selector"
components:[
name: "alpha"
defaults:
type: "text"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group One"
,
label: "Alpha"
,
label: "Bravo"
,
label: "PI:NAME:<NAME>END_PI"
]
,
name: "PI:NAME:<NAME>END_PIavo"
defaults:
type: "checkbox_field"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group Two"
,
label: "One"
,
label: "Two"
]
,
name: "PI:NAME:<NAME>END_PI"
defaults:
type: "button_field"
components:[
type: "view"
tagName: "h4"
bodyTemplate: ()-> "Group Three"
,
input_value: "Button One"
icon_class: "chevron-up"
,
input_value: "Button Two"
icon_class: "pencil"
]
]
] |
[
{
"context": "nges', ->\n component = @subject(model1: { name: 'foo' })\n @append()\n\n Ember.run ->\n component.set",
"end": 2663,
"score": 0.8761013746261597,
"start": 2660,
"tag": "NAME",
"value": "foo"
}
] | tests/unit/mixins/polling-test.coffee | 2947721120/travis-web | 0 | `import { test, moduleForComponent } from 'ember-qunit'`
`import Polling from 'travis/mixins/polling'`
hookRuns = 0
pollingChangesHistory = []
# define component just for testing
define('travis/components/polling-test', [], ->
PollingService = Ember.Object.extend(
startPolling: (model) ->
pollingChangesHistory.push(type: 'start', model: model)
stopPolling: (model) ->
pollingChangesHistory.push(type: 'stop', model: model)
startPollingHook: (source) ->
pollingChangesHistory.push(type: 'start-hook', source: source+'')
stopPollingHook: (source) ->
pollingChangesHistory.push(type: 'stop-hook', source: source+'')
)
Ember.Component.extend(Polling,
init: ->
@_super.apply this, arguments
@set('polling', PollingService.create())
pollModels: ['model1', 'model2'],
pollHook: ->
hookRuns += 1
toString: ->
'<PollingTestingComponent>'
)
)
# I want to test this mixin in context of component, so I'm using
# modelForComponent
moduleForComponent 'polling-test', 'PollingMixin', {
# specify the other units that are required for this test
needs: []
setup: ->
hookRuns = 0
pollingChangesHistory = []
}
test 'it properly stops polling hook without any models', ->
component = @subject(pollModels: null)
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start-hook', source: '<PollingTestingComponent>' },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it works even if one of the model is null', ->
component = @subject(model1: { name: 'model1' })
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'model1' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'model1' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it polls for both models if they are present', ->
component = @subject(model1: { name: 'model1' }, model2: { name: 'model2' })
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'model1' } },
{ type: 'start', model: { name: 'model2' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'model1' } },
{ type: 'stop', model: { name: 'model2' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it detects model changes', ->
component = @subject(model1: { name: 'foo' })
@append()
Ember.run ->
component.set('model1', { name: 'bar' })
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'foo' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'foo' } },
{ type: 'start', model: { name: 'bar' } },
{ type: 'stop', model: { name: 'bar' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
| 145760 | `import { test, moduleForComponent } from 'ember-qunit'`
`import Polling from 'travis/mixins/polling'`
hookRuns = 0
pollingChangesHistory = []
# define component just for testing
define('travis/components/polling-test', [], ->
PollingService = Ember.Object.extend(
startPolling: (model) ->
pollingChangesHistory.push(type: 'start', model: model)
stopPolling: (model) ->
pollingChangesHistory.push(type: 'stop', model: model)
startPollingHook: (source) ->
pollingChangesHistory.push(type: 'start-hook', source: source+'')
stopPollingHook: (source) ->
pollingChangesHistory.push(type: 'stop-hook', source: source+'')
)
Ember.Component.extend(Polling,
init: ->
@_super.apply this, arguments
@set('polling', PollingService.create())
pollModels: ['model1', 'model2'],
pollHook: ->
hookRuns += 1
toString: ->
'<PollingTestingComponent>'
)
)
# I want to test this mixin in context of component, so I'm using
# modelForComponent
moduleForComponent 'polling-test', 'PollingMixin', {
# specify the other units that are required for this test
needs: []
setup: ->
hookRuns = 0
pollingChangesHistory = []
}
test 'it properly stops polling hook without any models', ->
component = @subject(pollModels: null)
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start-hook', source: '<PollingTestingComponent>' },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it works even if one of the model is null', ->
component = @subject(model1: { name: 'model1' })
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'model1' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'model1' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it polls for both models if they are present', ->
component = @subject(model1: { name: 'model1' }, model2: { name: 'model2' })
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'model1' } },
{ type: 'start', model: { name: 'model2' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'model1' } },
{ type: 'stop', model: { name: 'model2' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it detects model changes', ->
component = @subject(model1: { name: '<NAME>' })
@append()
Ember.run ->
component.set('model1', { name: 'bar' })
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'foo' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'foo' } },
{ type: 'start', model: { name: 'bar' } },
{ type: 'stop', model: { name: 'bar' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
| true | `import { test, moduleForComponent } from 'ember-qunit'`
`import Polling from 'travis/mixins/polling'`
hookRuns = 0
pollingChangesHistory = []
# define component just for testing
define('travis/components/polling-test', [], ->
PollingService = Ember.Object.extend(
startPolling: (model) ->
pollingChangesHistory.push(type: 'start', model: model)
stopPolling: (model) ->
pollingChangesHistory.push(type: 'stop', model: model)
startPollingHook: (source) ->
pollingChangesHistory.push(type: 'start-hook', source: source+'')
stopPollingHook: (source) ->
pollingChangesHistory.push(type: 'stop-hook', source: source+'')
)
Ember.Component.extend(Polling,
init: ->
@_super.apply this, arguments
@set('polling', PollingService.create())
pollModels: ['model1', 'model2'],
pollHook: ->
hookRuns += 1
toString: ->
'<PollingTestingComponent>'
)
)
# I want to test this mixin in context of component, so I'm using
# modelForComponent
moduleForComponent 'polling-test', 'PollingMixin', {
# specify the other units that are required for this test
needs: []
setup: ->
hookRuns = 0
pollingChangesHistory = []
}
test 'it properly stops polling hook without any models', ->
component = @subject(pollModels: null)
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start-hook', source: '<PollingTestingComponent>' },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it works even if one of the model is null', ->
component = @subject(model1: { name: 'model1' })
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'model1' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'model1' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it polls for both models if they are present', ->
component = @subject(model1: { name: 'model1' }, model2: { name: 'model2' })
@append()
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'model1' } },
{ type: 'start', model: { name: 'model2' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'model1' } },
{ type: 'stop', model: { name: 'model2' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
test 'it detects model changes', ->
component = @subject(model1: { name: 'PI:NAME:<NAME>END_PI' })
@append()
Ember.run ->
component.set('model1', { name: 'bar' })
Ember.run ->
component.destroy()
expected = [
{ type: 'start', model: { name: 'foo' } },
{ type: 'start-hook', source: '<PollingTestingComponent>' }
{ type: 'stop', model: { name: 'foo' } },
{ type: 'start', model: { name: 'bar' } },
{ type: 'stop', model: { name: 'bar' } },
{ type: 'stop-hook', source: '<PollingTestingComponent>' }
]
deepEqual pollingChangesHistory, expected
|
[
{
"context": "ategy to test the Baker, NOT optimized\n{\n name: 'Big Money-Baker'\n author: 'DStu'\n requires: ['Baker",
"end": 57,
"score": 0.7864486575126648,
"start": 54,
"tag": "NAME",
"value": "Big"
},
{
"context": " optimized\n{\n name: 'Big Money-Baker'\n author: 'DStu'\n... | strategies/BigMoneyBaker.coffee | rspeer/dominiate | 65 | #strategy to test the Baker, NOT optimized
{
name: 'Big Money-Baker'
author: 'DStu'
requires: ['Baker']
gainPriority: (state, my) -> [
"Province" if my.getTotalMoney() > 18
"Duchy" if state.gainsToEndGame() <= 4
"Estate" if state.gainsToEndGame() <= 2
"Gold"
"Baker"
"Silver"
]
}
| 4113 | #strategy to test the Baker, NOT optimized
{
name: '<NAME> Money-Baker'
author: 'DStu'
requires: ['Baker']
gainPriority: (state, my) -> [
"Province" if my.getTotalMoney() > 18
"Duchy" if state.gainsToEndGame() <= 4
"Estate" if state.gainsToEndGame() <= 2
"Gold"
"Baker"
"Silver"
]
}
| true | #strategy to test the Baker, NOT optimized
{
name: 'PI:NAME:<NAME>END_PI Money-Baker'
author: 'DStu'
requires: ['Baker']
gainPriority: (state, my) -> [
"Province" if my.getTotalMoney() > 18
"Duchy" if state.gainsToEndGame() <= 4
"Estate" if state.gainsToEndGame() <= 2
"Gold"
"Baker"
"Silver"
]
}
|
[
{
"context": "ement\n\t@id: \"christmasLoginAchievement\"\n\t@title: \"HAPPY WINTER HOLIDAYS\"\n\t@description: \"ALL THE SNOWCHASERS HAVE GONE OU",
"end": 293,
"score": 0.6787737607955933,
"start": 272,
"tag": "NAME",
"value": "HAPPY WINTER HOLIDAYS"
}
] | app/sdk/achievements/loginBasedAchievements/christmasLoginAchievement.coffee | willroberts/duelyst | 5 | Achievement = require 'app/sdk/achievements/achievement'
moment = require 'moment'
GiftCrateLookup = require 'app/sdk/giftCrates/giftCrateLookup'
i18next = require('i18next')
class ChristmasLoginAchievement extends Achievement
@id: "christmasLoginAchievement"
@title: "HAPPY WINTER HOLIDAYS"
@description: "ALL THE SNOWCHASERS HAVE GONE OUT TO PLAY, SO TAKE THESE GIFTS TO CELEBRATE THIS SPECIAL DAY"
@progressRequired: 1
@rewards:
giftChests: [GiftCrateLookup.ChristmasLogin]
@enabled: true
@progressForLoggingIn: (currentLoginMoment) ->
if currentLoginMoment != null && currentLoginMoment.isAfter(moment.utc("2018-12-21T11:00-08:00")) and currentLoginMoment.isBefore(moment.utc("2018-12-28T11:00-08:00"))
return 1
else
return 0
@getLoginAchievementStartsMoment: () ->
return moment.utc("2018-12-21T11:00-08:00")
module.exports = ChristmasLoginAchievement
| 195999 | Achievement = require 'app/sdk/achievements/achievement'
moment = require 'moment'
GiftCrateLookup = require 'app/sdk/giftCrates/giftCrateLookup'
i18next = require('i18next')
class ChristmasLoginAchievement extends Achievement
@id: "christmasLoginAchievement"
@title: "<NAME>"
@description: "ALL THE SNOWCHASERS HAVE GONE OUT TO PLAY, SO TAKE THESE GIFTS TO CELEBRATE THIS SPECIAL DAY"
@progressRequired: 1
@rewards:
giftChests: [GiftCrateLookup.ChristmasLogin]
@enabled: true
@progressForLoggingIn: (currentLoginMoment) ->
if currentLoginMoment != null && currentLoginMoment.isAfter(moment.utc("2018-12-21T11:00-08:00")) and currentLoginMoment.isBefore(moment.utc("2018-12-28T11:00-08:00"))
return 1
else
return 0
@getLoginAchievementStartsMoment: () ->
return moment.utc("2018-12-21T11:00-08:00")
module.exports = ChristmasLoginAchievement
| true | Achievement = require 'app/sdk/achievements/achievement'
moment = require 'moment'
GiftCrateLookup = require 'app/sdk/giftCrates/giftCrateLookup'
i18next = require('i18next')
class ChristmasLoginAchievement extends Achievement
@id: "christmasLoginAchievement"
@title: "PI:NAME:<NAME>END_PI"
@description: "ALL THE SNOWCHASERS HAVE GONE OUT TO PLAY, SO TAKE THESE GIFTS TO CELEBRATE THIS SPECIAL DAY"
@progressRequired: 1
@rewards:
giftChests: [GiftCrateLookup.ChristmasLogin]
@enabled: true
@progressForLoggingIn: (currentLoginMoment) ->
if currentLoginMoment != null && currentLoginMoment.isAfter(moment.utc("2018-12-21T11:00-08:00")) and currentLoginMoment.isBefore(moment.utc("2018-12-28T11:00-08:00"))
return 1
else
return 0
@getLoginAchievementStartsMoment: () ->
return moment.utc("2018-12-21T11:00-08:00")
module.exports = ChristmasLoginAchievement
|
[
{
"context": "# Copyright Joyent, Inc. and other Node contributors.\n#\n# Permission",
"end": 18,
"score": 0.9979431629180908,
"start": 12,
"tag": "NAME",
"value": "Joyent"
}
] | test/simple/test-http-raw-headers.coffee | lxe/io.coffee | 0 | # Copyright Joyent, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
http = require("http")
http.createServer((req, res) ->
@close()
expectRawHeaders = [
"Host"
"localhost:" + common.PORT
"transfer-ENCODING"
"CHUNKED"
"x-BaR"
"yoyoyo"
"Connection"
"close"
]
expectHeaders =
host: "localhost:" + common.PORT
"transfer-encoding": "CHUNKED"
"x-bar": "yoyoyo"
connection: "close"
expectRawTrailers = [
"x-bAr"
"yOyOyOy"
"x-baR"
"OyOyOyO"
"X-bAr"
"yOyOyOy"
"X-baR"
"OyOyOyO"
]
expectTrailers = "x-bar": "yOyOyOy, OyOyOyO, yOyOyOy, OyOyOyO"
assert.deepEqual req.rawHeaders, expectRawHeaders
assert.deepEqual req.headers, expectHeaders
req.on "end", ->
assert.deepEqual req.rawTrailers, expectRawTrailers
assert.deepEqual req.trailers, expectTrailers
return
req.resume()
res.addTrailers [
[
"x-fOo"
"xOxOxOx"
]
[
"x-foO"
"OxOxOxO"
]
[
"X-fOo"
"xOxOxOx"
]
[
"X-foO"
"OxOxOxO"
]
]
res.end "x f o o"
return
).listen common.PORT, ->
expectRawHeaders = [
"Date"
"Tue, 06 Aug 2013 01:31:54 GMT"
"Connection"
"close"
"Transfer-Encoding"
"chunked"
]
req = http.request(
port: common.PORT
path: "/"
)
req.addTrailers [
[
"x-bAr"
"yOyOyOy"
]
[
"x-baR"
"OyOyOyO"
]
[
"X-bAr"
"yOyOyOy"
]
[
"X-baR"
"OyOyOyO"
]
]
req.setHeader "transfer-ENCODING", "CHUNKED"
req.setHeader "x-BaR", "yoyoyo"
req.end "y b a r"
req.on "response", (res) ->
expectRawHeaders = [
"Date"
null
"Connection"
"close"
"Transfer-Encoding"
"chunked"
]
expectHeaders =
date: null
connection: "close"
"transfer-encoding": "chunked"
res.rawHeaders[1] = null
res.headers.date = null
assert.deepEqual res.rawHeaders, expectRawHeaders
assert.deepEqual res.headers, expectHeaders
res.on "end", ->
expectRawTrailers = [
"x-fOo"
"xOxOxOx"
"x-foO"
"OxOxOxO"
"X-fOo"
"xOxOxOx"
"X-foO"
"OxOxOxO"
]
expectTrailers = "x-foo": "xOxOxOx, OxOxOxO, xOxOxOx, OxOxOxO"
assert.deepEqual res.rawTrailers, expectRawTrailers
assert.deepEqual res.trailers, expectTrailers
console.log "ok"
return
res.resume()
return
return
| 115611 | # Copyright <NAME>, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
http = require("http")
http.createServer((req, res) ->
@close()
expectRawHeaders = [
"Host"
"localhost:" + common.PORT
"transfer-ENCODING"
"CHUNKED"
"x-BaR"
"yoyoyo"
"Connection"
"close"
]
expectHeaders =
host: "localhost:" + common.PORT
"transfer-encoding": "CHUNKED"
"x-bar": "yoyoyo"
connection: "close"
expectRawTrailers = [
"x-bAr"
"yOyOyOy"
"x-baR"
"OyOyOyO"
"X-bAr"
"yOyOyOy"
"X-baR"
"OyOyOyO"
]
expectTrailers = "x-bar": "yOyOyOy, OyOyOyO, yOyOyOy, OyOyOyO"
assert.deepEqual req.rawHeaders, expectRawHeaders
assert.deepEqual req.headers, expectHeaders
req.on "end", ->
assert.deepEqual req.rawTrailers, expectRawTrailers
assert.deepEqual req.trailers, expectTrailers
return
req.resume()
res.addTrailers [
[
"x-fOo"
"xOxOxOx"
]
[
"x-foO"
"OxOxOxO"
]
[
"X-fOo"
"xOxOxOx"
]
[
"X-foO"
"OxOxOxO"
]
]
res.end "x f o o"
return
).listen common.PORT, ->
expectRawHeaders = [
"Date"
"Tue, 06 Aug 2013 01:31:54 GMT"
"Connection"
"close"
"Transfer-Encoding"
"chunked"
]
req = http.request(
port: common.PORT
path: "/"
)
req.addTrailers [
[
"x-bAr"
"yOyOyOy"
]
[
"x-baR"
"OyOyOyO"
]
[
"X-bAr"
"yOyOyOy"
]
[
"X-baR"
"OyOyOyO"
]
]
req.setHeader "transfer-ENCODING", "CHUNKED"
req.setHeader "x-BaR", "yoyoyo"
req.end "y b a r"
req.on "response", (res) ->
expectRawHeaders = [
"Date"
null
"Connection"
"close"
"Transfer-Encoding"
"chunked"
]
expectHeaders =
date: null
connection: "close"
"transfer-encoding": "chunked"
res.rawHeaders[1] = null
res.headers.date = null
assert.deepEqual res.rawHeaders, expectRawHeaders
assert.deepEqual res.headers, expectHeaders
res.on "end", ->
expectRawTrailers = [
"x-fOo"
"xOxOxOx"
"x-foO"
"OxOxOxO"
"X-fOo"
"xOxOxOx"
"X-foO"
"OxOxOxO"
]
expectTrailers = "x-foo": "xOxOxOx, OxOxOxO, xOxOxOx, OxOxOxO"
assert.deepEqual res.rawTrailers, expectRawTrailers
assert.deepEqual res.trailers, expectTrailers
console.log "ok"
return
res.resume()
return
return
| true | # Copyright PI:NAME:<NAME>END_PI, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
http = require("http")
http.createServer((req, res) ->
@close()
expectRawHeaders = [
"Host"
"localhost:" + common.PORT
"transfer-ENCODING"
"CHUNKED"
"x-BaR"
"yoyoyo"
"Connection"
"close"
]
expectHeaders =
host: "localhost:" + common.PORT
"transfer-encoding": "CHUNKED"
"x-bar": "yoyoyo"
connection: "close"
expectRawTrailers = [
"x-bAr"
"yOyOyOy"
"x-baR"
"OyOyOyO"
"X-bAr"
"yOyOyOy"
"X-baR"
"OyOyOyO"
]
expectTrailers = "x-bar": "yOyOyOy, OyOyOyO, yOyOyOy, OyOyOyO"
assert.deepEqual req.rawHeaders, expectRawHeaders
assert.deepEqual req.headers, expectHeaders
req.on "end", ->
assert.deepEqual req.rawTrailers, expectRawTrailers
assert.deepEqual req.trailers, expectTrailers
return
req.resume()
res.addTrailers [
[
"x-fOo"
"xOxOxOx"
]
[
"x-foO"
"OxOxOxO"
]
[
"X-fOo"
"xOxOxOx"
]
[
"X-foO"
"OxOxOxO"
]
]
res.end "x f o o"
return
).listen common.PORT, ->
expectRawHeaders = [
"Date"
"Tue, 06 Aug 2013 01:31:54 GMT"
"Connection"
"close"
"Transfer-Encoding"
"chunked"
]
req = http.request(
port: common.PORT
path: "/"
)
req.addTrailers [
[
"x-bAr"
"yOyOyOy"
]
[
"x-baR"
"OyOyOyO"
]
[
"X-bAr"
"yOyOyOy"
]
[
"X-baR"
"OyOyOyO"
]
]
req.setHeader "transfer-ENCODING", "CHUNKED"
req.setHeader "x-BaR", "yoyoyo"
req.end "y b a r"
req.on "response", (res) ->
expectRawHeaders = [
"Date"
null
"Connection"
"close"
"Transfer-Encoding"
"chunked"
]
expectHeaders =
date: null
connection: "close"
"transfer-encoding": "chunked"
res.rawHeaders[1] = null
res.headers.date = null
assert.deepEqual res.rawHeaders, expectRawHeaders
assert.deepEqual res.headers, expectHeaders
res.on "end", ->
expectRawTrailers = [
"x-fOo"
"xOxOxOx"
"x-foO"
"OxOxOxO"
"X-fOo"
"xOxOxOx"
"X-foO"
"OxOxOxO"
]
expectTrailers = "x-foo": "xOxOxOx, OxOxOxO, xOxOxOx, OxOxOxO"
assert.deepEqual res.rawTrailers, expectRawTrailers
assert.deepEqual res.trailers, expectTrailers
console.log "ok"
return
res.resume()
return
return
|
[
{
"context": "dy: \"{\\n \\\"type\\\": \\\"bulldozer\\\",\\n \\\"name\\\": \\\"willy\\\",\\n \\\"id\\\": \\\"5229c6e8e4b0bd7dbb07e29c\\\"\\n}\\n\"\n",
"end": 2360,
"score": 0.9989495873451233,
"start": 2355,
"tag": "NAME",
"value": "willy"
},
{
"context": "dy: \"{\\n \\\"type\\\"... | test/unit/reporters/apiary-reporter-test.coffee | jasonrayles-nbcuni/dredd-public | 0 | {assert} = require 'chai'
{EventEmitter} = require 'events'
proxyquire = require 'proxyquire'
nock = require 'nock'
nock.enableNetConnect()
clone = require 'clone'
sinon = require 'sinon'
loggerStub = require '../../../src/logger'
ApiaryReporter = proxyquire '../../../src/reporters/apiary-reporter', {
'./../logger': loggerStub
}
PORT = 9876
blueprintData = require '../../fixtures/blueprint-data'
describe 'ApiaryReporter', () ->
env = {}
beforeEach () ->
sinon.stub loggerStub, 'info'
sinon.stub loggerStub, 'complete'
sinon.stub loggerStub, 'error'
sinon.stub loggerStub, 'warn'
afterEach () ->
sinon.stub loggerStub.info.restore()
sinon.stub loggerStub.complete.restore()
sinon.stub loggerStub.error.restore()
sinon.stub loggerStub.warn.restore()
before () ->
nock.disableNetConnect()
after () ->
nock.enableNetConnect()
describe 'without API key or without suite', () ->
stats = {}
tests = []
test = {}
emitter = {}
beforeEach (done) ->
stats =
tests: 0
failures: 0
errors: 0
passes: 0
skipped: 0
start: 0
end: 0
duration: 0
tests = []
emitter = new EventEmitter
env = {'CIRCLE_VARIABLE': 'CIRCLE_VALUE'}
env['APIARY_API_URL'] = "https://localhost:#{PORT}"
delete env['APIARY_API_KEY']
delete env['APIARY_API_NAME']
test =
status: "fail"
title: "POST /machines"
message: "headers: Value of the ‘content-type’ must be application/json.\nbody: No validator found for real data media type 'text/plain' and expected data media type 'application/json'.\nstatusCode: Real and expected data does not match.\n"
startedAt: (1234567890 * 1000) # JavaScript Date.now() timestamp (UNIX-like timestamp * 1000 precision)
origin:
filename: './test/fixtures/multifile/greeting.apib'
apiName: 'Greeting API'
resourceGroupName: ''
resourceName: '/greeting'
actionName: 'GET'
exampleName: ''
actual:
statusCode: 400
headers:
"content-type": "text/plain"
body: "Foo bar"
expected:
headers:
"content-type": "application/json"
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"willy\",\n \"id\": \"5229c6e8e4b0bd7dbb07e29c\"\n}\n"
status: "202"
request:
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"willy\"}\n"
headers:
"Content-Type": "application/json"
"User-Agent": "Dredd/0.2.1 (Darwin 13.0.0; x64)"
"Content-Length": 44
uri: "/machines"
method: "POST"
results:
headers:
results: [
pointer: "/content-type"
severity: "error"
message: "Value of the ‘content-type’ must be application/json."
]
realType: "application/vnd.apiary.http-headers+json"
expectedType: "application/vnd.apiary.http-headers+json"
validator: "HeadersJsonExample"
rawData:
0:
property: ["content-type"]
propertyValue: "text/plain"
attributeName: "enum"
attributeValue: ["application/json"]
message: "Value of the ‘content-type’ must be application/json."
validator: "enum"
validatorName: "enum"
validatorValue: ["application/json"]
length: 1
body:
results: [
message: "No validator found for real data media type 'text/plain' and expected data media type 'application/json'."
severity: "error"
]
realType: "text/plain"
expectedType: "application/json"
validator: null
rawData: null
statusCode:
realType: "text/vnd.apiary.status-code"
expectedType: "text/vnd.apiary.status-code"
validator: "TextDiff"
rawData: "@@ -1,3 +1,9 @@\n-400\n+undefined\n"
results: [
severity: "error"
message: "Real and expected data does not match."
]
nock.disableNetConnect()
done()
afterEach (done) ->
nock.enableNetConnect()
nock.cleanAll()
done()
describe "_performRequestAsync", () ->
describe 'when server is not available', () ->
beforeEach () ->
nock.enableNetConnect()
nock.cleanAll()
it 'should log human readable message', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter._performRequestAsync '/', 'POST', '', (error) ->
assert.isNotNull error
done()
it 'should set server error to true', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter._performRequestAsync '/', 'POST', '', () ->
assert.isTrue apiaryReporter.serverError
done()
describe 'when starting', () ->
call = null
runId = '507f1f77bcf86cd799439011'
requestBody = null
beforeEach () ->
requestBody = null
uri = '/apis/public/tests/runs'
reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, JSON.stringify({"_id": runId, "reportUrl": reportUrl}))
it 'should set uuid', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.uuid
done()
it 'should set start time', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.startedAt
done()
it 'should call "create new test run" HTTP resource', (done ) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isTrue call.isDone()
done()
it 'should attach test run ID back to the reporter as remoteId', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.remoteId
done()
it 'should attach test run reportUrl to the reporter as reportUrl', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.reportUrl
done()
it 'should have blueprints key in the request and it should be an array and members should have proper structure', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.isArray parsedBody.blueprints
assert.lengthOf parsedBody.blueprints, 1
for blueprint in parsedBody.blueprints
assert.property blueprint, 'raw'
assert.propertyVal blueprint, 'raw', "# GET /message\n+ Response 200 (text/plain)\n\n Hello World!\n"
assert.property blueprint, 'filename'
assert.propertyVal blueprint, 'filename', './path/to/blueprint.file'
assert.property blueprint, 'parsed'
assert.deepProperty blueprint, 'parsed._version'
assert.deepProperty blueprint, 'parsed.warnings'
assert.notProperty blueprint.parsed, 'ast'
assert.isArray blueprint.parsed.warnings
done()
it 'should have various needed keys in test-run payload sent to apiary', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.propertyVal parsedBody, 'endpoint', 'http://my.server.co:8080'
done()
it 'should send the test-run as public one', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.strictEqual parsedBody.public, true
done()
describe 'serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.serverError = true
emitter.emit 'start', blueprintData, () ->
assert.isFalse call.isDone()
done()
describe 'when adding passing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
assert.isTrue call.isDone()
done()
it 'should have origin with filename in the request', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
parsedBody = JSON.parse requestBody
assert.property parsedBody['origin'], 'filename'
done()
it 'should have startedAt timestamp in the request', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
parsedBody = JSON.parse requestBody
assert.propertyVal parsedBody, 'startedAt', (1234567890 * 1000)
done()
describe 'serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test pass', test, () ->
assert.isFalse call.isDone()
done()
describe 'when adding failing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test fail', test, () ->
assert.isTrue call.isDone()
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test fail', test, () ->
assert.isFalse call.isDone()
done()
describe 'when adding skipped test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
clonedTest = null
requestBody = null
beforeEach () ->
clonedTest = clone(test)
clonedTest.status = 'skip'
uri = '/apis/public/tests/steps?testRunId=' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test skip', clonedTest, () ->
assert.isTrue call.isDone()
done()
it 'should send status skipped', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test skip', clonedTest, () ->
assert.equal JSON.parse(requestBody)['result'], 'skip'
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test skip', clonedTest, () ->
assert.isFalse call.isDone()
done()
describe 'when adding test with error', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
test['status'] = 'error'
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
connectionErrors = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE']
for errType in connectionErrors then do (errType) ->
describe "when error type is #{errType}", () ->
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.isTrue call.isDone()
done()
it 'should set result to error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.equal JSON.parse(requestBody)['result'], 'error'
done()
it 'should set error message', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.isArray JSON.parse(requestBody)['resultData']['result']['general']
assert.include JSON.parse(requestBody)['resultData']['result']['general'].map((value,index) -> JSON.stringify(value)).join(),
"Error connecting to server under test!"
done()
describe 'when any other error', () ->
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isTrue call.isDone()
done()
it 'should set result to error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.equal JSON.parse(requestBody)['result'], 'error'
done()
it 'should set descriptive error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isArray JSON.parse(requestBody)['resultData']['result']['general']
assert.include JSON.parse(requestBody)['resultData']['result']['general'].map((value,index) -> JSON.stringify(value)).join(),
"Unhandled error occured when executing the transaction."
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isFalse call.isDone()
done()
describe 'when ending', () ->
call = null
runId = '507f1f77bcf86cd799439011'
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/run/' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
patch(uri).
reply(201, {"_id": runId})
it 'should update "test run" resource with result data', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isTrue call.isDone()
done()
it 'should return generated url if no reportUrl is available', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://app.apiary.io/public/tests/run/507f1f77bcf86cd799439011'
done()
it 'should return reportUrl from testRun entity', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://absolutely.fancy.url/wich-can-change/some/id'
done()
it 'should send runner.logs to Apiary at the end of testRun', (done) ->
emitter = new EventEmitter
logMessages = ['a', 'b']
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}, {logs: clone(logMessages)}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isString requestBody
parsedBody = JSON.parse requestBody
assert.isObject parsedBody
assert.property parsedBody, 'logs'
assert.deepEqual parsedBody.logs, logMessages
done()
describe 'serverError is true', () ->
it 'should not do enything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'end', () ->
assert.isFalse call.isDone()
done()
describe 'with Apiary API token and suite id', () ->
stats = {}
tests = []
test = {}
emitter = {}
env = {}
beforeEach (done) ->
stats =
tests: 0
failures: 0
errors: 0
passes: 0
skipped: 0
start: 0
end: 0
duration: 0
tests = []
emitter = new EventEmitter
env = {}
env['APIARY_API_URL'] = "https://localhost:#{PORT}"
env['APIARY_API_KEY'] = "aff888af9993db9ef70edf3c878ab521"
env['APIARY_API_NAME'] = "jakubtest"
test =
status: "fail"
title: "POST /machines"
message: "headers: Value of the ‘content-type’ must be application/json.\nbody: No validator found for real data media type 'text/plain' and expected data media type 'application/json'.\nstatusCode: Real and expected data does not match.\n"
startedAt: (1234567890 * 1000) # JavaScript Date.now() timestamp (UNIX-like timestamp * 1000 precision)
actual:
statusCode: 400
headers:
"content-type": "text/plain"
body: "Foo bar"
expected:
headers:
"content-type": "application/json"
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"willy\",\n \"id\": \"5229c6e8e4b0bd7dbb07e29c\"\n}\n"
status: "202"
request:
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"willy\"}\n"
headers:
"Content-Type": "application/json"
"User-Agent": "Dredd/0.2.1 (Darwin 13.0.0; x64)"
"Content-Length": 44
uri: "/machines"
method: "POST"
results:
headers:
results: [
pointer: "/content-type"
severity: "error"
message: "Value of the ‘content-type’ must be application/json."
]
realType: "application/vnd.apiary.http-headers+json"
expectedType: "application/vnd.apiary.http-headers+json"
validator: "HeadersJsonExample"
rawData:
0:
property: ["content-type"]
propertyValue: "text/plain"
attributeName: "enum"
attributeValue: ["application/json"]
message: "Value of the ‘content-type’ must be application/json."
validator: "enum"
validatorName: "enum"
validatorValue: ["application/json"]
length: 1
body:
results: [
message: "No validator found for real data media type 'text/plain' and expected data media type 'application/json'."
severity: "error"
]
realType: "text/plain"
expectedType: "application/json"
validator: null
rawData: null
statusCode:
realType: "text/vnd.apiary.status-code"
expectedType: "text/vnd.apiary.status-code"
validator: "TextDiff"
rawData: "@@ -1,3 +1,9 @@\n-400\n+undefined\n"
results: [
severity: "error"
message: "Real and expected data does not match."
]
nock.disableNetConnect()
done()
afterEach (done) ->
nock.enableNetConnect()
nock.cleanAll()
done()
describe 'when starting', () ->
call = null
runId = '507f1f77bcf86cd799439011'
reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
requestBody = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/runs'
requestBody = null
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId, "reportUrl": reportUrl})
it 'should set uuid', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.uuid
done()
it 'should set start time', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.startedAt
done()
it 'should call "create new test run" HTTP resource', (done ) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isTrue call.isDone()
done()
it 'should attach test run ID back to the reporter as remoteId', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.remoteId
done()
it 'should attach test run reportUrl to the reporter as reportUrl', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.reportUrl
done()
it 'should send the test-run as non-public', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.strictEqual parsedBody.public, false
done()
describe 'when adding passing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
assert.isTrue call.isDone()
done()
describe 'when adding failing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test fail', test, () ->
assert.isTrue call.isDone()
done()
describe 'when ending', () ->
call = null
runId = '507f1f77bcf86cd799439011'
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/run/' + runId
call = nock(env['APIARY_API_URL']).
patch(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should update "test run" resource with result data', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isTrue call.isDone()
done()
it 'should return generated url if reportUrl is not available', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://app.apiary.io/jakubtest/tests/run/507f1f77bcf86cd799439011'
done()
it 'should return reportUrl from testRun entity', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://absolutely.fancy.url/wich-can-change/some/id'
done()
| 128698 | {assert} = require 'chai'
{EventEmitter} = require 'events'
proxyquire = require 'proxyquire'
nock = require 'nock'
nock.enableNetConnect()
clone = require 'clone'
sinon = require 'sinon'
loggerStub = require '../../../src/logger'
ApiaryReporter = proxyquire '../../../src/reporters/apiary-reporter', {
'./../logger': loggerStub
}
PORT = 9876
blueprintData = require '../../fixtures/blueprint-data'
describe 'ApiaryReporter', () ->
env = {}
beforeEach () ->
sinon.stub loggerStub, 'info'
sinon.stub loggerStub, 'complete'
sinon.stub loggerStub, 'error'
sinon.stub loggerStub, 'warn'
afterEach () ->
sinon.stub loggerStub.info.restore()
sinon.stub loggerStub.complete.restore()
sinon.stub loggerStub.error.restore()
sinon.stub loggerStub.warn.restore()
before () ->
nock.disableNetConnect()
after () ->
nock.enableNetConnect()
describe 'without API key or without suite', () ->
stats = {}
tests = []
test = {}
emitter = {}
beforeEach (done) ->
stats =
tests: 0
failures: 0
errors: 0
passes: 0
skipped: 0
start: 0
end: 0
duration: 0
tests = []
emitter = new EventEmitter
env = {'CIRCLE_VARIABLE': 'CIRCLE_VALUE'}
env['APIARY_API_URL'] = "https://localhost:#{PORT}"
delete env['APIARY_API_KEY']
delete env['APIARY_API_NAME']
test =
status: "fail"
title: "POST /machines"
message: "headers: Value of the ‘content-type’ must be application/json.\nbody: No validator found for real data media type 'text/plain' and expected data media type 'application/json'.\nstatusCode: Real and expected data does not match.\n"
startedAt: (1234567890 * 1000) # JavaScript Date.now() timestamp (UNIX-like timestamp * 1000 precision)
origin:
filename: './test/fixtures/multifile/greeting.apib'
apiName: 'Greeting API'
resourceGroupName: ''
resourceName: '/greeting'
actionName: 'GET'
exampleName: ''
actual:
statusCode: 400
headers:
"content-type": "text/plain"
body: "Foo bar"
expected:
headers:
"content-type": "application/json"
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"<NAME>\",\n \"id\": \"5229c6e8e4b0bd7dbb07e29c\"\n}\n"
status: "202"
request:
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"<NAME>\"}\n"
headers:
"Content-Type": "application/json"
"User-Agent": "Dredd/0.2.1 (Darwin 13.0.0; x64)"
"Content-Length": 44
uri: "/machines"
method: "POST"
results:
headers:
results: [
pointer: "/content-type"
severity: "error"
message: "Value of the ‘content-type’ must be application/json."
]
realType: "application/vnd.apiary.http-headers+json"
expectedType: "application/vnd.apiary.http-headers+json"
validator: "HeadersJsonExample"
rawData:
0:
property: ["content-type"]
propertyValue: "text/plain"
attributeName: "enum"
attributeValue: ["application/json"]
message: "Value of the ‘content-type’ must be application/json."
validator: "enum"
validatorName: "enum"
validatorValue: ["application/json"]
length: 1
body:
results: [
message: "No validator found for real data media type 'text/plain' and expected data media type 'application/json'."
severity: "error"
]
realType: "text/plain"
expectedType: "application/json"
validator: null
rawData: null
statusCode:
realType: "text/vnd.apiary.status-code"
expectedType: "text/vnd.apiary.status-code"
validator: "TextDiff"
rawData: "@@ -1,3 +1,9 @@\n-400\n+undefined\n"
results: [
severity: "error"
message: "Real and expected data does not match."
]
nock.disableNetConnect()
done()
afterEach (done) ->
nock.enableNetConnect()
nock.cleanAll()
done()
describe "_performRequestAsync", () ->
describe 'when server is not available', () ->
beforeEach () ->
nock.enableNetConnect()
nock.cleanAll()
it 'should log human readable message', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter._performRequestAsync '/', 'POST', '', (error) ->
assert.isNotNull error
done()
it 'should set server error to true', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter._performRequestAsync '/', 'POST', '', () ->
assert.isTrue apiaryReporter.serverError
done()
describe 'when starting', () ->
call = null
runId = '507f1f77bcf86cd799439011'
requestBody = null
beforeEach () ->
requestBody = null
uri = '/apis/public/tests/runs'
reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, JSON.stringify({"_id": runId, "reportUrl": reportUrl}))
it 'should set uuid', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.uuid
done()
it 'should set start time', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.startedAt
done()
it 'should call "create new test run" HTTP resource', (done ) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isTrue call.isDone()
done()
it 'should attach test run ID back to the reporter as remoteId', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.remoteId
done()
it 'should attach test run reportUrl to the reporter as reportUrl', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.reportUrl
done()
it 'should have blueprints key in the request and it should be an array and members should have proper structure', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.isArray parsedBody.blueprints
assert.lengthOf parsedBody.blueprints, 1
for blueprint in parsedBody.blueprints
assert.property blueprint, 'raw'
assert.propertyVal blueprint, 'raw', "# GET /message\n+ Response 200 (text/plain)\n\n Hello World!\n"
assert.property blueprint, 'filename'
assert.propertyVal blueprint, 'filename', './path/to/blueprint.file'
assert.property blueprint, 'parsed'
assert.deepProperty blueprint, 'parsed._version'
assert.deepProperty blueprint, 'parsed.warnings'
assert.notProperty blueprint.parsed, 'ast'
assert.isArray blueprint.parsed.warnings
done()
it 'should have various needed keys in test-run payload sent to apiary', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.propertyVal parsedBody, 'endpoint', 'http://my.server.co:8080'
done()
it 'should send the test-run as public one', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.strictEqual parsedBody.public, true
done()
describe 'serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.serverError = true
emitter.emit 'start', blueprintData, () ->
assert.isFalse call.isDone()
done()
describe 'when adding passing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
assert.isTrue call.isDone()
done()
it 'should have origin with filename in the request', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
parsedBody = JSON.parse requestBody
assert.property parsedBody['origin'], 'filename'
done()
it 'should have startedAt timestamp in the request', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
parsedBody = JSON.parse requestBody
assert.propertyVal parsedBody, 'startedAt', (1234567890 * 1000)
done()
describe 'serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test pass', test, () ->
assert.isFalse call.isDone()
done()
describe 'when adding failing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test fail', test, () ->
assert.isTrue call.isDone()
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test fail', test, () ->
assert.isFalse call.isDone()
done()
describe 'when adding skipped test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
clonedTest = null
requestBody = null
beforeEach () ->
clonedTest = clone(test)
clonedTest.status = 'skip'
uri = '/apis/public/tests/steps?testRunId=' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test skip', clonedTest, () ->
assert.isTrue call.isDone()
done()
it 'should send status skipped', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test skip', clonedTest, () ->
assert.equal JSON.parse(requestBody)['result'], 'skip'
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test skip', clonedTest, () ->
assert.isFalse call.isDone()
done()
describe 'when adding test with error', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
test['status'] = 'error'
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
connectionErrors = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE']
for errType in connectionErrors then do (errType) ->
describe "when error type is #{errType}", () ->
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.isTrue call.isDone()
done()
it 'should set result to error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.equal JSON.parse(requestBody)['result'], 'error'
done()
it 'should set error message', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.isArray JSON.parse(requestBody)['resultData']['result']['general']
assert.include JSON.parse(requestBody)['resultData']['result']['general'].map((value,index) -> JSON.stringify(value)).join(),
"Error connecting to server under test!"
done()
describe 'when any other error', () ->
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isTrue call.isDone()
done()
it 'should set result to error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.equal JSON.parse(requestBody)['result'], 'error'
done()
it 'should set descriptive error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isArray JSON.parse(requestBody)['resultData']['result']['general']
assert.include JSON.parse(requestBody)['resultData']['result']['general'].map((value,index) -> JSON.stringify(value)).join(),
"Unhandled error occured when executing the transaction."
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isFalse call.isDone()
done()
describe 'when ending', () ->
call = null
runId = '507f1f77bcf86cd799439011'
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/run/' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
patch(uri).
reply(201, {"_id": runId})
it 'should update "test run" resource with result data', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isTrue call.isDone()
done()
it 'should return generated url if no reportUrl is available', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://app.apiary.io/public/tests/run/507f1f77bcf86cd799439011'
done()
it 'should return reportUrl from testRun entity', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://absolutely.fancy.url/wich-can-change/some/id'
done()
it 'should send runner.logs to Apiary at the end of testRun', (done) ->
emitter = new EventEmitter
logMessages = ['a', 'b']
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}, {logs: clone(logMessages)}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isString requestBody
parsedBody = JSON.parse requestBody
assert.isObject parsedBody
assert.property parsedBody, 'logs'
assert.deepEqual parsedBody.logs, logMessages
done()
describe 'serverError is true', () ->
it 'should not do enything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'end', () ->
assert.isFalse call.isDone()
done()
describe 'with Apiary API token and suite id', () ->
stats = {}
tests = []
test = {}
emitter = {}
env = {}
beforeEach (done) ->
stats =
tests: 0
failures: 0
errors: 0
passes: 0
skipped: 0
start: 0
end: 0
duration: 0
tests = []
emitter = new EventEmitter
env = {}
env['APIARY_API_URL'] = "https://localhost:#{PORT}"
env['APIARY_API_KEY'] = "<KEY>"
env['APIARY_API_NAME'] = "jakubtest"
test =
status: "fail"
title: "POST /machines"
message: "headers: Value of the ‘content-type’ must be application/json.\nbody: No validator found for real data media type 'text/plain' and expected data media type 'application/json'.\nstatusCode: Real and expected data does not match.\n"
startedAt: (1234567890 * 1000) # JavaScript Date.now() timestamp (UNIX-like timestamp * 1000 precision)
actual:
statusCode: 400
headers:
"content-type": "text/plain"
body: "Foo bar"
expected:
headers:
"content-type": "application/json"
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"<NAME>\",\n \"id\": \"5229c6e8e4b0bd7dbb07e29c\"\n}\n"
status: "202"
request:
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"<NAME>\"}\n"
headers:
"Content-Type": "application/json"
"User-Agent": "Dredd/0.2.1 (Darwin 13.0.0; x64)"
"Content-Length": 44
uri: "/machines"
method: "POST"
results:
headers:
results: [
pointer: "/content-type"
severity: "error"
message: "Value of the ‘content-type’ must be application/json."
]
realType: "application/vnd.apiary.http-headers+json"
expectedType: "application/vnd.apiary.http-headers+json"
validator: "HeadersJsonExample"
rawData:
0:
property: ["content-type"]
propertyValue: "text/plain"
attributeName: "enum"
attributeValue: ["application/json"]
message: "Value of the ‘content-type’ must be application/json."
validator: "enum"
validatorName: "enum"
validatorValue: ["application/json"]
length: 1
body:
results: [
message: "No validator found for real data media type 'text/plain' and expected data media type 'application/json'."
severity: "error"
]
realType: "text/plain"
expectedType: "application/json"
validator: null
rawData: null
statusCode:
realType: "text/vnd.apiary.status-code"
expectedType: "text/vnd.apiary.status-code"
validator: "TextDiff"
rawData: "@@ -1,3 +1,9 @@\n-400\n+undefined\n"
results: [
severity: "error"
message: "Real and expected data does not match."
]
nock.disableNetConnect()
done()
afterEach (done) ->
nock.enableNetConnect()
nock.cleanAll()
done()
describe 'when starting', () ->
call = null
runId = '507f1f77bcf86cd799439011'
reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
requestBody = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/runs'
requestBody = null
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId, "reportUrl": reportUrl})
it 'should set uuid', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.uuid
done()
it 'should set start time', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.startedAt
done()
it 'should call "create new test run" HTTP resource', (done ) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isTrue call.isDone()
done()
it 'should attach test run ID back to the reporter as remoteId', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.remoteId
done()
it 'should attach test run reportUrl to the reporter as reportUrl', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.reportUrl
done()
it 'should send the test-run as non-public', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.strictEqual parsedBody.public, false
done()
describe 'when adding passing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
assert.isTrue call.isDone()
done()
describe 'when adding failing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test fail', test, () ->
assert.isTrue call.isDone()
done()
describe 'when ending', () ->
call = null
runId = '507f1f77bcf86cd799439011'
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/run/' + runId
call = nock(env['APIARY_API_URL']).
patch(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should update "test run" resource with result data', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isTrue call.isDone()
done()
it 'should return generated url if reportUrl is not available', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://app.apiary.io/jakubtest/tests/run/507f1f77bcf86cd799439011'
done()
it 'should return reportUrl from testRun entity', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://absolutely.fancy.url/wich-can-change/some/id'
done()
| true | {assert} = require 'chai'
{EventEmitter} = require 'events'
proxyquire = require 'proxyquire'
nock = require 'nock'
nock.enableNetConnect()
clone = require 'clone'
sinon = require 'sinon'
loggerStub = require '../../../src/logger'
ApiaryReporter = proxyquire '../../../src/reporters/apiary-reporter', {
'./../logger': loggerStub
}
PORT = 9876
blueprintData = require '../../fixtures/blueprint-data'
describe 'ApiaryReporter', () ->
env = {}
beforeEach () ->
sinon.stub loggerStub, 'info'
sinon.stub loggerStub, 'complete'
sinon.stub loggerStub, 'error'
sinon.stub loggerStub, 'warn'
afterEach () ->
sinon.stub loggerStub.info.restore()
sinon.stub loggerStub.complete.restore()
sinon.stub loggerStub.error.restore()
sinon.stub loggerStub.warn.restore()
before () ->
nock.disableNetConnect()
after () ->
nock.enableNetConnect()
describe 'without API key or without suite', () ->
stats = {}
tests = []
test = {}
emitter = {}
beforeEach (done) ->
stats =
tests: 0
failures: 0
errors: 0
passes: 0
skipped: 0
start: 0
end: 0
duration: 0
tests = []
emitter = new EventEmitter
env = {'CIRCLE_VARIABLE': 'CIRCLE_VALUE'}
env['APIARY_API_URL'] = "https://localhost:#{PORT}"
delete env['APIARY_API_KEY']
delete env['APIARY_API_NAME']
test =
status: "fail"
title: "POST /machines"
message: "headers: Value of the ‘content-type’ must be application/json.\nbody: No validator found for real data media type 'text/plain' and expected data media type 'application/json'.\nstatusCode: Real and expected data does not match.\n"
startedAt: (1234567890 * 1000) # JavaScript Date.now() timestamp (UNIX-like timestamp * 1000 precision)
origin:
filename: './test/fixtures/multifile/greeting.apib'
apiName: 'Greeting API'
resourceGroupName: ''
resourceName: '/greeting'
actionName: 'GET'
exampleName: ''
actual:
statusCode: 400
headers:
"content-type": "text/plain"
body: "Foo bar"
expected:
headers:
"content-type": "application/json"
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"PI:NAME:<NAME>END_PI\",\n \"id\": \"5229c6e8e4b0bd7dbb07e29c\"\n}\n"
status: "202"
request:
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"PI:NAME:<NAME>END_PI\"}\n"
headers:
"Content-Type": "application/json"
"User-Agent": "Dredd/0.2.1 (Darwin 13.0.0; x64)"
"Content-Length": 44
uri: "/machines"
method: "POST"
results:
headers:
results: [
pointer: "/content-type"
severity: "error"
message: "Value of the ‘content-type’ must be application/json."
]
realType: "application/vnd.apiary.http-headers+json"
expectedType: "application/vnd.apiary.http-headers+json"
validator: "HeadersJsonExample"
rawData:
0:
property: ["content-type"]
propertyValue: "text/plain"
attributeName: "enum"
attributeValue: ["application/json"]
message: "Value of the ‘content-type’ must be application/json."
validator: "enum"
validatorName: "enum"
validatorValue: ["application/json"]
length: 1
body:
results: [
message: "No validator found for real data media type 'text/plain' and expected data media type 'application/json'."
severity: "error"
]
realType: "text/plain"
expectedType: "application/json"
validator: null
rawData: null
statusCode:
realType: "text/vnd.apiary.status-code"
expectedType: "text/vnd.apiary.status-code"
validator: "TextDiff"
rawData: "@@ -1,3 +1,9 @@\n-400\n+undefined\n"
results: [
severity: "error"
message: "Real and expected data does not match."
]
nock.disableNetConnect()
done()
afterEach (done) ->
nock.enableNetConnect()
nock.cleanAll()
done()
describe "_performRequestAsync", () ->
describe 'when server is not available', () ->
beforeEach () ->
nock.enableNetConnect()
nock.cleanAll()
it 'should log human readable message', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter._performRequestAsync '/', 'POST', '', (error) ->
assert.isNotNull error
done()
it 'should set server error to true', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter._performRequestAsync '/', 'POST', '', () ->
assert.isTrue apiaryReporter.serverError
done()
describe 'when starting', () ->
call = null
runId = '507f1f77bcf86cd799439011'
requestBody = null
beforeEach () ->
requestBody = null
uri = '/apis/public/tests/runs'
reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, JSON.stringify({"_id": runId, "reportUrl": reportUrl}))
it 'should set uuid', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.uuid
done()
it 'should set start time', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.startedAt
done()
it 'should call "create new test run" HTTP resource', (done ) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isTrue call.isDone()
done()
it 'should attach test run ID back to the reporter as remoteId', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.remoteId
done()
it 'should attach test run reportUrl to the reporter as reportUrl', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.reportUrl
done()
it 'should have blueprints key in the request and it should be an array and members should have proper structure', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.isArray parsedBody.blueprints
assert.lengthOf parsedBody.blueprints, 1
for blueprint in parsedBody.blueprints
assert.property blueprint, 'raw'
assert.propertyVal blueprint, 'raw', "# GET /message\n+ Response 200 (text/plain)\n\n Hello World!\n"
assert.property blueprint, 'filename'
assert.propertyVal blueprint, 'filename', './path/to/blueprint.file'
assert.property blueprint, 'parsed'
assert.deepProperty blueprint, 'parsed._version'
assert.deepProperty blueprint, 'parsed.warnings'
assert.notProperty blueprint.parsed, 'ast'
assert.isArray blueprint.parsed.warnings
done()
it 'should have various needed keys in test-run payload sent to apiary', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.propertyVal parsedBody, 'endpoint', 'http://my.server.co:8080'
done()
it 'should send the test-run as public one', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.strictEqual parsedBody.public, true
done()
describe 'serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.serverError = true
emitter.emit 'start', blueprintData, () ->
assert.isFalse call.isDone()
done()
describe 'when adding passing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
assert.isTrue call.isDone()
done()
it 'should have origin with filename in the request', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
parsedBody = JSON.parse requestBody
assert.property parsedBody['origin'], 'filename'
done()
it 'should have startedAt timestamp in the request', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
parsedBody = JSON.parse requestBody
assert.propertyVal parsedBody, 'startedAt', (1234567890 * 1000)
done()
describe 'serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test pass', test, () ->
assert.isFalse call.isDone()
done()
describe 'when adding failing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test fail', test, () ->
assert.isTrue call.isDone()
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test fail', test, () ->
assert.isFalse call.isDone()
done()
describe 'when adding skipped test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
clonedTest = null
requestBody = null
beforeEach () ->
clonedTest = clone(test)
clonedTest.status = 'skip'
uri = '/apis/public/tests/steps?testRunId=' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test skip', clonedTest, () ->
assert.isTrue call.isDone()
done()
it 'should send status skipped', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test skip', clonedTest, () ->
assert.equal JSON.parse(requestBody)['result'], 'skip'
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'test skip', clonedTest, () ->
assert.isFalse call.isDone()
done()
describe 'when adding test with error', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/steps?testRunId=' + runId
test['status'] = 'error'
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
reply(201, {"_id": runId})
connectionErrors = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE']
for errType in connectionErrors then do (errType) ->
describe "when error type is #{errType}", () ->
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.isTrue call.isDone()
done()
it 'should set result to error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.equal JSON.parse(requestBody)['result'], 'error'
done()
it 'should set error message', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
error.code = errType
emitter.emit 'test error', error, test, () ->
assert.isArray JSON.parse(requestBody)['resultData']['result']['general']
assert.include JSON.parse(requestBody)['resultData']['result']['general'].map((value,index) -> JSON.stringify(value)).join(),
"Error connecting to server under test!"
done()
describe 'when any other error', () ->
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isTrue call.isDone()
done()
it 'should set result to error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.equal JSON.parse(requestBody)['result'], 'error'
done()
it 'should set descriptive error', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isArray JSON.parse(requestBody)['resultData']['result']['general']
assert.include JSON.parse(requestBody)['resultData']['result']['general'].map((value,index) -> JSON.stringify(value)).join(),
"Unhandled error occured when executing the transaction."
done()
describe 'when serverError is true', () ->
it 'should not do anything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
error = new Error 'some error'
emitter.emit 'test error', error, test, () ->
assert.isFalse call.isDone()
done()
describe 'when ending', () ->
call = null
runId = '507f1f77bcf86cd799439011'
requestBody = null
beforeEach () ->
uri = '/apis/public/tests/run/' + runId
# this is a hack how to get access to the performed request from nock
# nock isn't able to provide it
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
patch(uri).
reply(201, {"_id": runId})
it 'should update "test run" resource with result data', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isTrue call.isDone()
done()
it 'should return generated url if no reportUrl is available', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://app.apiary.io/public/tests/run/507f1f77bcf86cd799439011'
done()
it 'should return reportUrl from testRun entity', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://absolutely.fancy.url/wich-can-change/some/id'
done()
it 'should send runner.logs to Apiary at the end of testRun', (done) ->
emitter = new EventEmitter
logMessages = ['a', 'b']
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}, {logs: clone(logMessages)}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isString requestBody
parsedBody = JSON.parse requestBody
assert.isObject parsedBody
assert.property parsedBody, 'logs'
assert.deepEqual parsedBody.logs, logMessages
done()
describe 'serverError is true', () ->
it 'should not do enything', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.serverError = true
emitter.emit 'end', () ->
assert.isFalse call.isDone()
done()
describe 'with Apiary API token and suite id', () ->
stats = {}
tests = []
test = {}
emitter = {}
env = {}
beforeEach (done) ->
stats =
tests: 0
failures: 0
errors: 0
passes: 0
skipped: 0
start: 0
end: 0
duration: 0
tests = []
emitter = new EventEmitter
env = {}
env['APIARY_API_URL'] = "https://localhost:#{PORT}"
env['APIARY_API_KEY'] = "PI:KEY:<KEY>END_PI"
env['APIARY_API_NAME'] = "jakubtest"
test =
status: "fail"
title: "POST /machines"
message: "headers: Value of the ‘content-type’ must be application/json.\nbody: No validator found for real data media type 'text/plain' and expected data media type 'application/json'.\nstatusCode: Real and expected data does not match.\n"
startedAt: (1234567890 * 1000) # JavaScript Date.now() timestamp (UNIX-like timestamp * 1000 precision)
actual:
statusCode: 400
headers:
"content-type": "text/plain"
body: "Foo bar"
expected:
headers:
"content-type": "application/json"
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"PI:NAME:<NAME>END_PI\",\n \"id\": \"5229c6e8e4b0bd7dbb07e29c\"\n}\n"
status: "202"
request:
body: "{\n \"type\": \"bulldozer\",\n \"name\": \"PI:NAME:<NAME>END_PI\"}\n"
headers:
"Content-Type": "application/json"
"User-Agent": "Dredd/0.2.1 (Darwin 13.0.0; x64)"
"Content-Length": 44
uri: "/machines"
method: "POST"
results:
headers:
results: [
pointer: "/content-type"
severity: "error"
message: "Value of the ‘content-type’ must be application/json."
]
realType: "application/vnd.apiary.http-headers+json"
expectedType: "application/vnd.apiary.http-headers+json"
validator: "HeadersJsonExample"
rawData:
0:
property: ["content-type"]
propertyValue: "text/plain"
attributeName: "enum"
attributeValue: ["application/json"]
message: "Value of the ‘content-type’ must be application/json."
validator: "enum"
validatorName: "enum"
validatorValue: ["application/json"]
length: 1
body:
results: [
message: "No validator found for real data media type 'text/plain' and expected data media type 'application/json'."
severity: "error"
]
realType: "text/plain"
expectedType: "application/json"
validator: null
rawData: null
statusCode:
realType: "text/vnd.apiary.status-code"
expectedType: "text/vnd.apiary.status-code"
validator: "TextDiff"
rawData: "@@ -1,3 +1,9 @@\n-400\n+undefined\n"
results: [
severity: "error"
message: "Real and expected data does not match."
]
nock.disableNetConnect()
done()
afterEach (done) ->
nock.enableNetConnect()
nock.cleanAll()
done()
describe 'when starting', () ->
call = null
runId = '507f1f77bcf86cd799439011'
reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
requestBody = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/runs'
requestBody = null
getBody = (body) ->
requestBody = body
return body
call = nock(env['APIARY_API_URL']).
filteringRequestBody(getBody).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId, "reportUrl": reportUrl})
it 'should set uuid', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.uuid
done()
it 'should set start time', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.startedAt
done()
it 'should call "create new test run" HTTP resource', (done ) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isTrue call.isDone()
done()
it 'should attach test run ID back to the reporter as remoteId', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.remoteId
done()
it 'should attach test run reportUrl to the reporter as reportUrl', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
assert.isNotNull apiaryReporter.reportUrl
done()
it 'should send the test-run as non-public', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {server: 'http://my.server.co:8080', custom:apiaryReporterEnv:env}
emitter.emit 'start', blueprintData, () ->
parsedBody = JSON.parse requestBody
assert.strictEqual parsedBody.public, false
done()
describe 'when adding passing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test pass', test, () ->
assert.isTrue call.isDone()
done()
describe 'when adding failing test', () ->
call = null
runId = '507f1f77bcf86cd799439011'
test = null
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/steps?testRunId=' + runId
call = nock(env['APIARY_API_URL']).
post(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should call "create new test step" HTTP resource', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'test fail', test, () ->
assert.isTrue call.isDone()
done()
describe 'when ending', () ->
call = null
runId = '507f1f77bcf86cd799439011'
beforeEach () ->
uri = '/apis/' + env['APIARY_API_NAME'] + '/tests/run/' + runId
call = nock(env['APIARY_API_URL']).
patch(uri).
matchHeader('Authentication', 'Token ' + env['APIARY_API_KEY']).
reply(201, {"_id": runId})
it 'should update "test run" resource with result data', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.isTrue call.isDone()
done()
it 'should return generated url if reportUrl is not available', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://app.apiary.io/jakubtest/tests/run/507f1f77bcf86cd799439011'
done()
it 'should return reportUrl from testRun entity', (done) ->
emitter = new EventEmitter
apiaryReporter = new ApiaryReporter emitter, {}, {}, {custom:apiaryReporterEnv:env}
apiaryReporter.remoteId = runId
apiaryReporter.reportUrl = "https://absolutely.fancy.url/wich-can-change/some/id"
emitter.emit 'end', () ->
assert.ok loggerStub.complete.calledWith 'See results in Apiary at: https://absolutely.fancy.url/wich-can-change/some/id'
done()
|
[
{
"context": "edentials.password'))\n# username.sendKeys 'demo'\n# password.sendKeys 'demodemo'\n# f",
"end": 1169,
"score": 0.9973908066749573,
"start": 1165,
"tag": "USERNAME",
"value": "demo"
},
{
"context": "rname.sendKeys 'demo'\n# password.sendKeys '... | public/modules/core/e2e/main-spec.coffee | amIwho/words | 0 |
Pages = require './pages'
Mocks = require './mocks'
describe 'Aughentication', ->
ptor = protractor.getInstance()
ptor.addMockModule 'httpBackendMock', Mocks.httpBackendMock
login_page = new Pages.LoginPage()
it
#
#
#
#
#
#describe '500 words', ->
#
# it 'should have a title, welcome message, register and login link and should not have username', ->
# browser.get 'http://localhost:3000'
# expect(browser.getTitle()).toEqual '500 слов'
# expect($('.jumbotron h1').getText())
# .toBe '500 слов'
# expect($('[href="/#!/signup"]').getText()).toBe 'Зарегистрироваться'
# expect($('[href="/#!/signin"]').getText()).toBe 'Войти'
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeFalsy()
#
# describe '500 words', ->
#
# browser.get 'http://localhost:3000'
#
# it 'should be able to login', ->
# el = $('.nav [href="/#!/signin"]')
# if el.length
# el.click()
# form = $('form.signin')
# username = form.element(By.model('credentials.username'))
# password = form.element(By.model('credentials.password'))
# username.sendKeys 'demo'
# password.sendKeys 'demodemo'
# form.submit()
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeTruthy()
# expect(result.displayName).toBe('Demo Demo')
#
# it 'has properly working timeline', ->
# expect($('.timeline')).toBeDefined()
# $$('li.item .timeline__date').then (items) ->
# expect(items.length).toBeGreaterThan(20)
#
#
#
# it 'has properly working text input', ->
# textinput = element(By.model('text'))
# timeline = element(By.css('.timeline'))
#
# expect(textinput).toBeDefined()
# browser.pause()
# textinput.sendKeys('Тестовый текст ')
#
# timeline.evaluate('days').then (value) ->
# console.log value
#
#
#
#
#
#
#
#
# it 'should be able to logout', ->
# el = $('.nav [href="/#!/signout"]')
# if el.length
# el.click()
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeFalsy()
# expect(result.displayName).toBe(undefined)
#
#
##todo: просмотр истории
##todo: сохранение введенного текста и обновление каунтера.
| 23558 |
Pages = require './pages'
Mocks = require './mocks'
describe 'Aughentication', ->
ptor = protractor.getInstance()
ptor.addMockModule 'httpBackendMock', Mocks.httpBackendMock
login_page = new Pages.LoginPage()
it
#
#
#
#
#
#describe '500 words', ->
#
# it 'should have a title, welcome message, register and login link and should not have username', ->
# browser.get 'http://localhost:3000'
# expect(browser.getTitle()).toEqual '500 слов'
# expect($('.jumbotron h1').getText())
# .toBe '500 слов'
# expect($('[href="/#!/signup"]').getText()).toBe 'Зарегистрироваться'
# expect($('[href="/#!/signin"]').getText()).toBe 'Войти'
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeFalsy()
#
# describe '500 words', ->
#
# browser.get 'http://localhost:3000'
#
# it 'should be able to login', ->
# el = $('.nav [href="/#!/signin"]')
# if el.length
# el.click()
# form = $('form.signin')
# username = form.element(By.model('credentials.username'))
# password = form.element(By.model('credentials.password'))
# username.sendKeys 'demo'
# password.sendKeys '<PASSWORD>'
# form.submit()
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeTruthy()
# expect(result.displayName).toBe('Demo Demo')
#
# it 'has properly working timeline', ->
# expect($('.timeline')).toBeDefined()
# $$('li.item .timeline__date').then (items) ->
# expect(items.length).toBeGreaterThan(20)
#
#
#
# it 'has properly working text input', ->
# textinput = element(By.model('text'))
# timeline = element(By.css('.timeline'))
#
# expect(textinput).toBeDefined()
# browser.pause()
# textinput.sendKeys('<NAME>естовый текст ')
#
# timeline.evaluate('days').then (value) ->
# console.log value
#
#
#
#
#
#
#
#
# it 'should be able to logout', ->
# el = $('.nav [href="/#!/signout"]')
# if el.length
# el.click()
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeFalsy()
# expect(result.displayName).toBe(undefined)
#
#
##todo: просмотр истории
##todo: сохранение введенного текста и обновление каунтера.
| true |
Pages = require './pages'
Mocks = require './mocks'
describe 'Aughentication', ->
ptor = protractor.getInstance()
ptor.addMockModule 'httpBackendMock', Mocks.httpBackendMock
login_page = new Pages.LoginPage()
it
#
#
#
#
#
#describe '500 words', ->
#
# it 'should have a title, welcome message, register and login link and should not have username', ->
# browser.get 'http://localhost:3000'
# expect(browser.getTitle()).toEqual '500 слов'
# expect($('.jumbotron h1').getText())
# .toBe '500 слов'
# expect($('[href="/#!/signup"]').getText()).toBe 'Зарегистрироваться'
# expect($('[href="/#!/signin"]').getText()).toBe 'Войти'
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeFalsy()
#
# describe '500 words', ->
#
# browser.get 'http://localhost:3000'
#
# it 'should be able to login', ->
# el = $('.nav [href="/#!/signin"]')
# if el.length
# el.click()
# form = $('form.signin')
# username = form.element(By.model('credentials.username'))
# password = form.element(By.model('credentials.password'))
# username.sendKeys 'demo'
# password.sendKeys 'PI:PASSWORD:<PASSWORD>END_PI'
# form.submit()
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeTruthy()
# expect(result.displayName).toBe('Demo Demo')
#
# it 'has properly working timeline', ->
# expect($('.timeline')).toBeDefined()
# $$('li.item .timeline__date').then (items) ->
# expect(items.length).toBeGreaterThan(20)
#
#
#
# it 'has properly working text input', ->
# textinput = element(By.model('text'))
# timeline = element(By.css('.timeline'))
#
# expect(textinput).toBeDefined()
# browser.pause()
# textinput.sendKeys('PI:NAME:<NAME>END_PIестовый текст ')
#
# timeline.evaluate('days').then (value) ->
# console.log value
#
#
#
#
#
#
#
#
# it 'should be able to logout', ->
# el = $('.nav [href="/#!/signout"]')
# if el.length
# el.click()
# browser.driver.executeScript () ->
# window.user
# .then (result) ->
# expect(result).toBeFalsy()
# expect(result.displayName).toBe(undefined)
#
#
##todo: просмотр истории
##todo: сохранение введенного текста и обновление каунтера.
|
[
{
"context": "ion: ( key )=>\n\t\todef =\n\t\t\tget: =>\n\t\t\t\tif key is \"needleLengthFactor\" and not @opt[ key ]?\n\t\t\t\t\treturn @opt[ \"thicknes",
"end": 1106,
"score": 0.9454299807548523,
"start": 1088,
"tag": "KEY",
"value": "needleLengthFactor"
}
] | _src/js/gauge.coffee | mpneuried/tcs-charts | 1 | if module?.exports?
_Base = require( "./base.js" )
@d3 = require( "d3" )
else
_Base = window.tcscharts.Base
_Gauge = class Gauge extends _Base
defaults:
width: 500
margin: 0
startAngle: -75
endAngle: 75
thicknessFactor: .8
needleLengthFactor: null
bgColor: "#ddd"
needleColor: "#333"
fixedColor: null
startColor: "#B4EB57"
endColor: "#D10000"
animationDuration: 500
useFloat: false
_rad: 2*Math.PI/360
constructor: ( @target, startValue = 0, options )->
_ret = super( @target )
@_initOptions( options, true )
#@_value = startValue
oDef =
get: =>
return @_value * 100
set: ( _v )=>
if not @useFloat
_v = _v / 100
if _v >= 1
_v = 1
@_set( _v )
return
@define( "value", oDef, @ )
@value = startValue
@create()
return _ret
_initOptions: ( options, def = false )=>
@_extend( @opt = {}, @defaults, options ) if def
@opt.height = @opt.width / 2
if def
for _k of @opt
@_initOption( _k )
return
_initOption: ( key )=>
odef =
get: =>
if key is "needleLengthFactor" and not @opt[ key ]?
return @opt[ "thicknessFactor" ]
else
return @opt[ key ]
set: ( _v )=>
@opt[ key ] = _v
switch key
when "width", "needleLengthFactor", "thicknessFactor"
@_initOptions( null )
@create()
when "animationDuration", "startColor", "endColor"
else
@create()
return
@define( key, odef, @ )
_angleToRad: ( angl )=>
@_rad * angl
_radToAngle: ( rad )=>
rad / @_rad
_arc: ( end )=>
arc = d3.svg.arc()
.outerRadius( @opt.width/2.05 )
.innerRadius( @opt.width/6/@opt.thicknessFactor )
.startAngle( @_angleToRad( @opt.startAngle ) )
if end?
arc.endAngle( @_angleToRad( end ) )
return arc
create: =>
_tgrt = d3.select(@target)
_tgrt.select( "svg" ).remove()
@svg = _tgrt.append("svg")
.attr( "height", @opt.height + @opt.margin*2 )
.attr( "width", @opt.width + @opt.margin*2 )
.append("g").attr("transform", "translate(" + @opt.margin + "," + @opt.margin + ")");
@bg = @svg.append("path")
.style( "fill", @opt.bgColor )
.attr( "class", "bg" )
.attr("transform", "translate(#{ @opt.height },#{ @opt.height })")
.attr( "d", @_arc( @opt.endAngle ) )
@color = @svg.append("path")
.attr( "class", "color" )
.attr("transform", "translate(#{ @opt.height },#{ @opt.height })")
.datum({endAngle: @_angleToRad( @_getAngleByFactor( @_value ) ), fill: @_getColorByFactor( @_value ) })
.attr( "d", ( @arc = @_arc() ) )
if @opt.fixedColor?
@color.attr( "fill", @opt.fixedColor )
if not @opt.neelde
@needle = @svg.append("path")
.style( "fill", @opt.needleColor)
.attr( "class", "needle" )
.datum({angle: @_getAngleByFactor( @_value ) })
.attr( "d", @_calcNeedle() )
.attr( "transform", "rotate(#{ @_getAngleByFactor( 0 ) } #{ @opt.height } #{ @opt.height })" )
@_set( @_value )
return
_calcNeedle: =>
_w = @opt.width
_h = @opt.height
"M#{ _w*0.495 } 0 L#{ _w*0.505 } 0 L#{ _w*0.52 } #{ _h*.73 * @needleLengthFactor } L#{ _w*0.48 } #{ _h*.73 * @needleLengthFactor } Z"
_getAngleByFactor: ( factor )=>
d3.interpolate(@opt.startAngle , @opt.endAngle)( factor )
_getColorByFactor: ( factor )=>
d3.interpolateRgb(@opt.startColor , @opt.endColor)( factor )
_set: ( @_value, duration = @opt.animationDuration )=>
if @color?
@color.transition()
.duration(duration)
.call( @tween, @_value )
if not @opt.neelde and @needle?
@needle.transition()
.duration(duration)
.call( @tweenNeedle, @_value )
return
tween: ( transition, factor )=>
_angle = @_getAngleByFactor( factor )
transition.attrTween "d", ( d )=>
interpolate = d3.interpolate(@color.datum().endAngle, @_angleToRad(_angle ))
return ( t )=>
d.endAngle = interpolate(t)
return @arc(d)
if @opt.fixedColor?
return
_color = @_getColorByFactor( factor )
transition.attrTween "fill", ( d )=>
interpolate = d3.interpolate(@color.datum().fill, _color )
return ( t )=>
_color = interpolate(t)
@color.datum().fill = _color
return _color
return
tweenNeedle: ( transition, factor )=>
newAngle = @_getAngleByFactor( factor )
transition.attrTween "transform", ( rotate )=>
interpolate = d3.interpolate(@needle.datum().angle, newAngle)
return ( t )=>
_newAngle = interpolate(t)
@needle.datum().angle = _newAngle
return "rotate(#{ _newAngle } #{ @opt.height } #{ @opt.height })"
return
if module?.exports?
module.exports = _Gauge
else
window.tcscharts or= {}
window.tcscharts.Gauge = _Gauge | 202047 | if module?.exports?
_Base = require( "./base.js" )
@d3 = require( "d3" )
else
_Base = window.tcscharts.Base
_Gauge = class Gauge extends _Base
defaults:
width: 500
margin: 0
startAngle: -75
endAngle: 75
thicknessFactor: .8
needleLengthFactor: null
bgColor: "#ddd"
needleColor: "#333"
fixedColor: null
startColor: "#B4EB57"
endColor: "#D10000"
animationDuration: 500
useFloat: false
_rad: 2*Math.PI/360
constructor: ( @target, startValue = 0, options )->
_ret = super( @target )
@_initOptions( options, true )
#@_value = startValue
oDef =
get: =>
return @_value * 100
set: ( _v )=>
if not @useFloat
_v = _v / 100
if _v >= 1
_v = 1
@_set( _v )
return
@define( "value", oDef, @ )
@value = startValue
@create()
return _ret
_initOptions: ( options, def = false )=>
@_extend( @opt = {}, @defaults, options ) if def
@opt.height = @opt.width / 2
if def
for _k of @opt
@_initOption( _k )
return
_initOption: ( key )=>
odef =
get: =>
if key is "<KEY>" and not @opt[ key ]?
return @opt[ "thicknessFactor" ]
else
return @opt[ key ]
set: ( _v )=>
@opt[ key ] = _v
switch key
when "width", "needleLengthFactor", "thicknessFactor"
@_initOptions( null )
@create()
when "animationDuration", "startColor", "endColor"
else
@create()
return
@define( key, odef, @ )
_angleToRad: ( angl )=>
@_rad * angl
_radToAngle: ( rad )=>
rad / @_rad
_arc: ( end )=>
arc = d3.svg.arc()
.outerRadius( @opt.width/2.05 )
.innerRadius( @opt.width/6/@opt.thicknessFactor )
.startAngle( @_angleToRad( @opt.startAngle ) )
if end?
arc.endAngle( @_angleToRad( end ) )
return arc
create: =>
_tgrt = d3.select(@target)
_tgrt.select( "svg" ).remove()
@svg = _tgrt.append("svg")
.attr( "height", @opt.height + @opt.margin*2 )
.attr( "width", @opt.width + @opt.margin*2 )
.append("g").attr("transform", "translate(" + @opt.margin + "," + @opt.margin + ")");
@bg = @svg.append("path")
.style( "fill", @opt.bgColor )
.attr( "class", "bg" )
.attr("transform", "translate(#{ @opt.height },#{ @opt.height })")
.attr( "d", @_arc( @opt.endAngle ) )
@color = @svg.append("path")
.attr( "class", "color" )
.attr("transform", "translate(#{ @opt.height },#{ @opt.height })")
.datum({endAngle: @_angleToRad( @_getAngleByFactor( @_value ) ), fill: @_getColorByFactor( @_value ) })
.attr( "d", ( @arc = @_arc() ) )
if @opt.fixedColor?
@color.attr( "fill", @opt.fixedColor )
if not @opt.neelde
@needle = @svg.append("path")
.style( "fill", @opt.needleColor)
.attr( "class", "needle" )
.datum({angle: @_getAngleByFactor( @_value ) })
.attr( "d", @_calcNeedle() )
.attr( "transform", "rotate(#{ @_getAngleByFactor( 0 ) } #{ @opt.height } #{ @opt.height })" )
@_set( @_value )
return
_calcNeedle: =>
_w = @opt.width
_h = @opt.height
"M#{ _w*0.495 } 0 L#{ _w*0.505 } 0 L#{ _w*0.52 } #{ _h*.73 * @needleLengthFactor } L#{ _w*0.48 } #{ _h*.73 * @needleLengthFactor } Z"
_getAngleByFactor: ( factor )=>
d3.interpolate(@opt.startAngle , @opt.endAngle)( factor )
_getColorByFactor: ( factor )=>
d3.interpolateRgb(@opt.startColor , @opt.endColor)( factor )
_set: ( @_value, duration = @opt.animationDuration )=>
if @color?
@color.transition()
.duration(duration)
.call( @tween, @_value )
if not @opt.neelde and @needle?
@needle.transition()
.duration(duration)
.call( @tweenNeedle, @_value )
return
tween: ( transition, factor )=>
_angle = @_getAngleByFactor( factor )
transition.attrTween "d", ( d )=>
interpolate = d3.interpolate(@color.datum().endAngle, @_angleToRad(_angle ))
return ( t )=>
d.endAngle = interpolate(t)
return @arc(d)
if @opt.fixedColor?
return
_color = @_getColorByFactor( factor )
transition.attrTween "fill", ( d )=>
interpolate = d3.interpolate(@color.datum().fill, _color )
return ( t )=>
_color = interpolate(t)
@color.datum().fill = _color
return _color
return
tweenNeedle: ( transition, factor )=>
newAngle = @_getAngleByFactor( factor )
transition.attrTween "transform", ( rotate )=>
interpolate = d3.interpolate(@needle.datum().angle, newAngle)
return ( t )=>
_newAngle = interpolate(t)
@needle.datum().angle = _newAngle
return "rotate(#{ _newAngle } #{ @opt.height } #{ @opt.height })"
return
if module?.exports?
module.exports = _Gauge
else
window.tcscharts or= {}
window.tcscharts.Gauge = _Gauge | true | if module?.exports?
_Base = require( "./base.js" )
@d3 = require( "d3" )
else
_Base = window.tcscharts.Base
_Gauge = class Gauge extends _Base
defaults:
width: 500
margin: 0
startAngle: -75
endAngle: 75
thicknessFactor: .8
needleLengthFactor: null
bgColor: "#ddd"
needleColor: "#333"
fixedColor: null
startColor: "#B4EB57"
endColor: "#D10000"
animationDuration: 500
useFloat: false
_rad: 2*Math.PI/360
constructor: ( @target, startValue = 0, options )->
_ret = super( @target )
@_initOptions( options, true )
#@_value = startValue
oDef =
get: =>
return @_value * 100
set: ( _v )=>
if not @useFloat
_v = _v / 100
if _v >= 1
_v = 1
@_set( _v )
return
@define( "value", oDef, @ )
@value = startValue
@create()
return _ret
_initOptions: ( options, def = false )=>
@_extend( @opt = {}, @defaults, options ) if def
@opt.height = @opt.width / 2
if def
for _k of @opt
@_initOption( _k )
return
_initOption: ( key )=>
odef =
get: =>
if key is "PI:KEY:<KEY>END_PI" and not @opt[ key ]?
return @opt[ "thicknessFactor" ]
else
return @opt[ key ]
set: ( _v )=>
@opt[ key ] = _v
switch key
when "width", "needleLengthFactor", "thicknessFactor"
@_initOptions( null )
@create()
when "animationDuration", "startColor", "endColor"
else
@create()
return
@define( key, odef, @ )
_angleToRad: ( angl )=>
@_rad * angl
_radToAngle: ( rad )=>
rad / @_rad
_arc: ( end )=>
arc = d3.svg.arc()
.outerRadius( @opt.width/2.05 )
.innerRadius( @opt.width/6/@opt.thicknessFactor )
.startAngle( @_angleToRad( @opt.startAngle ) )
if end?
arc.endAngle( @_angleToRad( end ) )
return arc
create: =>
_tgrt = d3.select(@target)
_tgrt.select( "svg" ).remove()
@svg = _tgrt.append("svg")
.attr( "height", @opt.height + @opt.margin*2 )
.attr( "width", @opt.width + @opt.margin*2 )
.append("g").attr("transform", "translate(" + @opt.margin + "," + @opt.margin + ")");
@bg = @svg.append("path")
.style( "fill", @opt.bgColor )
.attr( "class", "bg" )
.attr("transform", "translate(#{ @opt.height },#{ @opt.height })")
.attr( "d", @_arc( @opt.endAngle ) )
@color = @svg.append("path")
.attr( "class", "color" )
.attr("transform", "translate(#{ @opt.height },#{ @opt.height })")
.datum({endAngle: @_angleToRad( @_getAngleByFactor( @_value ) ), fill: @_getColorByFactor( @_value ) })
.attr( "d", ( @arc = @_arc() ) )
if @opt.fixedColor?
@color.attr( "fill", @opt.fixedColor )
if not @opt.neelde
@needle = @svg.append("path")
.style( "fill", @opt.needleColor)
.attr( "class", "needle" )
.datum({angle: @_getAngleByFactor( @_value ) })
.attr( "d", @_calcNeedle() )
.attr( "transform", "rotate(#{ @_getAngleByFactor( 0 ) } #{ @opt.height } #{ @opt.height })" )
@_set( @_value )
return
_calcNeedle: =>
_w = @opt.width
_h = @opt.height
"M#{ _w*0.495 } 0 L#{ _w*0.505 } 0 L#{ _w*0.52 } #{ _h*.73 * @needleLengthFactor } L#{ _w*0.48 } #{ _h*.73 * @needleLengthFactor } Z"
_getAngleByFactor: ( factor )=>
d3.interpolate(@opt.startAngle , @opt.endAngle)( factor )
_getColorByFactor: ( factor )=>
d3.interpolateRgb(@opt.startColor , @opt.endColor)( factor )
_set: ( @_value, duration = @opt.animationDuration )=>
if @color?
@color.transition()
.duration(duration)
.call( @tween, @_value )
if not @opt.neelde and @needle?
@needle.transition()
.duration(duration)
.call( @tweenNeedle, @_value )
return
tween: ( transition, factor )=>
_angle = @_getAngleByFactor( factor )
transition.attrTween "d", ( d )=>
interpolate = d3.interpolate(@color.datum().endAngle, @_angleToRad(_angle ))
return ( t )=>
d.endAngle = interpolate(t)
return @arc(d)
if @opt.fixedColor?
return
_color = @_getColorByFactor( factor )
transition.attrTween "fill", ( d )=>
interpolate = d3.interpolate(@color.datum().fill, _color )
return ( t )=>
_color = interpolate(t)
@color.datum().fill = _color
return _color
return
tweenNeedle: ( transition, factor )=>
newAngle = @_getAngleByFactor( factor )
transition.attrTween "transform", ( rotate )=>
interpolate = d3.interpolate(@needle.datum().angle, newAngle)
return ( t )=>
_newAngle = interpolate(t)
@needle.datum().angle = _newAngle
return "rotate(#{ _newAngle } #{ @opt.height } #{ @opt.height })"
return
if module?.exports?
module.exports = _Gauge
else
window.tcscharts or= {}
window.tcscharts.Gauge = _Gauge |
[
{
"context": "st) ->\n\n casper.start url(\"/\")\n login profile: \"cersei\", next: \"/admin\"\n # Creates a review in order to",
"end": 258,
"score": 0.9992973208427429,
"start": 252,
"tag": "USERNAME",
"value": "cersei"
},
{
"context": "assertHttpStatus 200\n test.assertTitle... | tests/integration/test-admin.coffee | christophetd/courseadvisor | 19 | ###
test-comments.coffee
Tests admin page
###
{url, screenshot, login, randomStr, waitForPage} = require './utils.coffee'
casper.test.begin "Unauthenticated user cannot access admin page", 2, (test) ->
casper.start url("/")
login profile: "cersei", next: "/admin"
# Creates a review in order to comment
casper.then ->
test.assertHttpStatus 200
test.assertTitleMatches(/Rick Astley/i, "User got rickrolled");
casper.run ->
test.done()
casper.test.begin "Authenticated user can access admin page", 3, (test) ->
casper.start url("/")
login profile: "snow", next: "/admin"
# Creates a review in order to comment
casper.then ->
test.assertHttpStatus 200
test.assertTextExists("Administration", "Page contains 'administration' keyword")
test.assertTitleMatches(/(Admin.*CourseAdvisor|CourseAdvisor.*Admin)/i, "Page title contains Admin and CourseAdvisor")
casper.run ->
test.done()
| 49729 | ###
test-comments.coffee
Tests admin page
###
{url, screenshot, login, randomStr, waitForPage} = require './utils.coffee'
casper.test.begin "Unauthenticated user cannot access admin page", 2, (test) ->
casper.start url("/")
login profile: "cersei", next: "/admin"
# Creates a review in order to comment
casper.then ->
test.assertHttpStatus 200
test.assertTitleMatches(/<NAME>/i, "User got rickrolled");
casper.run ->
test.done()
casper.test.begin "Authenticated user can access admin page", 3, (test) ->
casper.start url("/")
login profile: "snow", next: "/admin"
# Creates a review in order to comment
casper.then ->
test.assertHttpStatus 200
test.assertTextExists("Administration", "Page contains 'administration' keyword")
test.assertTitleMatches(/(Admin.*CourseAdvisor|CourseAdvisor.*Admin)/i, "Page title contains Admin and CourseAdvisor")
casper.run ->
test.done()
| true | ###
test-comments.coffee
Tests admin page
###
{url, screenshot, login, randomStr, waitForPage} = require './utils.coffee'
casper.test.begin "Unauthenticated user cannot access admin page", 2, (test) ->
casper.start url("/")
login profile: "cersei", next: "/admin"
# Creates a review in order to comment
casper.then ->
test.assertHttpStatus 200
test.assertTitleMatches(/PI:NAME:<NAME>END_PI/i, "User got rickrolled");
casper.run ->
test.done()
casper.test.begin "Authenticated user can access admin page", 3, (test) ->
casper.start url("/")
login profile: "snow", next: "/admin"
# Creates a review in order to comment
casper.then ->
test.assertHttpStatus 200
test.assertTextExists("Administration", "Page contains 'administration' keyword")
test.assertTitleMatches(/(Admin.*CourseAdvisor|CourseAdvisor.*Admin)/i, "Page title contains Admin and CourseAdvisor")
casper.run ->
test.done()
|
[
{
"context": "ngodb_username = process.env.mongodb_username || \"admin\"\nmongodb_password = process.env.mongodb_password ",
"end": 828,
"score": 0.9887864589691162,
"start": 823,
"tag": "USERNAME",
"value": "admin"
},
{
"context": "ngodb_password = process.env.mongodb_password || \"... | server.coffee | dfraser74/whoislikingyou | 0 | #require internal libraries
myMiddleware = require "./business-layer/common/middleware"
myErrorHandler = require "./business-layer/common/errorHandler"
myAuthentication = require "./business-layer/common/authentication"
myRoutes = require "./business-layer/common/routes"
mySocketRoutes = require "./business-layer/common/socketroutes"
#require external libraries
express = require "express"
http = require "http"
winston = require "winston"
socket_io = require "socket.io"
lingua = require "lingua"
mongodb = require "connect-mongodb"
winstonMongoDB = require('winston-mongodb').MongoDB
myAuthentication.passport = require "passport"
myAuthentication.facebookStrategy = require "passport-facebook"
Event = require('events').EventEmitter
#process environment variables
mongodb_username = process.env.mongodb_username || "admin"
mongodb_password = process.env.mongodb_password || "whoislikingyou"
mongodb_port = process.env.mongodb_port || 10072
mongodb_host = process.env.mongodb_host || "alex.mongohq.com"
mongodb_database = process.env.mongodb_database || "whoislikingyou"
mongodbURL = "mongodb://"+ mongodb_username + ":" + mongodb_password + "@" + mongodb_host + ":" + mongodb_port + "/" + mongodb_database
port = process.env.PORT || 5000
#add custom event register
winston.add(winstonMongoDB, {db:mongodb_username, host:mongodb_host, port:mongodb_port, username:mongodb_username, password:mongodb_password})
#add passport
myAuthentication.boot()
#add Event Emitter
events = new Event()
#configure application
app = express()
app.set 'views', "./user-interface/views"
app.set 'view engine', 'toffee'
app.set 'db', mongodbURL
app.set 'port', port
app.locals.layout = './user-interface/views/layout.toffee'
if app.get("env") is "development"
app.use express.logger('dev')
if app.get("env") is "production"
winston.remove(winston.transports.Console)
app.use express.favicon('./public/images/favicon.ico')
app.use myMiddleware.type('multipart/form-data', express.limit('20mb'))
app.use lingua app, {defaultLocale: 'pt-PT', path: './user-interface/locales'}
app.use express.bodyParser({keepExtensions: true, uploadDir: "./public/uploads"})
#session support
session_store = new mongodb({url:mongodbURL})
app.use express.cookieParser('whoislikingyou')
app.use express.session({key: 'sid', cookie: {maxAge: 3600000}, store: session_store })
app.use myAuthentication.passport.initialize()
app.use myAuthentication.passport.session()
app.use express.compress({level:9, memLevel:9})
app.use express.static('./public')
app.use app.router
if app.get("env") is "development"
app.use express.errorHandler({dumpExceptions:true, showStack:true})
app.disable('view cache')
else
app.use myErrorHandler.logErrors
app.use myErrorHandler.clientErrorHandler
app.use myErrorHandler.errorHandler
myRoutes app, myAuthentication, events
server = http.createServer(app)
io = socket_io.listen(server)
if app.get("env") is "development"
io.set("log level", 3)
else
io.set("log level", false)
mySocketRoutes app, myAuthentication, io, session_store, events
server.listen app.get('port'), ->
winston.log('info', 'Server up-and-running on port ' + server.address().port + ", in " + app.get("env"))
| 38668 | #require internal libraries
myMiddleware = require "./business-layer/common/middleware"
myErrorHandler = require "./business-layer/common/errorHandler"
myAuthentication = require "./business-layer/common/authentication"
myRoutes = require "./business-layer/common/routes"
mySocketRoutes = require "./business-layer/common/socketroutes"
#require external libraries
express = require "express"
http = require "http"
winston = require "winston"
socket_io = require "socket.io"
lingua = require "lingua"
mongodb = require "connect-mongodb"
winstonMongoDB = require('winston-mongodb').MongoDB
myAuthentication.passport = require "passport"
myAuthentication.facebookStrategy = require "passport-facebook"
Event = require('events').EventEmitter
#process environment variables
mongodb_username = process.env.mongodb_username || "admin"
mongodb_password = process.env.mongodb_password || "<PASSWORD>"
mongodb_port = process.env.mongodb_port || 10072
mongodb_host = process.env.mongodb_host || "alex.mongohq.com"
mongodb_database = process.env.mongodb_database || "whoislikingyou"
mongodbURL = "mongodb://"+ mongodb_username + ":" + mongodb_password + "@" + mongodb_host + ":" + mongodb_port + "/" + mongodb_database
port = process.env.PORT || 5000
#add custom event register
winston.add(winstonMongoDB, {db:mongodb_username, host:mongodb_host, port:mongodb_port, username:mongodb_username, password:<PASSWORD>})
#add passport
myAuthentication.boot()
#add Event Emitter
events = new Event()
#configure application
app = express()
app.set 'views', "./user-interface/views"
app.set 'view engine', 'toffee'
app.set 'db', mongodbURL
app.set 'port', port
app.locals.layout = './user-interface/views/layout.toffee'
if app.get("env") is "development"
app.use express.logger('dev')
if app.get("env") is "production"
winston.remove(winston.transports.Console)
app.use express.favicon('./public/images/favicon.ico')
app.use myMiddleware.type('multipart/form-data', express.limit('20mb'))
app.use lingua app, {defaultLocale: 'pt-PT', path: './user-interface/locales'}
app.use express.bodyParser({keepExtensions: true, uploadDir: "./public/uploads"})
#session support
session_store = new mongodb({url:mongodbURL})
app.use express.cookieParser('whoislikingyou')
app.use express.session({key: 'sid', cookie: {maxAge: 3600000}, store: session_store })
app.use myAuthentication.passport.initialize()
app.use myAuthentication.passport.session()
app.use express.compress({level:9, memLevel:9})
app.use express.static('./public')
app.use app.router
if app.get("env") is "development"
app.use express.errorHandler({dumpExceptions:true, showStack:true})
app.disable('view cache')
else
app.use myErrorHandler.logErrors
app.use myErrorHandler.clientErrorHandler
app.use myErrorHandler.errorHandler
myRoutes app, myAuthentication, events
server = http.createServer(app)
io = socket_io.listen(server)
if app.get("env") is "development"
io.set("log level", 3)
else
io.set("log level", false)
mySocketRoutes app, myAuthentication, io, session_store, events
server.listen app.get('port'), ->
winston.log('info', 'Server up-and-running on port ' + server.address().port + ", in " + app.get("env"))
| true | #require internal libraries
myMiddleware = require "./business-layer/common/middleware"
myErrorHandler = require "./business-layer/common/errorHandler"
myAuthentication = require "./business-layer/common/authentication"
myRoutes = require "./business-layer/common/routes"
mySocketRoutes = require "./business-layer/common/socketroutes"
#require external libraries
express = require "express"
http = require "http"
winston = require "winston"
socket_io = require "socket.io"
lingua = require "lingua"
mongodb = require "connect-mongodb"
winstonMongoDB = require('winston-mongodb').MongoDB
myAuthentication.passport = require "passport"
myAuthentication.facebookStrategy = require "passport-facebook"
Event = require('events').EventEmitter
#process environment variables
mongodb_username = process.env.mongodb_username || "admin"
mongodb_password = process.env.mongodb_password || "PI:PASSWORD:<PASSWORD>END_PI"
mongodb_port = process.env.mongodb_port || 10072
mongodb_host = process.env.mongodb_host || "alex.mongohq.com"
mongodb_database = process.env.mongodb_database || "whoislikingyou"
mongodbURL = "mongodb://"+ mongodb_username + ":" + mongodb_password + "@" + mongodb_host + ":" + mongodb_port + "/" + mongodb_database
port = process.env.PORT || 5000
#add custom event register
winston.add(winstonMongoDB, {db:mongodb_username, host:mongodb_host, port:mongodb_port, username:mongodb_username, password:PI:PASSWORD:<PASSWORD>END_PI})
#add passport
myAuthentication.boot()
#add Event Emitter
events = new Event()
#configure application
app = express()
app.set 'views', "./user-interface/views"
app.set 'view engine', 'toffee'
app.set 'db', mongodbURL
app.set 'port', port
app.locals.layout = './user-interface/views/layout.toffee'
if app.get("env") is "development"
app.use express.logger('dev')
if app.get("env") is "production"
winston.remove(winston.transports.Console)
app.use express.favicon('./public/images/favicon.ico')
app.use myMiddleware.type('multipart/form-data', express.limit('20mb'))
app.use lingua app, {defaultLocale: 'pt-PT', path: './user-interface/locales'}
app.use express.bodyParser({keepExtensions: true, uploadDir: "./public/uploads"})
#session support
session_store = new mongodb({url:mongodbURL})
app.use express.cookieParser('whoislikingyou')
app.use express.session({key: 'sid', cookie: {maxAge: 3600000}, store: session_store })
app.use myAuthentication.passport.initialize()
app.use myAuthentication.passport.session()
app.use express.compress({level:9, memLevel:9})
app.use express.static('./public')
app.use app.router
if app.get("env") is "development"
app.use express.errorHandler({dumpExceptions:true, showStack:true})
app.disable('view cache')
else
app.use myErrorHandler.logErrors
app.use myErrorHandler.clientErrorHandler
app.use myErrorHandler.errorHandler
myRoutes app, myAuthentication, events
server = http.createServer(app)
io = socket_io.listen(server)
if app.get("env") is "development"
io.set("log level", 3)
else
io.set("log level", false)
mySocketRoutes app, myAuthentication, io, session_store, events
server.listen app.get('port'), ->
winston.log('info', 'Server up-and-running on port ' + server.address().port + ", in " + app.get("env"))
|
[
{
"context": "opyright 2013 Canopy Canopy Canopy, Inc.\n# Authors Adam Florin & Anthony Tran\n#\nclass Alongslide\n\n panels :",
"end": 123,
"score": 0.9997434616088867,
"start": 112,
"tag": "NAME",
"value": "Adam Florin"
},
{
"context": "Canopy Canopy Canopy, Inc.\n# Authors Ad... | app/assets/javascripts/alongslide/alongslide.coffee | triplecanopy/alongslide | 33 | #
# alongslide.cofee: Central init, pull in submodules.
#
# Copyright 2013 Canopy Canopy Canopy, Inc.
# Authors Adam Florin & Anthony Tran
#
class Alongslide
panels : {}
sections : {}
parser : null
layout : null
scrolling : null
state : null
constructor: (options= {}) ->
@source = $(options.source) ? $('#content .raw')
@frames = $(options.to) ? $('#frames')
@regionCls = options.regionCls ? 'column'
@marginTop = options.marginTop ? 0
@panelIndices = []
@flowIndices = []
RegionFlow::init()
# parse
@parser = new @Parser source: @source
{@flowNames, @panelNames, @backgrounds, @panels, @footnotes, @sourceLength} = @parser.parse()
# init layout
@layout = new @Layout
sourceLength: @sourceLength
frames : @frames
flowNames : @flowNames
backgrounds : @backgrounds
panels : @panels
regionCls : @regionCls
panelNames : @panelNames
panelIndices: @panelIndices
flowIndices : @flowIndices
# init scrolling
@scrolling = new @Scrolling
frames: @frames
# init broswer history
@state = new @State
panelNames : @panelNames
flowNames : @flowNames
panelIndices: @panelIndices
flowIndices : @flowIndices
# Render flowing layout and scroll behavior.
#
# Force use of CSS Regions polyfill. (Don't trust native browser support
# while W3C draft is under active development.)
#
# @param frameAspect - bounding box computed by FixedAspect
# @param postRenderCallback - to be called when layout returns
#
render: (postRenderCallback) ->
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
@layout.render (lastFramePosition) =>
@lastFramePosition = lastFramePosition
@refresh(frameAspect)
@applyFootnotes()
@applyAnchorScrolling()
# Emit notification that layout is complete.
#
$(document).triggerHandler 'alongslide.ready', @frames
# Default array of indices for URL rewrites is set to section names
#
@state.setIndices(@flowIndices)
@hashToPosition()
FixedAspect.prototype.fitPanels(frameAspect)
postRenderCallback()
# Refresh Skrollr only on resize events, as it's fast.
#
refresh: ->
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
@scrolling.render(frameAspect, @lastFramePosition)
FixedAspect.prototype.fitPanels(frameAspect)
hashToPosition: ->
hash = window.location.hash
if hash.length
# State will update hash on skroll
#
stateIndex = @goToPanel(hash.substr(1))
state = {index: stateIndex || 0}
@state.updateLocation state
# Create footnotes
#
# Sanitize Markdown generated HTML
applyFootnotes: ->
# For each footnote in the article
@frames.find('.als-fn-ref').each (i, el) =>
# Reference the footnote
#
$el = $(el)
# Find and clone the footnote element
#
$footnote = @footnotes.find($el.data('anchor')).clone()
# Append the cloned element to the column
#
$column = $el.parents('.column')
$column.append($footnote)
$el.on 'click mouseenter', (e) ->
e.preventDefault()
e.stopImmediatePropagation()
# Place footnote, prevent placing offscreen
#
bottom = $column.height() + $column.offset().top
if ($el.offset().top + $footnote.height()) > bottom
$footnote.css('bottom', 0)
else
$footnote.css('top', $el.parent().position().top )
$footnote.fadeIn(150)
$footnote.on 'click mouseleave', (e) ->
setTimeout ->
$footnote.fadeOut(150)
, 100
applyAnchorScrolling: ->
self = @
@frames.find('a[href*=\\#]:not([href=\\#])').on('click', (e) ->
self.goToPanel(@hash.substr(1))
)
goToPanel: (alsId) =>
$target = $('#frames').find('[data-alongslide-id=' + alsId + ']')
targetPos = $target.data('als-in-position')
@scrolling.scrollToPosition(targetPos)
targetPos
# Make global
#
window.Alongslide = Alongslide
| 123850 | #
# alongslide.cofee: Central init, pull in submodules.
#
# Copyright 2013 Canopy Canopy Canopy, Inc.
# Authors <NAME> & <NAME>
#
class Alongslide
panels : {}
sections : {}
parser : null
layout : null
scrolling : null
state : null
constructor: (options= {}) ->
@source = $(options.source) ? $('#content .raw')
@frames = $(options.to) ? $('#frames')
@regionCls = options.regionCls ? 'column'
@marginTop = options.marginTop ? 0
@panelIndices = []
@flowIndices = []
RegionFlow::init()
# parse
@parser = new @Parser source: @source
{@flowNames, @panelNames, @backgrounds, @panels, @footnotes, @sourceLength} = @parser.parse()
# init layout
@layout = new @Layout
sourceLength: @sourceLength
frames : @frames
flowNames : @flowNames
backgrounds : @backgrounds
panels : @panels
regionCls : @regionCls
panelNames : @panelNames
panelIndices: @panelIndices
flowIndices : @flowIndices
# init scrolling
@scrolling = new @Scrolling
frames: @frames
# init broswer history
@state = new @State
panelNames : @panelNames
flowNames : @flowNames
panelIndices: @panelIndices
flowIndices : @flowIndices
# Render flowing layout and scroll behavior.
#
# Force use of CSS Regions polyfill. (Don't trust native browser support
# while W3C draft is under active development.)
#
# @param frameAspect - bounding box computed by FixedAspect
# @param postRenderCallback - to be called when layout returns
#
render: (postRenderCallback) ->
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
@layout.render (lastFramePosition) =>
@lastFramePosition = lastFramePosition
@refresh(frameAspect)
@applyFootnotes()
@applyAnchorScrolling()
# Emit notification that layout is complete.
#
$(document).triggerHandler 'alongslide.ready', @frames
# Default array of indices for URL rewrites is set to section names
#
@state.setIndices(@flowIndices)
@hashToPosition()
FixedAspect.prototype.fitPanels(frameAspect)
postRenderCallback()
# Refresh Skrollr only on resize events, as it's fast.
#
refresh: ->
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
@scrolling.render(frameAspect, @lastFramePosition)
FixedAspect.prototype.fitPanels(frameAspect)
hashToPosition: ->
hash = window.location.hash
if hash.length
# State will update hash on skroll
#
stateIndex = @goToPanel(hash.substr(1))
state = {index: stateIndex || 0}
@state.updateLocation state
# Create footnotes
#
# Sanitize Markdown generated HTML
applyFootnotes: ->
# For each footnote in the article
@frames.find('.als-fn-ref').each (i, el) =>
# Reference the footnote
#
$el = $(el)
# Find and clone the footnote element
#
$footnote = @footnotes.find($el.data('anchor')).clone()
# Append the cloned element to the column
#
$column = $el.parents('.column')
$column.append($footnote)
$el.on 'click mouseenter', (e) ->
e.preventDefault()
e.stopImmediatePropagation()
# Place footnote, prevent placing offscreen
#
bottom = $column.height() + $column.offset().top
if ($el.offset().top + $footnote.height()) > bottom
$footnote.css('bottom', 0)
else
$footnote.css('top', $el.parent().position().top )
$footnote.fadeIn(150)
$footnote.on 'click mouseleave', (e) ->
setTimeout ->
$footnote.fadeOut(150)
, 100
applyAnchorScrolling: ->
self = @
@frames.find('a[href*=\\#]:not([href=\\#])').on('click', (e) ->
self.goToPanel(@hash.substr(1))
)
goToPanel: (alsId) =>
$target = $('#frames').find('[data-alongslide-id=' + alsId + ']')
targetPos = $target.data('als-in-position')
@scrolling.scrollToPosition(targetPos)
targetPos
# Make global
#
window.Alongslide = Alongslide
| true | #
# alongslide.cofee: Central init, pull in submodules.
#
# Copyright 2013 Canopy Canopy Canopy, Inc.
# Authors PI:NAME:<NAME>END_PI & PI:NAME:<NAME>END_PI
#
class Alongslide
panels : {}
sections : {}
parser : null
layout : null
scrolling : null
state : null
constructor: (options= {}) ->
@source = $(options.source) ? $('#content .raw')
@frames = $(options.to) ? $('#frames')
@regionCls = options.regionCls ? 'column'
@marginTop = options.marginTop ? 0
@panelIndices = []
@flowIndices = []
RegionFlow::init()
# parse
@parser = new @Parser source: @source
{@flowNames, @panelNames, @backgrounds, @panels, @footnotes, @sourceLength} = @parser.parse()
# init layout
@layout = new @Layout
sourceLength: @sourceLength
frames : @frames
flowNames : @flowNames
backgrounds : @backgrounds
panels : @panels
regionCls : @regionCls
panelNames : @panelNames
panelIndices: @panelIndices
flowIndices : @flowIndices
# init scrolling
@scrolling = new @Scrolling
frames: @frames
# init broswer history
@state = new @State
panelNames : @panelNames
flowNames : @flowNames
panelIndices: @panelIndices
flowIndices : @flowIndices
# Render flowing layout and scroll behavior.
#
# Force use of CSS Regions polyfill. (Don't trust native browser support
# while W3C draft is under active development.)
#
# @param frameAspect - bounding box computed by FixedAspect
# @param postRenderCallback - to be called when layout returns
#
render: (postRenderCallback) ->
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
@layout.render (lastFramePosition) =>
@lastFramePosition = lastFramePosition
@refresh(frameAspect)
@applyFootnotes()
@applyAnchorScrolling()
# Emit notification that layout is complete.
#
$(document).triggerHandler 'alongslide.ready', @frames
# Default array of indices for URL rewrites is set to section names
#
@state.setIndices(@flowIndices)
@hashToPosition()
FixedAspect.prototype.fitPanels(frameAspect)
postRenderCallback()
# Refresh Skrollr only on resize events, as it's fast.
#
refresh: ->
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
@scrolling.render(frameAspect, @lastFramePosition)
FixedAspect.prototype.fitPanels(frameAspect)
hashToPosition: ->
hash = window.location.hash
if hash.length
# State will update hash on skroll
#
stateIndex = @goToPanel(hash.substr(1))
state = {index: stateIndex || 0}
@state.updateLocation state
# Create footnotes
#
# Sanitize Markdown generated HTML
applyFootnotes: ->
# For each footnote in the article
@frames.find('.als-fn-ref').each (i, el) =>
# Reference the footnote
#
$el = $(el)
# Find and clone the footnote element
#
$footnote = @footnotes.find($el.data('anchor')).clone()
# Append the cloned element to the column
#
$column = $el.parents('.column')
$column.append($footnote)
$el.on 'click mouseenter', (e) ->
e.preventDefault()
e.stopImmediatePropagation()
# Place footnote, prevent placing offscreen
#
bottom = $column.height() + $column.offset().top
if ($el.offset().top + $footnote.height()) > bottom
$footnote.css('bottom', 0)
else
$footnote.css('top', $el.parent().position().top )
$footnote.fadeIn(150)
$footnote.on 'click mouseleave', (e) ->
setTimeout ->
$footnote.fadeOut(150)
, 100
applyAnchorScrolling: ->
self = @
@frames.find('a[href*=\\#]:not([href=\\#])').on('click', (e) ->
self.goToPanel(@hash.substr(1))
)
goToPanel: (alsId) =>
$target = $('#frames').find('[data-alongslide-id=' + alsId + ']')
targetPos = $target.data('als-in-position')
@scrolling.scrollToPosition(targetPos)
targetPos
# Make global
#
window.Alongslide = Alongslide
|
[
{
"context": ").andCallFake -> Promise.resolve()\n @myName = \"Ben Tester\"\n @myEmail = \"tester@nylas.com\"\n @event = n",
"end": 403,
"score": 0.9998837113380432,
"start": 393,
"tag": "NAME",
"value": "Ben Tester"
},
{
"context": "olve()\n @myName = \"Ben Tester\"\n ... | packages/client-app/spec/tasks/event-rsvp-task-spec.coffee | cnheider/nylas-mail | 24,369 | _ = require 'underscore'
{NylasAPI,
NylasAPIRequest,
Event,
Actions,
APIError,
EventRSVPTask,
DatabaseStore,
DatabaseWriter,
AccountStore} = require 'nylas-exports'
xdescribe "EventRSVPTask", ->
beforeEach ->
spyOn(DatabaseStore, 'find').andCallFake => Promise.resolve(@event)
spyOn(DatabaseWriter.prototype, 'persistModel').andCallFake -> Promise.resolve()
@myName = "Ben Tester"
@myEmail = "tester@nylas.com"
@event = new Event
id: '12233AEDF5'
accountId: TEST_ACCOUNT_ID
title: 'Meeting with Ben Bitdiddle'
description: ''
location: ''
when:
end_time: 1408123800
start_time: 1408120200
start: 1408120200
end: 1408123800
participants: [
{"name": "Ben Bitdiddle",
"email": "ben@bitdiddle.com",
"status": "yes"},
{"name": @myName,
"email": @myEmail,
"status": 'noreply'}
]
@task = new EventRSVPTask(@event, @myEmail, "no")
describe "performLocal", ->
it "should mark our status as no", ->
@task.performLocal()
advanceClock()
expect(@event.participants[1].status).toBe "no"
it "should trigger an action to persist the change", ->
@task.performLocal()
advanceClock()
expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
describe "performRemote", ->
it "should make the POST request to the message endpoint", ->
spyOn(NylasAPIRequest.prototype, 'run').andCallFake => new Promise (resolve,reject) ->
@task.performRemote()
options = NylasAPIRequest.prototype.run.mostRecentCall.object.options
expect(options.path).toBe("/send-rsvp")
expect(options.method).toBe('POST')
expect(options.accountId).toBe(@event.accountId)
expect(options.body.event_id).toBe(@event.id)
expect(options.body.status).toBe("no")
describe "when the remote API request fails", ->
beforeEach ->
spyOn(NylasAPIRequest.prototype, 'run').andCallFake -> Promise.reject(new APIError(body: '', statusCode: 400))
it "should not be marked with the status", ->
@event = new Event
id: '12233AEDF5'
title: 'Meeting with Ben Bitdiddle'
description: ''
location: ''
when:
end_time: 1408123800
start_time: 1408120200
start: 1408120200
end: 1408123800
participants: [
{"name": "Ben Bitdiddle",
"email": "ben@bitdiddle.com",
"status": "yes"},
{"name": @myName,
"email": @myEmail,
"status": 'noreply'}
]
@task = new EventRSVPTask(@event, @myEmail, "no")
@task.performLocal()
@task.performRemote()
advanceClock()
expect(@event.participants[1].status).toBe "noreply"
it "should trigger an action to persist the change", ->
@task.performLocal()
@task.performRemote()
advanceClock()
expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
| 123293 | _ = require 'underscore'
{NylasAPI,
NylasAPIRequest,
Event,
Actions,
APIError,
EventRSVPTask,
DatabaseStore,
DatabaseWriter,
AccountStore} = require 'nylas-exports'
xdescribe "EventRSVPTask", ->
beforeEach ->
spyOn(DatabaseStore, 'find').andCallFake => Promise.resolve(@event)
spyOn(DatabaseWriter.prototype, 'persistModel').andCallFake -> Promise.resolve()
@myName = "<NAME>"
@myEmail = "<EMAIL>"
@event = new Event
id: '12233AEDF5'
accountId: TEST_ACCOUNT_ID
title: 'Meeting with <NAME>'
description: ''
location: ''
when:
end_time: 1408123800
start_time: 1408120200
start: 1408120200
end: 1408123800
participants: [
{"name": "<NAME>",
"email": "<EMAIL>",
"status": "yes"},
{"name":<NAME> @myName,
"email": @myEmail,
"status": 'noreply'}
]
@task = new EventRSVPTask(@event, @myEmail, "no")
describe "performLocal", ->
it "should mark our status as no", ->
@task.performLocal()
advanceClock()
expect(@event.participants[1].status).toBe "no"
it "should trigger an action to persist the change", ->
@task.performLocal()
advanceClock()
expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
describe "performRemote", ->
it "should make the POST request to the message endpoint", ->
spyOn(NylasAPIRequest.prototype, 'run').andCallFake => new Promise (resolve,reject) ->
@task.performRemote()
options = NylasAPIRequest.prototype.run.mostRecentCall.object.options
expect(options.path).toBe("/send-rsvp")
expect(options.method).toBe('POST')
expect(options.accountId).toBe(@event.accountId)
expect(options.body.event_id).toBe(@event.id)
expect(options.body.status).toBe("no")
describe "when the remote API request fails", ->
beforeEach ->
spyOn(NylasAPIRequest.prototype, 'run').andCallFake -> Promise.reject(new APIError(body: '', statusCode: 400))
it "should not be marked with the status", ->
@event = new Event
id: '12233AEDF5'
title: 'Meeting with <NAME>'
description: ''
location: ''
when:
end_time: 1408123800
start_time: 1408120200
start: 1408120200
end: 1408123800
participants: [
{"name": "<NAME>",
"email": "<EMAIL>",
"status": "yes"},
{"name": @myName,
"email": @myEmail,
"status": 'noreply'}
]
@task = new EventRSVPTask(@event, @myEmail, "no")
@task.performLocal()
@task.performRemote()
advanceClock()
expect(@event.participants[1].status).toBe "noreply"
it "should trigger an action to persist the change", ->
@task.performLocal()
@task.performRemote()
advanceClock()
expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
| true | _ = require 'underscore'
{NylasAPI,
NylasAPIRequest,
Event,
Actions,
APIError,
EventRSVPTask,
DatabaseStore,
DatabaseWriter,
AccountStore} = require 'nylas-exports'
xdescribe "EventRSVPTask", ->
beforeEach ->
spyOn(DatabaseStore, 'find').andCallFake => Promise.resolve(@event)
spyOn(DatabaseWriter.prototype, 'persistModel').andCallFake -> Promise.resolve()
@myName = "PI:NAME:<NAME>END_PI"
@myEmail = "PI:EMAIL:<EMAIL>END_PI"
@event = new Event
id: '12233AEDF5'
accountId: TEST_ACCOUNT_ID
title: 'Meeting with PI:NAME:<NAME>END_PI'
description: ''
location: ''
when:
end_time: 1408123800
start_time: 1408120200
start: 1408120200
end: 1408123800
participants: [
{"name": "PI:NAME:<NAME>END_PI",
"email": "PI:EMAIL:<EMAIL>END_PI",
"status": "yes"},
{"name":PI:NAME:<NAME>END_PI @myName,
"email": @myEmail,
"status": 'noreply'}
]
@task = new EventRSVPTask(@event, @myEmail, "no")
describe "performLocal", ->
it "should mark our status as no", ->
@task.performLocal()
advanceClock()
expect(@event.participants[1].status).toBe "no"
it "should trigger an action to persist the change", ->
@task.performLocal()
advanceClock()
expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
describe "performRemote", ->
it "should make the POST request to the message endpoint", ->
spyOn(NylasAPIRequest.prototype, 'run').andCallFake => new Promise (resolve,reject) ->
@task.performRemote()
options = NylasAPIRequest.prototype.run.mostRecentCall.object.options
expect(options.path).toBe("/send-rsvp")
expect(options.method).toBe('POST')
expect(options.accountId).toBe(@event.accountId)
expect(options.body.event_id).toBe(@event.id)
expect(options.body.status).toBe("no")
describe "when the remote API request fails", ->
beforeEach ->
spyOn(NylasAPIRequest.prototype, 'run').andCallFake -> Promise.reject(new APIError(body: '', statusCode: 400))
it "should not be marked with the status", ->
@event = new Event
id: '12233AEDF5'
title: 'Meeting with PI:NAME:<NAME>END_PI'
description: ''
location: ''
when:
end_time: 1408123800
start_time: 1408120200
start: 1408120200
end: 1408123800
participants: [
{"name": "PI:NAME:<NAME>END_PI",
"email": "PI:EMAIL:<EMAIL>END_PI",
"status": "yes"},
{"name": @myName,
"email": @myEmail,
"status": 'noreply'}
]
@task = new EventRSVPTask(@event, @myEmail, "no")
@task.performLocal()
@task.performRemote()
advanceClock()
expect(@event.participants[1].status).toBe "noreply"
it "should trigger an action to persist the change", ->
@task.performLocal()
@task.performRemote()
advanceClock()
expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
|
[
{
"context": "ls.extend @getInitialState(), options.state\n\n { firstName, lastName } = whoami().profile\n\n clearValidati",
"end": 386,
"score": 0.7638924717903137,
"start": 377,
"tag": "NAME",
"value": "firstName"
},
{
"context": "getInitialState(), options.state\n\n { fir... | client/app/lib/payment/stripeformview.coffee | ezgikaysi/koding | 1 | $ = require 'jquery'
whoami = require '../util/whoami'
showError = require '../util/showError'
kd = require 'kd'
KDFormViewWithFields = kd.FormViewWithFields
module.exports = class StripeFormView extends KDFormViewWithFields
getInitialState: -> kd.utils.dict()
constructor: (options = {}, data) ->
@state = kd.utils.extend @getInitialState(), options.state
{ firstName, lastName } = whoami().profile
clearValidationErrors = (input, event) ->
input.unsetTooltip()
input.validationNotifications = {}
input.clearValidationFeedback()
return no
notificationOptions = { type: 'tooltip', placement: 'top' }
fields = {}
fields.cardNumber = {
label : 'Card Number'
attributes :
autofocus : on
blur : ->
@oldValue = @getValue()
@setValue @oldValue.replace /\s|-/g, ''
focus : -> @setValue @oldValue if @oldValue
validate :
notifications: notificationOptions
rules :
clear : clearValidationErrors
checkCC : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
returnResult = result = Stripe.card.validateCardNumber val
result = if result then no else 'Card number is not valid'
input.setValidationResult 'checkCC', result
return returnResult
cardType : do =>
cssClass = null
return (input, event) =>
@unsetClass cssClass if cssClass
val = $.trim input.getValue().replace(/-|\s/g, '')
cssClass = Stripe.card.cardType(val).toLowerCase()
cssClass = kd.utils.slugify cssClass
@setClass cssClass
events :
cardType : 'keyup'
checkCC : ['keyup', 'blur']
clear : ['keydown']
}
fields.cardCVC = {
label : 'CVC'
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkCVC : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
returnResult = result = Stripe.card.validateCVC val
result = if result then no else 'CVC is not valid'
input.setValidationResult 'checkCVC', result
events :
clear : ['keydown']
checkCVC : ['blur', 'keyup']
}
fields.cardName = {
label : 'Name on Card'
cssClass : 'card-name'
defaultValue : "#{firstName} #{lastName}"
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
required : yes
events :
clear : ['keydown']
required : ['blur', 'keyup']
}
fields.cardMonth = {
label : 'Exp. Date'
placeholder : 'MM'
attributes :
maxlength : 2
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkMonth : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
# just to check for month, we are setting # a valid value to the year.
validYear = (new Date).getFullYear() + 1
returnResult = result = Stripe.card.validateExpiry val, validYear
result = if result then no else 'Invalid month!'
input.setValidationResult 'checkMonth', result
return returnResult
events :
clear : ['keydown']
checkMonth : ['blur', 'keyup']
}
fields.cardYear = {
label : ' '
placeholder : 'YYYY'
attributes :
maxlength : 4
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkYear : (yearInput, event) ->
yearVal = $.trim yearInput.getValue().replace(/-|\s/g, '')
validMonth = (new Date).getMonth() + 1
returnResult = result = Stripe.card.validateExpiry validMonth, yearVal
result = if result then no else 'Invalid year!'
yearInput.setValidationResult 'checkYear', result
return returnResult
events :
checkYear : ['keyup', 'blur']
clear : ['keydown']
}
{ planTitle, planInterval, currentPlan
monthPrice, yearPrice } = @state
fields.planTitle =
defaultValue : planTitle
cssClass : 'hidden'
fields.planInterval =
defaultValue : planInterval
cssClass : 'hidden'
fields.currentPlan =
defaultValue : currentPlan
cssClass : 'hidden'
planAmountMap =
year : yearPrice
month : monthPrice
fields.planAmount =
defaultValue : planAmountMap[planInterval]
cssClass : 'hidden'
options.fields = fields
options.cssClass = kd.utils.curry 'payment-method-entry-form clearfix', options.cssClass
options.name = 'method'
super options, data
showValidationErrorsOnInputs: (error) ->
{ cardNumber, cardCVC, cardName
cardMonth, cardYear } = @inputs
switch error.param
when 'number'
cardNumber.setValidationResult 'checkCC', 'Card number is not valid'
when 'exp_year'
cardYear.setValidationResult 'checkYear', 'Invalid year!'
when 'exp_month'
cardMonth.setValidationResult 'checkMonth', 'Invalid month!'
when 'cvc'
cardCVC.setValidationResult 'checkCVC', 'CVC is not valid'
else
showError error.message
cleanFormExceptName: ->
[
@inputs.cardNumber
@inputs.cardCVC
@inputs.cardMonth
@inputs.cardYear
].forEach (input) -> input.setValue ''
| 208399 | $ = require 'jquery'
whoami = require '../util/whoami'
showError = require '../util/showError'
kd = require 'kd'
KDFormViewWithFields = kd.FormViewWithFields
module.exports = class StripeFormView extends KDFormViewWithFields
getInitialState: -> kd.utils.dict()
constructor: (options = {}, data) ->
@state = kd.utils.extend @getInitialState(), options.state
{ <NAME>, <NAME> } = whoami().profile
clearValidationErrors = (input, event) ->
input.unsetTooltip()
input.validationNotifications = {}
input.clearValidationFeedback()
return no
notificationOptions = { type: 'tooltip', placement: 'top' }
fields = {}
fields.cardNumber = {
label : 'Card Number'
attributes :
autofocus : on
blur : ->
@oldValue = @getValue()
@setValue @oldValue.replace /\s|-/g, ''
focus : -> @setValue @oldValue if @oldValue
validate :
notifications: notificationOptions
rules :
clear : clearValidationErrors
checkCC : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
returnResult = result = Stripe.card.validateCardNumber val
result = if result then no else 'Card number is not valid'
input.setValidationResult 'checkCC', result
return returnResult
cardType : do =>
cssClass = null
return (input, event) =>
@unsetClass cssClass if cssClass
val = $.trim input.getValue().replace(/-|\s/g, '')
cssClass = Stripe.card.cardType(val).toLowerCase()
cssClass = kd.utils.slugify cssClass
@setClass cssClass
events :
cardType : 'keyup'
checkCC : ['keyup', 'blur']
clear : ['keydown']
}
fields.cardCVC = {
label : 'CVC'
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkCVC : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
returnResult = result = Stripe.card.validateCVC val
result = if result then no else 'CVC is not valid'
input.setValidationResult 'checkCVC', result
events :
clear : ['keydown']
checkCVC : ['blur', 'keyup']
}
fields.cardName = {
label : 'Name on Card'
cssClass : 'card-name'
defaultValue : "#{firstName} #{lastName}"
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
required : yes
events :
clear : ['keydown']
required : ['blur', 'keyup']
}
fields.cardMonth = {
label : 'Exp. Date'
placeholder : 'MM'
attributes :
maxlength : 2
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkMonth : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
# just to check for month, we are setting # a valid value to the year.
validYear = (new Date).getFullYear() + 1
returnResult = result = Stripe.card.validateExpiry val, validYear
result = if result then no else 'Invalid month!'
input.setValidationResult 'checkMonth', result
return returnResult
events :
clear : ['keydown']
checkMonth : ['blur', 'keyup']
}
fields.cardYear = {
label : ' '
placeholder : 'YYYY'
attributes :
maxlength : 4
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkYear : (yearInput, event) ->
yearVal = $.trim yearInput.getValue().replace(/-|\s/g, '')
validMonth = (new Date).getMonth() + 1
returnResult = result = Stripe.card.validateExpiry validMonth, yearVal
result = if result then no else 'Invalid year!'
yearInput.setValidationResult 'checkYear', result
return returnResult
events :
checkYear : ['keyup', 'blur']
clear : ['keydown']
}
{ planTitle, planInterval, currentPlan
monthPrice, yearPrice } = @state
fields.planTitle =
defaultValue : planTitle
cssClass : 'hidden'
fields.planInterval =
defaultValue : planInterval
cssClass : 'hidden'
fields.currentPlan =
defaultValue : currentPlan
cssClass : 'hidden'
planAmountMap =
year : yearPrice
month : monthPrice
fields.planAmount =
defaultValue : planAmountMap[planInterval]
cssClass : 'hidden'
options.fields = fields
options.cssClass = kd.utils.curry 'payment-method-entry-form clearfix', options.cssClass
options.name = 'method'
super options, data
showValidationErrorsOnInputs: (error) ->
{ cardNumber, cardCVC, cardName
cardMonth, cardYear } = @inputs
switch error.param
when 'number'
cardNumber.setValidationResult 'checkCC', 'Card number is not valid'
when 'exp_year'
cardYear.setValidationResult 'checkYear', 'Invalid year!'
when 'exp_month'
cardMonth.setValidationResult 'checkMonth', 'Invalid month!'
when 'cvc'
cardCVC.setValidationResult 'checkCVC', 'CVC is not valid'
else
showError error.message
cleanFormExceptName: ->
[
@inputs.cardNumber
@inputs.cardCVC
@inputs.cardMonth
@inputs.cardYear
].forEach (input) -> input.setValue ''
| true | $ = require 'jquery'
whoami = require '../util/whoami'
showError = require '../util/showError'
kd = require 'kd'
KDFormViewWithFields = kd.FormViewWithFields
module.exports = class StripeFormView extends KDFormViewWithFields
getInitialState: -> kd.utils.dict()
constructor: (options = {}, data) ->
@state = kd.utils.extend @getInitialState(), options.state
{ PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI } = whoami().profile
clearValidationErrors = (input, event) ->
input.unsetTooltip()
input.validationNotifications = {}
input.clearValidationFeedback()
return no
notificationOptions = { type: 'tooltip', placement: 'top' }
fields = {}
fields.cardNumber = {
label : 'Card Number'
attributes :
autofocus : on
blur : ->
@oldValue = @getValue()
@setValue @oldValue.replace /\s|-/g, ''
focus : -> @setValue @oldValue if @oldValue
validate :
notifications: notificationOptions
rules :
clear : clearValidationErrors
checkCC : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
returnResult = result = Stripe.card.validateCardNumber val
result = if result then no else 'Card number is not valid'
input.setValidationResult 'checkCC', result
return returnResult
cardType : do =>
cssClass = null
return (input, event) =>
@unsetClass cssClass if cssClass
val = $.trim input.getValue().replace(/-|\s/g, '')
cssClass = Stripe.card.cardType(val).toLowerCase()
cssClass = kd.utils.slugify cssClass
@setClass cssClass
events :
cardType : 'keyup'
checkCC : ['keyup', 'blur']
clear : ['keydown']
}
fields.cardCVC = {
label : 'CVC'
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkCVC : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
returnResult = result = Stripe.card.validateCVC val
result = if result then no else 'CVC is not valid'
input.setValidationResult 'checkCVC', result
events :
clear : ['keydown']
checkCVC : ['blur', 'keyup']
}
fields.cardName = {
label : 'Name on Card'
cssClass : 'card-name'
defaultValue : "#{firstName} #{lastName}"
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
required : yes
events :
clear : ['keydown']
required : ['blur', 'keyup']
}
fields.cardMonth = {
label : 'Exp. Date'
placeholder : 'MM'
attributes :
maxlength : 2
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkMonth : (input, event) ->
val = $.trim input.getValue().replace(/-|\s/g, '')
# just to check for month, we are setting # a valid value to the year.
validYear = (new Date).getFullYear() + 1
returnResult = result = Stripe.card.validateExpiry val, validYear
result = if result then no else 'Invalid month!'
input.setValidationResult 'checkMonth', result
return returnResult
events :
clear : ['keydown']
checkMonth : ['blur', 'keyup']
}
fields.cardYear = {
label : ' '
placeholder : 'YYYY'
attributes :
maxlength : 4
validate :
notifications : notificationOptions
rules :
clear : clearValidationErrors
checkYear : (yearInput, event) ->
yearVal = $.trim yearInput.getValue().replace(/-|\s/g, '')
validMonth = (new Date).getMonth() + 1
returnResult = result = Stripe.card.validateExpiry validMonth, yearVal
result = if result then no else 'Invalid year!'
yearInput.setValidationResult 'checkYear', result
return returnResult
events :
checkYear : ['keyup', 'blur']
clear : ['keydown']
}
{ planTitle, planInterval, currentPlan
monthPrice, yearPrice } = @state
fields.planTitle =
defaultValue : planTitle
cssClass : 'hidden'
fields.planInterval =
defaultValue : planInterval
cssClass : 'hidden'
fields.currentPlan =
defaultValue : currentPlan
cssClass : 'hidden'
planAmountMap =
year : yearPrice
month : monthPrice
fields.planAmount =
defaultValue : planAmountMap[planInterval]
cssClass : 'hidden'
options.fields = fields
options.cssClass = kd.utils.curry 'payment-method-entry-form clearfix', options.cssClass
options.name = 'method'
super options, data
showValidationErrorsOnInputs: (error) ->
{ cardNumber, cardCVC, cardName
cardMonth, cardYear } = @inputs
switch error.param
when 'number'
cardNumber.setValidationResult 'checkCC', 'Card number is not valid'
when 'exp_year'
cardYear.setValidationResult 'checkYear', 'Invalid year!'
when 'exp_month'
cardMonth.setValidationResult 'checkMonth', 'Invalid month!'
when 'cvc'
cardCVC.setValidationResult 'checkCVC', 'CVC is not valid'
else
showError error.message
cleanFormExceptName: ->
[
@inputs.cardNumber
@inputs.cardCVC
@inputs.cardMonth
@inputs.cardYear
].forEach (input) -> input.setValue ''
|
[
{
"context": "d.json',\n data:\n user:\n name: username\n email: email\n dataType: 'json'\n ",
"end": 219,
"score": 0.6694516539573669,
"start": 211,
"tag": "NAME",
"value": "username"
},
{
"context": "d, background, func) ->\n parameters = use... | app/javascript/src/legacy/user.coffee | proteanblank/moebooru | 1 | window.User =
checkXhr: null
cancel_check: ->
User.checkXhr?.abort()
reset_password: (username, email, func) ->
jQuery.ajax '/user/reset_password.json',
data:
user:
name: username
email: email
dataType: 'json'
method: 'POST'
.done func
.fail (xhr) ->
json = xhr.responseJSON
if json?
func json
else
notice "Error: unknown error"
return
check: (username, password, background, func) ->
parameters = username: username
if password
parameters.password = password
User.cancel_check()
User.checkXhr = jQuery.ajax '/user/check.json',
data: parameters
dataType: 'json'
method: 'POST'
.done func
return
create: (username, password, email, func) ->
parameters =
user:
name: username
password: password
if email
parameters.user.email = email
jQuery.ajax '/user/create.json',
data: parameters
dataType: 'json'
method: 'POST'
.done func
return
check_name_timer: null
last_username_in_form: null
success_func: null
messages: []
init: ->
$('login-popup-notices').select('SPAN').each (e) ->
User.messages.push e.id
return
###
# IE makes us jump lots of hoops. We have to watch submit events on every object
# instead of just window because IE doesn't support event capturing. We have to
# override the submit method in every form to catch programmatic submits, because
# IE doesn't seem to support initiating events by firing them.
#
# Also, since we can't capture events, we need to be sure our submit event is done
# before other handlers, so if we cancel the event, we prevent other event handlers
# from continuing. However, we need to attach after forms have been created. So,
# this needs to be run as an early DOMLoaded event, and any other code that attaches
# submit events to code needs to be run in a later DOMLoaded event (or later events).
#
###
$$('FORM.need-signup').each (form) ->
form.observe 'submit', User.run_login_onsubmit
return
### If you select an item from the history dropdown in IE7, change events never fire, so
# use keyup instead. This isn't a problem with password fields, since there's no history
# dropdown.
###
$('login-popup').observe 'submit', (e) ->
e.stop()
User.form_submitted()
return
$('login-popup-submit').observe 'click', (e) ->
e.stop()
User.form_submitted()
return
$('login-popup-cancel').observe 'click', (e) ->
e.stop()
User.close false
return
$('login-popup-username').observe 'blur', (e) ->
User.form_username_blur()
return
$('login-popup-username').observe 'focus', (e) ->
User.form_username_focus()
return
$('login-popup-username').observe 'keyup', (e) ->
User.form_username_changed true
return
$('login-tabs').select('LI').each (a) ->
a.observe 'mousedown', (e) ->
e.stop()
return
return
$('login-tabs').select('LI').each (a) ->
a.observe 'click', (e) ->
e.stop()
User.set_tab a.id
return
return
### IE and FF are glitchy with form submission: they fail to submit forms unless
# there's an <INPUT type="submit"> somewhere in the form. IE is even worse:
# even if there is one, if it's hidden on page load (including if it's a parent
# element hidden), it'll never submit the form, even if it's shown later. Don't
# rely on this behavior; just catch enter presses and submit the form explicitly.
###
OnKey 13, {
AllowInputFields: true
Element: $('login-popup')
}, (e) ->
e.stop()
User.form_submitted()
return
### Escape closes the login box. ###
OnKey 27, {
AllowInputFields: true
AlwaysAllowOpera: true
}, (e) ->
if !User.success_func
return false
User.close false
true
return
open: (success) ->
if User.success_func
User.close false
User.success_func = success
$('login-background').show()
$('login-container').show()
User.set_tab 'tab-login'
return
close: (run_success_func) ->
if !User.success_func
return
$('login-background').hide()
$('login-container').hide()
User.active_tab = null
User.check_name_timer = null
func = User.success_func
User.success_func = null
if run_success_func
window.setTimeout func, 0
return
run_login_onclick: (event) ->
event = Event.extend(event)
### event.target is not copied by clone_event. ###
target = $(event.target)
### event is not available when we get to the callback in IE7. ###
e = clone_event(event)
if User.run_login(true, (->
if target.hasClassName('login-button')
### This is a login button, and not an action that happened to need login. After
# a successful login, don't click the button; that'll just go to the login page.
# Instead, just reload the current page.
###
Cookie.put 'notice', 'You have been logged in.'
document.location.reload()
return
target.simulate_anchor_click e
return
))
return true
### Login is running, so stop the event. Don't just return false; call stop(), so
# event.stopped is available to the caller if we've been sent this message via
# Element.dispatchEvent.
###
event.stop()
false
run_login_onsubmit: (event) ->
### Set skip_complete_on_true, so if we don't need to login, we don't resubmit the
# event; we just don't cancel it.
###
target = $(event.target)
if !User.run_login(true, (->
target.simulate_submit()
return
))
event.stop()
return
run_login: (only_complete_on_login, complete) ->
if Cookie.get('user_info') != ''
if !only_complete_on_login
complete()
return true
User.open complete
false
active_tab: null
set_tab: (tab) ->
if User.active_tab == tab
return
User.active_tab = tab
User.check_name_timer = null
User.last_username_in_form = null
$('login-tabs').select('LI').each (li) ->
li.removeClassName 'selected'
return
$('login-tabs').down('#' + tab).addClassName 'selected'
$$('.tab-header-text').each (li) ->
li.hide()
return
$(tab + '-text').show()
if tab == 'tab-login'
### If the user's browser fills in a username but no password, focus the password. Otherwise,
# focus the username.
###
if $('login-popup-password').value == '' and $('login-popup-username').value != ''
$('login-popup-password').focus()
else
$('login-popup-username').focus()
User.set_state 'login-blank'
else if tab == 'tab-reset'
User.set_state 'reset-blank'
$('login-popup-username').focus()
User.form_username_changed()
return
message: (text) ->
i = 0
l = User.messages.length
while i < l
elem = User.messages[i]
$(elem).hide()
i++
$('login-popup-message').update text
$('login-popup-message').show()
return
set_state: (state) ->
show = {}
if state.match(/^login-/)
show['login-popup-password-box'] = true
if state == 'login-blank'
$('login-popup-submit').update 'Login'
else if state == 'login-user-exists'
$('login-popup-submit').update 'Login'
else if state == 'login-confirm-password'
show['login-popup-password-confirm-box'] = true
$('login-popup-submit').update 'Create account'
else if state == 'login-confirm-password-mismatch'
$('login-popup-submit').update 'Create account'
show['login-popup-' + state] = true
else if state.match(/^reset-/)
show['login-popup-email-box'] = true
$('login-popup-submit').update 'Reset password'
show['login-popup-' + state] = true
all = [
'login-popup-email-box'
'login-popup-password-box'
'login-popup-password-confirm-box'
].concat(User.messages)
window.current_state = state
i = 0
l = all.length
while i < l
elem = all[i]
if show[elem]
$(elem).show()
else
$(elem).hide()
i++
return
pending_username: null
form_username_changed: (keyup) ->
username = $('login-popup-username').value
if username == User.last_username_in_form
return
User.last_username_in_form = username
User.cancel_check()
if User.check_name_timer
window.clearTimeout User.check_name_timer
User.pending_username = null
if username == ''
if User.active_tab == 'tab-login'
User.set_state 'login-blank'
else if User.active_tab == 'tab-reset'
User.set_state 'reset-blank'
return
### Delay on keyup, so we don't send tons of requests. Don't delay otherwise,
# so we don't introduce lag when we don't have to.
###
ms = 500
if !keyup and User.check_name_timer
ms = 0
###
# Make sure the UI is still usable if this never finished. This way, we don't
# lag the interface if these JSON requests are taking longer than usual; you should
# be able to click "login" immediately as soon as a username and password are entered.
# Entering a username and password and clicking "login" should still behave properly
# if the username doesn't exist and the check_name_timer JSON request hasn't come
# back yet.
#
# If the state isn't "blank", the button is already enabled.
###
User.check_name_timer = window.setTimeout((->
User.check_name_timer = null
User.check username, null, true, (resp) ->
if resp.exists
### Update the username to match the actual user's case. If the form contents have
# changed since we started this check, don't do this. (We cancel this event if we
# see the contents change, but the contents can change without this event firing
# at all.)
###
current_username = $('login-popup-username').value
if current_username == username
### If the element doesn't have focus, change the text to match. If it does, wait
# until it loses focus, so it doesn't interfere with the user editing it.
###
if !$('login-popup').focused
$('login-popup-username').value = resp.name
else
User.pending_username = resp.name
if User.active_tab == 'tab-login'
if !resp.exists
User.set_state 'login-confirm-password'
return
else
User.set_state 'login-user-exists'
else if User.active_tab == 'tab-reset'
if !resp.exists
User.set_state 'reset-blank'
else if resp.no_email
User.set_state 'reset-user-has-no-email'
else
User.set_state 'reset-user-exists'
return
return
), ms)
return
form_username_focus: ->
$('login-popup').focused = true
return
form_username_blur: ->
$('login-popup').focused = false
### When the username field loses focus, update the username case to match the
# result we got back from check(), if any.
###
if User.pending_username
$('login-popup').username.value = User.pending_username
User.pending_username = null
### We watch keyup on the username, because change events are unreliable in IE; update
# when focus is lost, too, so we see changes made without using the keyboard.
###
User.form_username_changed false
return
form_submitted: ->
User.cancel_check()
if User.check_name_timer
window.clearTimeout User.check_name_timer
username = $('login-popup-username').value
password = $('login-popup-password').value
password_confirm = $('login-popup-password-confirm').value
email = $('login-popup-email').value
if username == ''
return
if User.active_tab == 'tab-login'
if password == ''
User.message 'Please enter a password.'
return
if window.current_state == 'login-confirm-password'
if password != password_confirm
User.message 'The passwords you\'ve entered don\'t match.'
else
# create account
User.create username, password, null, (resp) ->
if resp.response == 'success'
User.close true
else if resp.response == 'error'
User.message resp.errors.join('<br>')
return
return
User.check username, password, false, (resp) ->
if !resp.exists
User.set_state 'login-confirm-password'
return
if resp.response == 'wrong-password'
notice 'Incorrect password'
return
User.close true
return
else if User.active_tab == 'tab-reset'
if email == ''
return
User.reset_password username, email, (resp) ->
if resp.result == 'success'
User.set_state 'reset-successful'
else if resp.result == 'unknown-user'
User.set_state 'reset-unknown-user'
else if resp.result == 'wrong-email'
User.set_state 'reset-user-email-incorrect'
else if resp.result == 'no-email'
User.set_state 'reset-user-has-no-email'
else if resp.result == 'invalid-email'
User.set_state 'reset-user-email-invalid'
return
return
modify_blacklist: (add, remove, success) ->
jQuery.ajax '/user/modify_blacklist.json',
data:
add: add
remove: remove
dataType: 'json'
method: 'POST'
.done (resp) ->
success?(resp)
.fail (xhr) ->
notice "Error: #{xhr.responseJSON?.reason ? 'unknown error'}"
return
set_pool_browse_mode: (browse_mode) ->
jQuery.ajax '/user/update.json',
data:
user:
pool_browse_mode: browse_mode
dataType: 'json'
method: 'POST'
.done (resp) ->
window.location.reload()
.fail (xhr) ->
notice "Error: #{xhr.responseJSON?.reason ? 'unknown error'}"
return
get_current_user_info: ->
user_info = Cookie.get('user_info')
if !user_info
return null
user_info.split ';'
get_current_user_info_field: (idx, def) ->
user_info = User.get_current_user_info()
if !user_info
return def
if idx >= user_info.length
return def
user_info[idx]
get_current_user_id: ->
parseInt User.get_current_user_info_field(0, 0)
get_current_user_level: ->
parseInt User.get_current_user_info_field(1, 0)
get_use_browser: ->
setting = User.get_current_user_info_field(2, '0')
setting == '1'
is_member_or_higher: ->
User.get_current_user_level() >= 20
is_mod_or_higher: ->
User.get_current_user_level() >= 40
| 179218 | window.User =
checkXhr: null
cancel_check: ->
User.checkXhr?.abort()
reset_password: (username, email, func) ->
jQuery.ajax '/user/reset_password.json',
data:
user:
name: <NAME>
email: email
dataType: 'json'
method: 'POST'
.done func
.fail (xhr) ->
json = xhr.responseJSON
if json?
func json
else
notice "Error: unknown error"
return
check: (username, password, background, func) ->
parameters = username: username
if password
parameters.password = <PASSWORD>
User.cancel_check()
User.checkXhr = jQuery.ajax '/user/check.json',
data: parameters
dataType: 'json'
method: 'POST'
.done func
return
create: (username, password, email, func) ->
parameters =
user:
name: <NAME>
password: <PASSWORD>
if email
parameters.user.email = email
jQuery.ajax '/user/create.json',
data: parameters
dataType: 'json'
method: 'POST'
.done func
return
check_name_timer: null
last_username_in_form: null
success_func: null
messages: []
init: ->
$('login-popup-notices').select('SPAN').each (e) ->
User.messages.push e.id
return
###
# IE makes us jump lots of hoops. We have to watch submit events on every object
# instead of just window because IE doesn't support event capturing. We have to
# override the submit method in every form to catch programmatic submits, because
# IE doesn't seem to support initiating events by firing them.
#
# Also, since we can't capture events, we need to be sure our submit event is done
# before other handlers, so if we cancel the event, we prevent other event handlers
# from continuing. However, we need to attach after forms have been created. So,
# this needs to be run as an early DOMLoaded event, and any other code that attaches
# submit events to code needs to be run in a later DOMLoaded event (or later events).
#
###
$$('FORM.need-signup').each (form) ->
form.observe 'submit', User.run_login_onsubmit
return
### If you select an item from the history dropdown in IE7, change events never fire, so
# use keyup instead. This isn't a problem with password fields, since there's no history
# dropdown.
###
$('login-popup').observe 'submit', (e) ->
e.stop()
User.form_submitted()
return
$('login-popup-submit').observe 'click', (e) ->
e.stop()
User.form_submitted()
return
$('login-popup-cancel').observe 'click', (e) ->
e.stop()
User.close false
return
$('login-popup-username').observe 'blur', (e) ->
User.form_username_blur()
return
$('login-popup-username').observe 'focus', (e) ->
User.form_username_focus()
return
$('login-popup-username').observe 'keyup', (e) ->
User.form_username_changed true
return
$('login-tabs').select('LI').each (a) ->
a.observe 'mousedown', (e) ->
e.stop()
return
return
$('login-tabs').select('LI').each (a) ->
a.observe 'click', (e) ->
e.stop()
User.set_tab a.id
return
return
### IE and FF are glitchy with form submission: they fail to submit forms unless
# there's an <INPUT type="submit"> somewhere in the form. IE is even worse:
# even if there is one, if it's hidden on page load (including if it's a parent
# element hidden), it'll never submit the form, even if it's shown later. Don't
# rely on this behavior; just catch enter presses and submit the form explicitly.
###
OnKey 13, {
AllowInputFields: true
Element: $('login-popup')
}, (e) ->
e.stop()
User.form_submitted()
return
### Escape closes the login box. ###
OnKey 27, {
AllowInputFields: true
AlwaysAllowOpera: true
}, (e) ->
if !User.success_func
return false
User.close false
true
return
open: (success) ->
if User.success_func
User.close false
User.success_func = success
$('login-background').show()
$('login-container').show()
User.set_tab 'tab-login'
return
close: (run_success_func) ->
if !User.success_func
return
$('login-background').hide()
$('login-container').hide()
User.active_tab = null
User.check_name_timer = null
func = User.success_func
User.success_func = null
if run_success_func
window.setTimeout func, 0
return
run_login_onclick: (event) ->
event = Event.extend(event)
### event.target is not copied by clone_event. ###
target = $(event.target)
### event is not available when we get to the callback in IE7. ###
e = clone_event(event)
if User.run_login(true, (->
if target.hasClassName('login-button')
### This is a login button, and not an action that happened to need login. After
# a successful login, don't click the button; that'll just go to the login page.
# Instead, just reload the current page.
###
Cookie.put 'notice', 'You have been logged in.'
document.location.reload()
return
target.simulate_anchor_click e
return
))
return true
### Login is running, so stop the event. Don't just return false; call stop(), so
# event.stopped is available to the caller if we've been sent this message via
# Element.dispatchEvent.
###
event.stop()
false
run_login_onsubmit: (event) ->
### Set skip_complete_on_true, so if we don't need to login, we don't resubmit the
# event; we just don't cancel it.
###
target = $(event.target)
if !User.run_login(true, (->
target.simulate_submit()
return
))
event.stop()
return
run_login: (only_complete_on_login, complete) ->
if Cookie.get('user_info') != ''
if !only_complete_on_login
complete()
return true
User.open complete
false
active_tab: null
set_tab: (tab) ->
if User.active_tab == tab
return
User.active_tab = tab
User.check_name_timer = null
User.last_username_in_form = null
$('login-tabs').select('LI').each (li) ->
li.removeClassName 'selected'
return
$('login-tabs').down('#' + tab).addClassName 'selected'
$$('.tab-header-text').each (li) ->
li.hide()
return
$(tab + '-text').show()
if tab == 'tab-login'
### If the user's browser fills in a username but no password, focus the password. Otherwise,
# focus the username.
###
if $('login-popup-password').value == '' and $('login-popup-username').value != ''
$('login-popup-password').focus()
else
$('login-popup-username').focus()
User.set_state 'login-blank'
else if tab == 'tab-reset'
User.set_state 'reset-blank'
$('login-popup-username').focus()
User.form_username_changed()
return
message: (text) ->
i = 0
l = User.messages.length
while i < l
elem = User.messages[i]
$(elem).hide()
i++
$('login-popup-message').update text
$('login-popup-message').show()
return
set_state: (state) ->
show = {}
if state.match(/^login-/)
show['login-popup-password-box'] = true
if state == 'login-blank'
$('login-popup-submit').update 'Login'
else if state == 'login-user-exists'
$('login-popup-submit').update 'Login'
else if state == 'login-confirm-password'
show['login-popup-password-confirm-box'] = true
$('login-popup-submit').update 'Create account'
else if state == 'login-confirm-password-mismatch'
$('login-popup-submit').update 'Create account'
show['login-popup-' + state] = true
else if state.match(/^reset-/)
show['login-popup-email-box'] = true
$('login-popup-submit').update 'Reset password'
show['login-popup-' + state] = true
all = [
'login-popup-email-box'
'login-popup-password-box'
'login-popup-password-confirm-box'
].concat(User.messages)
window.current_state = state
i = 0
l = all.length
while i < l
elem = all[i]
if show[elem]
$(elem).show()
else
$(elem).hide()
i++
return
pending_username: null
form_username_changed: (keyup) ->
username = $('login-popup-username').value
if username == User.last_username_in_form
return
User.last_username_in_form = username
User.cancel_check()
if User.check_name_timer
window.clearTimeout User.check_name_timer
User.pending_username = null
if username == ''
if User.active_tab == 'tab-login'
User.set_state 'login-blank'
else if User.active_tab == 'tab-reset'
User.set_state 'reset-blank'
return
### Delay on keyup, so we don't send tons of requests. Don't delay otherwise,
# so we don't introduce lag when we don't have to.
###
ms = 500
if !keyup and User.check_name_timer
ms = 0
###
# Make sure the UI is still usable if this never finished. This way, we don't
# lag the interface if these JSON requests are taking longer than usual; you should
# be able to click "login" immediately as soon as a username and password are entered.
# Entering a username and password and clicking "login" should still behave properly
# if the username doesn't exist and the check_name_timer JSON request hasn't come
# back yet.
#
# If the state isn't "blank", the button is already enabled.
###
User.check_name_timer = window.setTimeout((->
User.check_name_timer = null
User.check username, null, true, (resp) ->
if resp.exists
### Update the username to match the actual user's case. If the form contents have
# changed since we started this check, don't do this. (We cancel this event if we
# see the contents change, but the contents can change without this event firing
# at all.)
###
current_username = $('login-popup-username').value
if current_username == username
### If the element doesn't have focus, change the text to match. If it does, wait
# until it loses focus, so it doesn't interfere with the user editing it.
###
if !$('login-popup').focused
$('login-popup-username').value = resp.name
else
User.pending_username = resp.name
if User.active_tab == 'tab-login'
if !resp.exists
User.set_state 'login-confirm-password'
return
else
User.set_state 'login-user-exists'
else if User.active_tab == 'tab-reset'
if !resp.exists
User.set_state 'reset-blank'
else if resp.no_email
User.set_state 'reset-user-has-no-email'
else
User.set_state 'reset-user-exists'
return
return
), ms)
return
form_username_focus: ->
$('login-popup').focused = true
return
form_username_blur: ->
$('login-popup').focused = false
### When the username field loses focus, update the username case to match the
# result we got back from check(), if any.
###
if User.pending_username
$('login-popup').username.value = User.pending_username
User.pending_username = null
### We watch keyup on the username, because change events are unreliable in IE; update
# when focus is lost, too, so we see changes made without using the keyboard.
###
User.form_username_changed false
return
form_submitted: ->
User.cancel_check()
if User.check_name_timer
window.clearTimeout User.check_name_timer
username = $('login-popup-username').value
password = $('login-popup-password').value
password_confirm = $('login-popup-password-confirm').value
email = $('login-popup-email').value
if username == ''
return
if User.active_tab == 'tab-login'
if password == ''
User.message 'Please enter a password.'
return
if window.current_state == 'login-confirm-password'
if password != password_confirm
User.message 'The passwords you\'ve entered don\'t match.'
else
# create account
User.create username, password, null, (resp) ->
if resp.response == 'success'
User.close true
else if resp.response == 'error'
User.message resp.errors.join('<br>')
return
return
User.check username, password, false, (resp) ->
if !resp.exists
User.set_state 'login-confirm-password'
return
if resp.response == 'wrong-password'
notice 'Incorrect password'
return
User.close true
return
else if User.active_tab == 'tab-reset'
if email == ''
return
User.reset_password username, email, (resp) ->
if resp.result == 'success'
User.set_state 'reset-successful'
else if resp.result == 'unknown-user'
User.set_state 'reset-unknown-user'
else if resp.result == 'wrong-email'
User.set_state 'reset-user-email-incorrect'
else if resp.result == 'no-email'
User.set_state 'reset-user-has-no-email'
else if resp.result == 'invalid-email'
User.set_state 'reset-user-email-invalid'
return
return
modify_blacklist: (add, remove, success) ->
jQuery.ajax '/user/modify_blacklist.json',
data:
add: add
remove: remove
dataType: 'json'
method: 'POST'
.done (resp) ->
success?(resp)
.fail (xhr) ->
notice "Error: #{xhr.responseJSON?.reason ? 'unknown error'}"
return
set_pool_browse_mode: (browse_mode) ->
jQuery.ajax '/user/update.json',
data:
user:
pool_browse_mode: browse_mode
dataType: 'json'
method: 'POST'
.done (resp) ->
window.location.reload()
.fail (xhr) ->
notice "Error: #{xhr.responseJSON?.reason ? 'unknown error'}"
return
get_current_user_info: ->
user_info = Cookie.get('user_info')
if !user_info
return null
user_info.split ';'
get_current_user_info_field: (idx, def) ->
user_info = User.get_current_user_info()
if !user_info
return def
if idx >= user_info.length
return def
user_info[idx]
get_current_user_id: ->
parseInt User.get_current_user_info_field(0, 0)
get_current_user_level: ->
parseInt User.get_current_user_info_field(1, 0)
get_use_browser: ->
setting = User.get_current_user_info_field(2, '0')
setting == '1'
is_member_or_higher: ->
User.get_current_user_level() >= 20
is_mod_or_higher: ->
User.get_current_user_level() >= 40
| true | window.User =
checkXhr: null
cancel_check: ->
User.checkXhr?.abort()
reset_password: (username, email, func) ->
jQuery.ajax '/user/reset_password.json',
data:
user:
name: PI:NAME:<NAME>END_PI
email: email
dataType: 'json'
method: 'POST'
.done func
.fail (xhr) ->
json = xhr.responseJSON
if json?
func json
else
notice "Error: unknown error"
return
check: (username, password, background, func) ->
parameters = username: username
if password
parameters.password = PI:PASSWORD:<PASSWORD>END_PI
User.cancel_check()
User.checkXhr = jQuery.ajax '/user/check.json',
data: parameters
dataType: 'json'
method: 'POST'
.done func
return
create: (username, password, email, func) ->
parameters =
user:
name: PI:NAME:<NAME>END_PI
password: PI:PASSWORD:<PASSWORD>END_PI
if email
parameters.user.email = email
jQuery.ajax '/user/create.json',
data: parameters
dataType: 'json'
method: 'POST'
.done func
return
check_name_timer: null
last_username_in_form: null
success_func: null
messages: []
init: ->
$('login-popup-notices').select('SPAN').each (e) ->
User.messages.push e.id
return
###
# IE makes us jump lots of hoops. We have to watch submit events on every object
# instead of just window because IE doesn't support event capturing. We have to
# override the submit method in every form to catch programmatic submits, because
# IE doesn't seem to support initiating events by firing them.
#
# Also, since we can't capture events, we need to be sure our submit event is done
# before other handlers, so if we cancel the event, we prevent other event handlers
# from continuing. However, we need to attach after forms have been created. So,
# this needs to be run as an early DOMLoaded event, and any other code that attaches
# submit events to code needs to be run in a later DOMLoaded event (or later events).
#
###
$$('FORM.need-signup').each (form) ->
form.observe 'submit', User.run_login_onsubmit
return
### If you select an item from the history dropdown in IE7, change events never fire, so
# use keyup instead. This isn't a problem with password fields, since there's no history
# dropdown.
###
$('login-popup').observe 'submit', (e) ->
e.stop()
User.form_submitted()
return
$('login-popup-submit').observe 'click', (e) ->
e.stop()
User.form_submitted()
return
$('login-popup-cancel').observe 'click', (e) ->
e.stop()
User.close false
return
$('login-popup-username').observe 'blur', (e) ->
User.form_username_blur()
return
$('login-popup-username').observe 'focus', (e) ->
User.form_username_focus()
return
$('login-popup-username').observe 'keyup', (e) ->
User.form_username_changed true
return
$('login-tabs').select('LI').each (a) ->
a.observe 'mousedown', (e) ->
e.stop()
return
return
$('login-tabs').select('LI').each (a) ->
a.observe 'click', (e) ->
e.stop()
User.set_tab a.id
return
return
### IE and FF are glitchy with form submission: they fail to submit forms unless
# there's an <INPUT type="submit"> somewhere in the form. IE is even worse:
# even if there is one, if it's hidden on page load (including if it's a parent
# element hidden), it'll never submit the form, even if it's shown later. Don't
# rely on this behavior; just catch enter presses and submit the form explicitly.
###
OnKey 13, {
AllowInputFields: true
Element: $('login-popup')
}, (e) ->
e.stop()
User.form_submitted()
return
### Escape closes the login box. ###
OnKey 27, {
AllowInputFields: true
AlwaysAllowOpera: true
}, (e) ->
if !User.success_func
return false
User.close false
true
return
open: (success) ->
if User.success_func
User.close false
User.success_func = success
$('login-background').show()
$('login-container').show()
User.set_tab 'tab-login'
return
close: (run_success_func) ->
if !User.success_func
return
$('login-background').hide()
$('login-container').hide()
User.active_tab = null
User.check_name_timer = null
func = User.success_func
User.success_func = null
if run_success_func
window.setTimeout func, 0
return
run_login_onclick: (event) ->
event = Event.extend(event)
### event.target is not copied by clone_event. ###
target = $(event.target)
### event is not available when we get to the callback in IE7. ###
e = clone_event(event)
if User.run_login(true, (->
if target.hasClassName('login-button')
### This is a login button, and not an action that happened to need login. After
# a successful login, don't click the button; that'll just go to the login page.
# Instead, just reload the current page.
###
Cookie.put 'notice', 'You have been logged in.'
document.location.reload()
return
target.simulate_anchor_click e
return
))
return true
### Login is running, so stop the event. Don't just return false; call stop(), so
# event.stopped is available to the caller if we've been sent this message via
# Element.dispatchEvent.
###
event.stop()
false
run_login_onsubmit: (event) ->
### Set skip_complete_on_true, so if we don't need to login, we don't resubmit the
# event; we just don't cancel it.
###
target = $(event.target)
if !User.run_login(true, (->
target.simulate_submit()
return
))
event.stop()
return
run_login: (only_complete_on_login, complete) ->
if Cookie.get('user_info') != ''
if !only_complete_on_login
complete()
return true
User.open complete
false
active_tab: null
set_tab: (tab) ->
if User.active_tab == tab
return
User.active_tab = tab
User.check_name_timer = null
User.last_username_in_form = null
$('login-tabs').select('LI').each (li) ->
li.removeClassName 'selected'
return
$('login-tabs').down('#' + tab).addClassName 'selected'
$$('.tab-header-text').each (li) ->
li.hide()
return
$(tab + '-text').show()
if tab == 'tab-login'
### If the user's browser fills in a username but no password, focus the password. Otherwise,
# focus the username.
###
if $('login-popup-password').value == '' and $('login-popup-username').value != ''
$('login-popup-password').focus()
else
$('login-popup-username').focus()
User.set_state 'login-blank'
else if tab == 'tab-reset'
User.set_state 'reset-blank'
$('login-popup-username').focus()
User.form_username_changed()
return
message: (text) ->
i = 0
l = User.messages.length
while i < l
elem = User.messages[i]
$(elem).hide()
i++
$('login-popup-message').update text
$('login-popup-message').show()
return
set_state: (state) ->
show = {}
if state.match(/^login-/)
show['login-popup-password-box'] = true
if state == 'login-blank'
$('login-popup-submit').update 'Login'
else if state == 'login-user-exists'
$('login-popup-submit').update 'Login'
else if state == 'login-confirm-password'
show['login-popup-password-confirm-box'] = true
$('login-popup-submit').update 'Create account'
else if state == 'login-confirm-password-mismatch'
$('login-popup-submit').update 'Create account'
show['login-popup-' + state] = true
else if state.match(/^reset-/)
show['login-popup-email-box'] = true
$('login-popup-submit').update 'Reset password'
show['login-popup-' + state] = true
all = [
'login-popup-email-box'
'login-popup-password-box'
'login-popup-password-confirm-box'
].concat(User.messages)
window.current_state = state
i = 0
l = all.length
while i < l
elem = all[i]
if show[elem]
$(elem).show()
else
$(elem).hide()
i++
return
pending_username: null
form_username_changed: (keyup) ->
username = $('login-popup-username').value
if username == User.last_username_in_form
return
User.last_username_in_form = username
User.cancel_check()
if User.check_name_timer
window.clearTimeout User.check_name_timer
User.pending_username = null
if username == ''
if User.active_tab == 'tab-login'
User.set_state 'login-blank'
else if User.active_tab == 'tab-reset'
User.set_state 'reset-blank'
return
### Delay on keyup, so we don't send tons of requests. Don't delay otherwise,
# so we don't introduce lag when we don't have to.
###
ms = 500
if !keyup and User.check_name_timer
ms = 0
###
# Make sure the UI is still usable if this never finished. This way, we don't
# lag the interface if these JSON requests are taking longer than usual; you should
# be able to click "login" immediately as soon as a username and password are entered.
# Entering a username and password and clicking "login" should still behave properly
# if the username doesn't exist and the check_name_timer JSON request hasn't come
# back yet.
#
# If the state isn't "blank", the button is already enabled.
###
User.check_name_timer = window.setTimeout((->
User.check_name_timer = null
User.check username, null, true, (resp) ->
if resp.exists
### Update the username to match the actual user's case. If the form contents have
# changed since we started this check, don't do this. (We cancel this event if we
# see the contents change, but the contents can change without this event firing
# at all.)
###
current_username = $('login-popup-username').value
if current_username == username
### If the element doesn't have focus, change the text to match. If it does, wait
# until it loses focus, so it doesn't interfere with the user editing it.
###
if !$('login-popup').focused
$('login-popup-username').value = resp.name
else
User.pending_username = resp.name
if User.active_tab == 'tab-login'
if !resp.exists
User.set_state 'login-confirm-password'
return
else
User.set_state 'login-user-exists'
else if User.active_tab == 'tab-reset'
if !resp.exists
User.set_state 'reset-blank'
else if resp.no_email
User.set_state 'reset-user-has-no-email'
else
User.set_state 'reset-user-exists'
return
return
), ms)
return
form_username_focus: ->
$('login-popup').focused = true
return
form_username_blur: ->
$('login-popup').focused = false
### When the username field loses focus, update the username case to match the
# result we got back from check(), if any.
###
if User.pending_username
$('login-popup').username.value = User.pending_username
User.pending_username = null
### We watch keyup on the username, because change events are unreliable in IE; update
# when focus is lost, too, so we see changes made without using the keyboard.
###
User.form_username_changed false
return
form_submitted: ->
User.cancel_check()
if User.check_name_timer
window.clearTimeout User.check_name_timer
username = $('login-popup-username').value
password = $('login-popup-password').value
password_confirm = $('login-popup-password-confirm').value
email = $('login-popup-email').value
if username == ''
return
if User.active_tab == 'tab-login'
if password == ''
User.message 'Please enter a password.'
return
if window.current_state == 'login-confirm-password'
if password != password_confirm
User.message 'The passwords you\'ve entered don\'t match.'
else
# create account
User.create username, password, null, (resp) ->
if resp.response == 'success'
User.close true
else if resp.response == 'error'
User.message resp.errors.join('<br>')
return
return
User.check username, password, false, (resp) ->
if !resp.exists
User.set_state 'login-confirm-password'
return
if resp.response == 'wrong-password'
notice 'Incorrect password'
return
User.close true
return
else if User.active_tab == 'tab-reset'
if email == ''
return
User.reset_password username, email, (resp) ->
if resp.result == 'success'
User.set_state 'reset-successful'
else if resp.result == 'unknown-user'
User.set_state 'reset-unknown-user'
else if resp.result == 'wrong-email'
User.set_state 'reset-user-email-incorrect'
else if resp.result == 'no-email'
User.set_state 'reset-user-has-no-email'
else if resp.result == 'invalid-email'
User.set_state 'reset-user-email-invalid'
return
return
modify_blacklist: (add, remove, success) ->
jQuery.ajax '/user/modify_blacklist.json',
data:
add: add
remove: remove
dataType: 'json'
method: 'POST'
.done (resp) ->
success?(resp)
.fail (xhr) ->
notice "Error: #{xhr.responseJSON?.reason ? 'unknown error'}"
return
set_pool_browse_mode: (browse_mode) ->
jQuery.ajax '/user/update.json',
data:
user:
pool_browse_mode: browse_mode
dataType: 'json'
method: 'POST'
.done (resp) ->
window.location.reload()
.fail (xhr) ->
notice "Error: #{xhr.responseJSON?.reason ? 'unknown error'}"
return
get_current_user_info: ->
user_info = Cookie.get('user_info')
if !user_info
return null
user_info.split ';'
get_current_user_info_field: (idx, def) ->
user_info = User.get_current_user_info()
if !user_info
return def
if idx >= user_info.length
return def
user_info[idx]
get_current_user_id: ->
parseInt User.get_current_user_info_field(0, 0)
get_current_user_level: ->
parseInt User.get_current_user_info_field(1, 0)
get_use_browser: ->
setting = User.get_current_user_info_field(2, '0')
setting == '1'
is_member_or_higher: ->
User.get_current_user_level() >= 20
is_mod_or_higher: ->
User.get_current_user_level() >= 40
|
[
{
"context": "')\n i = 0\n ++i while target.get_(key = \"untitled#{i}\")?\n key\n )\n bind('name-exists', from('target",
"end": 786,
"score": 0.9473387598991394,
"start": 772,
"tag": "KEY",
"value": "untitled#{i}\")"
}
] | inspect/src/model/panel-view.coffee | issa-tseng/janus | 11 | { DomView, template, find, from, Model, attribute, bind, validate } = require('janus')
{ valid, error } = require('janus').types.validity
{ InspectorView } = require('../common/inspector')
{ reference } = require('../common/types')
{ tryValuate } = require('../common/valuate')
$ = require('../dollar')
{ KeyPair, MappedKeyPair, ModelInspector } = require('./inspector')
{ WrappedFunction } = require('../function/inspector')
{ FlatMappedEntry } = require('../list/derived/flatmapped-list')
{ inspect } = require('../inspect')
{ exists } = require('../util')
# little formview to name new pairs.
Namer = Model.build(
attribute('name', class extends attribute.Text
initial: ->
target = this.model.get_('target')
i = 0
++i while target.get_(key = "untitled#{i}")?
key
)
bind('name-exists', from('target').and('name')
# TODO: i guess map needs a #has ?
.all.flatMap((t, n) -> t.get(n).map(exists) if exists(n)))
validate(from('name').map((n) -> if exists(n) then valid() else error()))
)
class NamerView extends DomView.build($('
<div class="namer">
<div class="namer-input"/>
<div class="namer-warning">This key already exists!</div>
</div>'), template(
find('.namer-input').render(from.attribute('name')).criteria({ context: 'edit', commit: 'form' })
find('.namer-warning').classed('hide', from('name-exists').map((x) -> !x))
))
_wireEvents: -> this.artifact().find('input').focus().select()
KeyPairView = DomView.build($('
<div class="data-pair">
<span class="pair-key"/>
<span class="pair-delimeter"/>
<span class="pair-value"/>
<button class="pair-clear" title="Unset Value"/>
<div class="pair-attribute">
described by <span class="pair-attribute-entity"/>
</div>
</div>'), template(
find('.data-pair')
.classed('bound', from('bound'))
.classed('primitive', from.vm('primitive'))
find('.pair-key')
.text(from('key'))
.attr('title', from('key'))
find('.pair-delimeter')
.text(from('bound').map((b) -> if b is true then ' is bound to ' else ':'))
.attr('title', from('bound').map((b) -> 'This value is bound' if b is true))
find('.pair-value')
.attr('title', from('bound').map((b) -> 'Double-click to edit' unless b is true))
.render(from('binding').and('value').all.map((b, v) -> inspect(b ? v)))
.options(from.self().and('key').all.map((view, k) ->
{ __source: view.closest_(ModelPanelView), __ref: reference.get(k) }))
.on('dblclick', tryValuate)
find('.pair-attribute').classed('hide', from('attribute').map((x) -> !x?))
find('.pair-attribute-entity').render(from('attribute').map(inspect))
.options(from.self().and('key').all.map((view, k) ->
{ __source: view.closest_(ModelPanelView), __ref: reference.attr(k) }))
find('.pair-clear').on('click', (_, subject) ->
subject.get_('target').unset(subject.get_('key')))
))
MappedKeyPairView = DomView.build($('
<div class="data-pair">
<span class="pair-key"/>
<span class="pair-delimeter"/>
<span class="value-parent"/>
<span class="pair-function"/>
<span class="pair-value value-child"/>
</div>'), template(
KeyPairView.template,
find('.value-parent').render(from('parent-value').map(inspect))
.options(from.self().and('key').all.map((__source, k) ->
{ __source, __ref: [ reference.parent(), reference.get(k) ] }))
find('.pair-function').on('mouseenter', (event, pair, view) ->
return unless view.options.app.flyout?
wf = new WrappedFunction(pair.get_('mapper'), [ pair.get_('key'), pair.get_('parent-value') ])
view.options.app.flyout($(event.target), wf, context: 'panel')
)
))
ModelPanelView = InspectorView.build($('
<div class="janus-inspect-panel janus-inspect-model highlights">
<div class="panel-title">
<span class="model-type"/><span class="model-subtype"/>
<button class="janus-inspect-pin" title="Pin"/>
</div>
<div class="panel-derivation">
<span class="model-relationship"/> from <span class="model-parent"/>
</div>
<div class="panel-content">
<div class="model-pairs"/>
<button class="model-add" title="Add"/>
<div class="model-validation">
<label>Model Validations</label>
<div class="model-validations"/>
</div>
</div>
</div>'), template(
find('.model-type').text(from('type'))
find('.model-subtype').text(from('subtype'))
find('.panel-derivation').classed('hide', from('parent').map((x) -> !x?))
find('.model-relationship').text(from.subject().map((i) ->
if i.isTargetDerived is true then 'Mapped' else 'Shadowed'))
find('.model-parent').render(from('parent').map(inspect))
.options(from.self().map((__source) -> { __source, __ref: reference.parent() }))
find('.model-pairs').render(from.subject().map((mi) -> mi.pairsAll()))
find('.model-add').on('click', (event, inspector, view) ->
target = inspector.get_('target')
values = [{ name: 'parent', value: target }]
namer = new Namer({ target })
namer.destroyWith(view)
options = { title: 'Add Pair', values, rider: namer, focus: false }
view.options.app.valuator($(event.target), options, (value) ->
# the namer guarantees that the name exists so we just blindly take it.
target.set(namer.get_('name'), value))
)
find('.model-validation').classed('hide', from('validations').flatMap((vs) -> vs.empty()))
find('.model-validations').render(from('validations').map((vs) ->
vs.enumerate().map((index) -> new FlatMappedEntry(vs, index))))
))
module.exports = {
KeyPairView, ModelPanelView
registerWith: (library) ->
library.register(Namer, NamerView)
library.register(KeyPair, KeyPairView)
library.register(MappedKeyPair, MappedKeyPairView)
library.register(ModelInspector, ModelPanelView, context: 'panel')
}
| 99464 | { DomView, template, find, from, Model, attribute, bind, validate } = require('janus')
{ valid, error } = require('janus').types.validity
{ InspectorView } = require('../common/inspector')
{ reference } = require('../common/types')
{ tryValuate } = require('../common/valuate')
$ = require('../dollar')
{ KeyPair, MappedKeyPair, ModelInspector } = require('./inspector')
{ WrappedFunction } = require('../function/inspector')
{ FlatMappedEntry } = require('../list/derived/flatmapped-list')
{ inspect } = require('../inspect')
{ exists } = require('../util')
# little formview to name new pairs.
Namer = Model.build(
attribute('name', class extends attribute.Text
initial: ->
target = this.model.get_('target')
i = 0
++i while target.get_(key = "<KEY>?
key
)
bind('name-exists', from('target').and('name')
# TODO: i guess map needs a #has ?
.all.flatMap((t, n) -> t.get(n).map(exists) if exists(n)))
validate(from('name').map((n) -> if exists(n) then valid() else error()))
)
class NamerView extends DomView.build($('
<div class="namer">
<div class="namer-input"/>
<div class="namer-warning">This key already exists!</div>
</div>'), template(
find('.namer-input').render(from.attribute('name')).criteria({ context: 'edit', commit: 'form' })
find('.namer-warning').classed('hide', from('name-exists').map((x) -> !x))
))
_wireEvents: -> this.artifact().find('input').focus().select()
KeyPairView = DomView.build($('
<div class="data-pair">
<span class="pair-key"/>
<span class="pair-delimeter"/>
<span class="pair-value"/>
<button class="pair-clear" title="Unset Value"/>
<div class="pair-attribute">
described by <span class="pair-attribute-entity"/>
</div>
</div>'), template(
find('.data-pair')
.classed('bound', from('bound'))
.classed('primitive', from.vm('primitive'))
find('.pair-key')
.text(from('key'))
.attr('title', from('key'))
find('.pair-delimeter')
.text(from('bound').map((b) -> if b is true then ' is bound to ' else ':'))
.attr('title', from('bound').map((b) -> 'This value is bound' if b is true))
find('.pair-value')
.attr('title', from('bound').map((b) -> 'Double-click to edit' unless b is true))
.render(from('binding').and('value').all.map((b, v) -> inspect(b ? v)))
.options(from.self().and('key').all.map((view, k) ->
{ __source: view.closest_(ModelPanelView), __ref: reference.get(k) }))
.on('dblclick', tryValuate)
find('.pair-attribute').classed('hide', from('attribute').map((x) -> !x?))
find('.pair-attribute-entity').render(from('attribute').map(inspect))
.options(from.self().and('key').all.map((view, k) ->
{ __source: view.closest_(ModelPanelView), __ref: reference.attr(k) }))
find('.pair-clear').on('click', (_, subject) ->
subject.get_('target').unset(subject.get_('key')))
))
MappedKeyPairView = DomView.build($('
<div class="data-pair">
<span class="pair-key"/>
<span class="pair-delimeter"/>
<span class="value-parent"/>
<span class="pair-function"/>
<span class="pair-value value-child"/>
</div>'), template(
KeyPairView.template,
find('.value-parent').render(from('parent-value').map(inspect))
.options(from.self().and('key').all.map((__source, k) ->
{ __source, __ref: [ reference.parent(), reference.get(k) ] }))
find('.pair-function').on('mouseenter', (event, pair, view) ->
return unless view.options.app.flyout?
wf = new WrappedFunction(pair.get_('mapper'), [ pair.get_('key'), pair.get_('parent-value') ])
view.options.app.flyout($(event.target), wf, context: 'panel')
)
))
ModelPanelView = InspectorView.build($('
<div class="janus-inspect-panel janus-inspect-model highlights">
<div class="panel-title">
<span class="model-type"/><span class="model-subtype"/>
<button class="janus-inspect-pin" title="Pin"/>
</div>
<div class="panel-derivation">
<span class="model-relationship"/> from <span class="model-parent"/>
</div>
<div class="panel-content">
<div class="model-pairs"/>
<button class="model-add" title="Add"/>
<div class="model-validation">
<label>Model Validations</label>
<div class="model-validations"/>
</div>
</div>
</div>'), template(
find('.model-type').text(from('type'))
find('.model-subtype').text(from('subtype'))
find('.panel-derivation').classed('hide', from('parent').map((x) -> !x?))
find('.model-relationship').text(from.subject().map((i) ->
if i.isTargetDerived is true then 'Mapped' else 'Shadowed'))
find('.model-parent').render(from('parent').map(inspect))
.options(from.self().map((__source) -> { __source, __ref: reference.parent() }))
find('.model-pairs').render(from.subject().map((mi) -> mi.pairsAll()))
find('.model-add').on('click', (event, inspector, view) ->
target = inspector.get_('target')
values = [{ name: 'parent', value: target }]
namer = new Namer({ target })
namer.destroyWith(view)
options = { title: 'Add Pair', values, rider: namer, focus: false }
view.options.app.valuator($(event.target), options, (value) ->
# the namer guarantees that the name exists so we just blindly take it.
target.set(namer.get_('name'), value))
)
find('.model-validation').classed('hide', from('validations').flatMap((vs) -> vs.empty()))
find('.model-validations').render(from('validations').map((vs) ->
vs.enumerate().map((index) -> new FlatMappedEntry(vs, index))))
))
module.exports = {
KeyPairView, ModelPanelView
registerWith: (library) ->
library.register(Namer, NamerView)
library.register(KeyPair, KeyPairView)
library.register(MappedKeyPair, MappedKeyPairView)
library.register(ModelInspector, ModelPanelView, context: 'panel')
}
| true | { DomView, template, find, from, Model, attribute, bind, validate } = require('janus')
{ valid, error } = require('janus').types.validity
{ InspectorView } = require('../common/inspector')
{ reference } = require('../common/types')
{ tryValuate } = require('../common/valuate')
$ = require('../dollar')
{ KeyPair, MappedKeyPair, ModelInspector } = require('./inspector')
{ WrappedFunction } = require('../function/inspector')
{ FlatMappedEntry } = require('../list/derived/flatmapped-list')
{ inspect } = require('../inspect')
{ exists } = require('../util')
# little formview to name new pairs.
Namer = Model.build(
attribute('name', class extends attribute.Text
initial: ->
target = this.model.get_('target')
i = 0
++i while target.get_(key = "PI:KEY:<KEY>END_PI?
key
)
bind('name-exists', from('target').and('name')
# TODO: i guess map needs a #has ?
.all.flatMap((t, n) -> t.get(n).map(exists) if exists(n)))
validate(from('name').map((n) -> if exists(n) then valid() else error()))
)
class NamerView extends DomView.build($('
<div class="namer">
<div class="namer-input"/>
<div class="namer-warning">This key already exists!</div>
</div>'), template(
find('.namer-input').render(from.attribute('name')).criteria({ context: 'edit', commit: 'form' })
find('.namer-warning').classed('hide', from('name-exists').map((x) -> !x))
))
_wireEvents: -> this.artifact().find('input').focus().select()
KeyPairView = DomView.build($('
<div class="data-pair">
<span class="pair-key"/>
<span class="pair-delimeter"/>
<span class="pair-value"/>
<button class="pair-clear" title="Unset Value"/>
<div class="pair-attribute">
described by <span class="pair-attribute-entity"/>
</div>
</div>'), template(
find('.data-pair')
.classed('bound', from('bound'))
.classed('primitive', from.vm('primitive'))
find('.pair-key')
.text(from('key'))
.attr('title', from('key'))
find('.pair-delimeter')
.text(from('bound').map((b) -> if b is true then ' is bound to ' else ':'))
.attr('title', from('bound').map((b) -> 'This value is bound' if b is true))
find('.pair-value')
.attr('title', from('bound').map((b) -> 'Double-click to edit' unless b is true))
.render(from('binding').and('value').all.map((b, v) -> inspect(b ? v)))
.options(from.self().and('key').all.map((view, k) ->
{ __source: view.closest_(ModelPanelView), __ref: reference.get(k) }))
.on('dblclick', tryValuate)
find('.pair-attribute').classed('hide', from('attribute').map((x) -> !x?))
find('.pair-attribute-entity').render(from('attribute').map(inspect))
.options(from.self().and('key').all.map((view, k) ->
{ __source: view.closest_(ModelPanelView), __ref: reference.attr(k) }))
find('.pair-clear').on('click', (_, subject) ->
subject.get_('target').unset(subject.get_('key')))
))
MappedKeyPairView = DomView.build($('
<div class="data-pair">
<span class="pair-key"/>
<span class="pair-delimeter"/>
<span class="value-parent"/>
<span class="pair-function"/>
<span class="pair-value value-child"/>
</div>'), template(
KeyPairView.template,
find('.value-parent').render(from('parent-value').map(inspect))
.options(from.self().and('key').all.map((__source, k) ->
{ __source, __ref: [ reference.parent(), reference.get(k) ] }))
find('.pair-function').on('mouseenter', (event, pair, view) ->
return unless view.options.app.flyout?
wf = new WrappedFunction(pair.get_('mapper'), [ pair.get_('key'), pair.get_('parent-value') ])
view.options.app.flyout($(event.target), wf, context: 'panel')
)
))
ModelPanelView = InspectorView.build($('
<div class="janus-inspect-panel janus-inspect-model highlights">
<div class="panel-title">
<span class="model-type"/><span class="model-subtype"/>
<button class="janus-inspect-pin" title="Pin"/>
</div>
<div class="panel-derivation">
<span class="model-relationship"/> from <span class="model-parent"/>
</div>
<div class="panel-content">
<div class="model-pairs"/>
<button class="model-add" title="Add"/>
<div class="model-validation">
<label>Model Validations</label>
<div class="model-validations"/>
</div>
</div>
</div>'), template(
find('.model-type').text(from('type'))
find('.model-subtype').text(from('subtype'))
find('.panel-derivation').classed('hide', from('parent').map((x) -> !x?))
find('.model-relationship').text(from.subject().map((i) ->
if i.isTargetDerived is true then 'Mapped' else 'Shadowed'))
find('.model-parent').render(from('parent').map(inspect))
.options(from.self().map((__source) -> { __source, __ref: reference.parent() }))
find('.model-pairs').render(from.subject().map((mi) -> mi.pairsAll()))
find('.model-add').on('click', (event, inspector, view) ->
target = inspector.get_('target')
values = [{ name: 'parent', value: target }]
namer = new Namer({ target })
namer.destroyWith(view)
options = { title: 'Add Pair', values, rider: namer, focus: false }
view.options.app.valuator($(event.target), options, (value) ->
# the namer guarantees that the name exists so we just blindly take it.
target.set(namer.get_('name'), value))
)
find('.model-validation').classed('hide', from('validations').flatMap((vs) -> vs.empty()))
find('.model-validations').render(from('validations').map((vs) ->
vs.enumerate().map((index) -> new FlatMappedEntry(vs, index))))
))
module.exports = {
KeyPairView, ModelPanelView
registerWith: (library) ->
library.register(Namer, NamerView)
library.register(KeyPair, KeyPairView)
library.register(MappedKeyPair, MappedKeyPairView)
library.register(ModelInspector, ModelPanelView, context: 'panel')
}
|
[
{
"context": "lation's collection of nests.\n\nhttps://github.com/NicMcPhee/whooping-crane-model\n\nCopyright (c) 2015 Nic McPh",
"end": 85,
"score": 0.9993564486503601,
"start": 76,
"tag": "USERNAME",
"value": "NicMcPhee"
},
{
"context": "NicMcPhee/whooping-crane-model\n\nCopyright ... | src/lib/nesting.coffee | NicMcPhee/whooping-crane-model | 0 | ###
Basic model of a population's collection of nests.
https://github.com/NicMcPhee/whooping-crane-model
Copyright (c) 2015 Nic McPhee
Licensed under the MIT license.
###
'use strict'
ModelParameters = require './model_parameters'
Bird = require './bird'
Nest = require './nest'
# Move shuffle, chunk to a util file
# From https://gist.github.com/ddgromit/859699
shuffle = (a) ->
i = a.length
while --i > 0
j = ~~(Math.random() * (i + 1))
t = a[j]
a[j] = a[i]
a[i] = t
a
class Nesting
constructor: (matingPairs) ->
nestingPairs = matingPairs.filter(
(pr) -> Math.random() < ModelParameters.nestingProbability)
@_activeNests = (new Nest(p) for p in nestingPairs)
@_collectedNests = []
@_releasedNests = []
@_abandonedNests = []
activeNests: () -> @_activeNests
collectedNests: () -> @_collectedNests
releasedNests: () -> @_releasedNests
abandonedNests: () -> @_abandonedNests
collectEggs: () ->
earlyNests = @_activeNests.filter((n) -> n.nestingTime() is Bird.EARLY)
shuffle(earlyNests)
numToCollect = Math.floor(
earlyNests.length * ModelParameters.collectionProbability)
@_collectedNests = earlyNests[0...numToCollect]
@_activeNests = @_activeNests.filter((n) => n not in @_collectedNests)
# This is sort of a hack that makes two copies of every
# collected nest, which models the idea of there being
# two eggs to collect in every collected nest. It would
# probably make more sense to make this a parameter, or
# to explicitly model the eggs (which I didn't do).
@_collectedNests = @_collectedNests.concat(@_collectedNests)
shuffle(@_collectedNests)
# Only some collected eggs will be released back into the wild.
@_releasedNests = @_collectedNests[0...ModelParameters.releaseCount]
abandonNests: () ->
@_abandonedNests = @_activeNests.filter(
(n) -> n.nestingTime() is Bird.EARLY)
@_activeNests = @_activeNests.filter(
(n) -> n.nestingTime() is Bird.LATE)
renest: () ->
canRenest = @_abandonedNests.concat(@_collectedNests)
secondNests = canRenest.filter((n) ->
Math.random() < ModelParameters.renestingProbability)
@_activeNests = @_activeNests.concat(secondNests)
hatchNests: (birdType, nests) ->
Bird.fromNest(nest, birdType) for nest in nests
hatchEggs: () ->
hatchedWildNests = @_activeNests.filter(
(n) -> Math.random() < ModelParameters.eggConversionRate)
newWildBirds = @hatchNests(Bird.WILD_REARED, hatchedWildNests)
newCaptiveBirds = @hatchNests(Bird.CAPTIVE_REARED, @._releasedNests)
newWildBirds.concat(newCaptiveBirds)
reproductionCycle: () ->
@collectEggs()
@abandonNests()
@renest()
@hatchEggs()
module.exports = Nesting
| 208990 | ###
Basic model of a population's collection of nests.
https://github.com/NicMcPhee/whooping-crane-model
Copyright (c) 2015 <NAME>
Licensed under the MIT license.
###
'use strict'
ModelParameters = require './model_parameters'
Bird = require './bird'
Nest = require './nest'
# Move shuffle, chunk to a util file
# From https://gist.github.com/ddgromit/859699
shuffle = (a) ->
i = a.length
while --i > 0
j = ~~(Math.random() * (i + 1))
t = a[j]
a[j] = a[i]
a[i] = t
a
class Nesting
constructor: (matingPairs) ->
nestingPairs = matingPairs.filter(
(pr) -> Math.random() < ModelParameters.nestingProbability)
@_activeNests = (new Nest(p) for p in nestingPairs)
@_collectedNests = []
@_releasedNests = []
@_abandonedNests = []
activeNests: () -> @_activeNests
collectedNests: () -> @_collectedNests
releasedNests: () -> @_releasedNests
abandonedNests: () -> @_abandonedNests
collectEggs: () ->
earlyNests = @_activeNests.filter((n) -> n.nestingTime() is Bird.EARLY)
shuffle(earlyNests)
numToCollect = Math.floor(
earlyNests.length * ModelParameters.collectionProbability)
@_collectedNests = earlyNests[0...numToCollect]
@_activeNests = @_activeNests.filter((n) => n not in @_collectedNests)
# This is sort of a hack that makes two copies of every
# collected nest, which models the idea of there being
# two eggs to collect in every collected nest. It would
# probably make more sense to make this a parameter, or
# to explicitly model the eggs (which I didn't do).
@_collectedNests = @_collectedNests.concat(@_collectedNests)
shuffle(@_collectedNests)
# Only some collected eggs will be released back into the wild.
@_releasedNests = @_collectedNests[0...ModelParameters.releaseCount]
abandonNests: () ->
@_abandonedNests = @_activeNests.filter(
(n) -> n.nestingTime() is Bird.EARLY)
@_activeNests = @_activeNests.filter(
(n) -> n.nestingTime() is Bird.LATE)
renest: () ->
canRenest = @_abandonedNests.concat(@_collectedNests)
secondNests = canRenest.filter((n) ->
Math.random() < ModelParameters.renestingProbability)
@_activeNests = @_activeNests.concat(secondNests)
hatchNests: (birdType, nests) ->
Bird.fromNest(nest, birdType) for nest in nests
hatchEggs: () ->
hatchedWildNests = @_activeNests.filter(
(n) -> Math.random() < ModelParameters.eggConversionRate)
newWildBirds = @hatchNests(Bird.WILD_REARED, hatchedWildNests)
newCaptiveBirds = @hatchNests(Bird.CAPTIVE_REARED, @._releasedNests)
newWildBirds.concat(newCaptiveBirds)
reproductionCycle: () ->
@collectEggs()
@abandonNests()
@renest()
@hatchEggs()
module.exports = Nesting
| true | ###
Basic model of a population's collection of nests.
https://github.com/NicMcPhee/whooping-crane-model
Copyright (c) 2015 PI:NAME:<NAME>END_PI
Licensed under the MIT license.
###
'use strict'
ModelParameters = require './model_parameters'
Bird = require './bird'
Nest = require './nest'
# Move shuffle, chunk to a util file
# From https://gist.github.com/ddgromit/859699
shuffle = (a) ->
i = a.length
while --i > 0
j = ~~(Math.random() * (i + 1))
t = a[j]
a[j] = a[i]
a[i] = t
a
class Nesting
constructor: (matingPairs) ->
nestingPairs = matingPairs.filter(
(pr) -> Math.random() < ModelParameters.nestingProbability)
@_activeNests = (new Nest(p) for p in nestingPairs)
@_collectedNests = []
@_releasedNests = []
@_abandonedNests = []
activeNests: () -> @_activeNests
collectedNests: () -> @_collectedNests
releasedNests: () -> @_releasedNests
abandonedNests: () -> @_abandonedNests
collectEggs: () ->
earlyNests = @_activeNests.filter((n) -> n.nestingTime() is Bird.EARLY)
shuffle(earlyNests)
numToCollect = Math.floor(
earlyNests.length * ModelParameters.collectionProbability)
@_collectedNests = earlyNests[0...numToCollect]
@_activeNests = @_activeNests.filter((n) => n not in @_collectedNests)
# This is sort of a hack that makes two copies of every
# collected nest, which models the idea of there being
# two eggs to collect in every collected nest. It would
# probably make more sense to make this a parameter, or
# to explicitly model the eggs (which I didn't do).
@_collectedNests = @_collectedNests.concat(@_collectedNests)
shuffle(@_collectedNests)
# Only some collected eggs will be released back into the wild.
@_releasedNests = @_collectedNests[0...ModelParameters.releaseCount]
abandonNests: () ->
@_abandonedNests = @_activeNests.filter(
(n) -> n.nestingTime() is Bird.EARLY)
@_activeNests = @_activeNests.filter(
(n) -> n.nestingTime() is Bird.LATE)
renest: () ->
canRenest = @_abandonedNests.concat(@_collectedNests)
secondNests = canRenest.filter((n) ->
Math.random() < ModelParameters.renestingProbability)
@_activeNests = @_activeNests.concat(secondNests)
hatchNests: (birdType, nests) ->
Bird.fromNest(nest, birdType) for nest in nests
hatchEggs: () ->
hatchedWildNests = @_activeNests.filter(
(n) -> Math.random() < ModelParameters.eggConversionRate)
newWildBirds = @hatchNests(Bird.WILD_REARED, hatchedWildNests)
newCaptiveBirds = @hatchNests(Bird.CAPTIVE_REARED, @._releasedNests)
newWildBirds.concat(newCaptiveBirds)
reproductionCycle: () ->
@collectEggs()
@abandonNests()
@renest()
@hatchEggs()
module.exports = Nesting
|
[
{
"context": "legs': '足'\n 'cash': {\n 'unit':'G'\n 'name':'ゴールド'\n }\n}\n\nc.EQUIP_POSITONS = [\n 'left_hand'\n 'rig",
"end": 1881,
"score": 0.706115186214447,
"start": 1877,
"tag": "NAME",
"value": "ゴールド"
}
] | src/main/common/constants.coffee | fukuyama/tmlib-rpg | 0 | # node.js と ブラウザでの this.rpg を同じインスタンスにする
_g = window ? global ? @
rpg = _g.rpg = _g.rpg ? {}
rpg.constants = rpg.constants ? {}
c = rpg.constants
# 移動制限定数、移動できる方向が true
# 方向は [2,4,6,8] の位置パラメータ
# VXAce にならって乗り物も入れるか…?
c.MOVE_RESTRICTION = {
ALLOK: [true ,true ,true ,true ]
UPOK: [false,false,false,true ]
DOWNOK: [true ,false,false,false]
LEFTOK: [false,true ,false,false]
RIGHTOK: [false,false,true ,false]
ALLNG: [false,false,false,false]
HORIZON: [false,true ,true ,false]
VERTICAL: [true ,false,false,true ]
CORNER1: [false,false,true ,true ]
CORNER3: [false,true ,false,true ]
CORNER7: [true ,false,true ,false]
CORNER9: [true ,true ,false,false]
UPNG: [true ,true ,true ,false]
DOWNNG: [false,true ,true ,true ]
LEFTNG: [true ,false,true ,true ]
RIGHTNG: [true ,true ,false,true ]
}
c.USABLE = {
NONE: 0
ALL: 1
MAP: 2
BATTLE: 3
}
# [味方、敵][単体、複数]
c.SCOPE = {
TYPE:
ALL: 0
FRIEND: 1
ENEMY: 2
RANGE:
ONE: 1
MULTI: 2
}
# メッセージウィンドウの位置
c.MESSAGE_OPTION = {
MESSAGE:
TOP: 1
CENTER: 2
BOTTOM: 3
SELECT:
LEFT: 1
CENTER: 2
RIGHT: 3
NUMBER:
LEFT: 1
CENTER: 2
RIGHT: 3
}
c.BASE_ABILITIES = [
'str'
'vit'
'dex'
'agi'
'int'
'sen'
'luc'
'cha'
'basehp'
'basemp'
]
c.BATTLE_ABILITIES = [
'patk'
'pdef'
'matk'
'mcur'
'mdef'
'maxhp'
'maxmp'
]
c.WORDS = {
'str': 'ちから'
'vit': 'たいりょく'
'dex': 'きようさ'
'agi': 'すばやさ'
'int': 'かしこさ'
'sen': 'かんせい'
'luc': 'うんのよさ'
'cha': 'みりょく'
'hp': 'HP'
'mp': 'MP'
'patk': 'こうげき力'
'pdef': 'ぼうぎょ力'
'matk': 'こうげき魔力'
'mcur': 'かいふく魔力'
'mdef': '魔法ぼうぎょ'
'maxhp': '最大HP'
'maxmp': '最大MP'
'right_hand': '右手'
'left_hand': '左手'
'head': '頭'
'upper_body': '体上'
'lower_body': '体下'
'arms': '腕'
'legs': '足'
'cash': {
'unit':'G'
'name':'ゴールド'
}
}
c.EQUIP_POSITONS = [
'left_hand'
'right_hand'
'head'
'upper_body'
'lower_body'
'arms'
'legs'
]
| 85682 | # node.js と ブラウザでの this.rpg を同じインスタンスにする
_g = window ? global ? @
rpg = _g.rpg = _g.rpg ? {}
rpg.constants = rpg.constants ? {}
c = rpg.constants
# 移動制限定数、移動できる方向が true
# 方向は [2,4,6,8] の位置パラメータ
# VXAce にならって乗り物も入れるか…?
c.MOVE_RESTRICTION = {
ALLOK: [true ,true ,true ,true ]
UPOK: [false,false,false,true ]
DOWNOK: [true ,false,false,false]
LEFTOK: [false,true ,false,false]
RIGHTOK: [false,false,true ,false]
ALLNG: [false,false,false,false]
HORIZON: [false,true ,true ,false]
VERTICAL: [true ,false,false,true ]
CORNER1: [false,false,true ,true ]
CORNER3: [false,true ,false,true ]
CORNER7: [true ,false,true ,false]
CORNER9: [true ,true ,false,false]
UPNG: [true ,true ,true ,false]
DOWNNG: [false,true ,true ,true ]
LEFTNG: [true ,false,true ,true ]
RIGHTNG: [true ,true ,false,true ]
}
c.USABLE = {
NONE: 0
ALL: 1
MAP: 2
BATTLE: 3
}
# [味方、敵][単体、複数]
c.SCOPE = {
TYPE:
ALL: 0
FRIEND: 1
ENEMY: 2
RANGE:
ONE: 1
MULTI: 2
}
# メッセージウィンドウの位置
c.MESSAGE_OPTION = {
MESSAGE:
TOP: 1
CENTER: 2
BOTTOM: 3
SELECT:
LEFT: 1
CENTER: 2
RIGHT: 3
NUMBER:
LEFT: 1
CENTER: 2
RIGHT: 3
}
c.BASE_ABILITIES = [
'str'
'vit'
'dex'
'agi'
'int'
'sen'
'luc'
'cha'
'basehp'
'basemp'
]
c.BATTLE_ABILITIES = [
'patk'
'pdef'
'matk'
'mcur'
'mdef'
'maxhp'
'maxmp'
]
c.WORDS = {
'str': 'ちから'
'vit': 'たいりょく'
'dex': 'きようさ'
'agi': 'すばやさ'
'int': 'かしこさ'
'sen': 'かんせい'
'luc': 'うんのよさ'
'cha': 'みりょく'
'hp': 'HP'
'mp': 'MP'
'patk': 'こうげき力'
'pdef': 'ぼうぎょ力'
'matk': 'こうげき魔力'
'mcur': 'かいふく魔力'
'mdef': '魔法ぼうぎょ'
'maxhp': '最大HP'
'maxmp': '最大MP'
'right_hand': '右手'
'left_hand': '左手'
'head': '頭'
'upper_body': '体上'
'lower_body': '体下'
'arms': '腕'
'legs': '足'
'cash': {
'unit':'G'
'name':'<NAME>'
}
}
c.EQUIP_POSITONS = [
'left_hand'
'right_hand'
'head'
'upper_body'
'lower_body'
'arms'
'legs'
]
| true | # node.js と ブラウザでの this.rpg を同じインスタンスにする
_g = window ? global ? @
rpg = _g.rpg = _g.rpg ? {}
rpg.constants = rpg.constants ? {}
c = rpg.constants
# 移動制限定数、移動できる方向が true
# 方向は [2,4,6,8] の位置パラメータ
# VXAce にならって乗り物も入れるか…?
c.MOVE_RESTRICTION = {
ALLOK: [true ,true ,true ,true ]
UPOK: [false,false,false,true ]
DOWNOK: [true ,false,false,false]
LEFTOK: [false,true ,false,false]
RIGHTOK: [false,false,true ,false]
ALLNG: [false,false,false,false]
HORIZON: [false,true ,true ,false]
VERTICAL: [true ,false,false,true ]
CORNER1: [false,false,true ,true ]
CORNER3: [false,true ,false,true ]
CORNER7: [true ,false,true ,false]
CORNER9: [true ,true ,false,false]
UPNG: [true ,true ,true ,false]
DOWNNG: [false,true ,true ,true ]
LEFTNG: [true ,false,true ,true ]
RIGHTNG: [true ,true ,false,true ]
}
c.USABLE = {
NONE: 0
ALL: 1
MAP: 2
BATTLE: 3
}
# [味方、敵][単体、複数]
c.SCOPE = {
TYPE:
ALL: 0
FRIEND: 1
ENEMY: 2
RANGE:
ONE: 1
MULTI: 2
}
# メッセージウィンドウの位置
c.MESSAGE_OPTION = {
MESSAGE:
TOP: 1
CENTER: 2
BOTTOM: 3
SELECT:
LEFT: 1
CENTER: 2
RIGHT: 3
NUMBER:
LEFT: 1
CENTER: 2
RIGHT: 3
}
c.BASE_ABILITIES = [
'str'
'vit'
'dex'
'agi'
'int'
'sen'
'luc'
'cha'
'basehp'
'basemp'
]
c.BATTLE_ABILITIES = [
'patk'
'pdef'
'matk'
'mcur'
'mdef'
'maxhp'
'maxmp'
]
c.WORDS = {
'str': 'ちから'
'vit': 'たいりょく'
'dex': 'きようさ'
'agi': 'すばやさ'
'int': 'かしこさ'
'sen': 'かんせい'
'luc': 'うんのよさ'
'cha': 'みりょく'
'hp': 'HP'
'mp': 'MP'
'patk': 'こうげき力'
'pdef': 'ぼうぎょ力'
'matk': 'こうげき魔力'
'mcur': 'かいふく魔力'
'mdef': '魔法ぼうぎょ'
'maxhp': '最大HP'
'maxmp': '最大MP'
'right_hand': '右手'
'left_hand': '左手'
'head': '頭'
'upper_body': '体上'
'lower_body': '体下'
'arms': '腕'
'legs': '足'
'cash': {
'unit':'G'
'name':'PI:NAME:<NAME>END_PI'
}
}
c.EQUIP_POSITONS = [
'left_hand'
'right_hand'
'head'
'upper_body'
'lower_body'
'arms'
'legs'
]
|
[
{
"context": "js\n\n PXL.js\n Benjamin Blundell - ben@pxljs.com\n http://pxljs.",
"end": 197,
"score": 0.9998799562454224,
"start": 180,
"tag": "NAME",
"value": "Benjamin Blundell"
},
{
"context": " PXL.js\n ... | src/util/webcam.coffee | OniDaito/pxljs | 1 | ### ABOUT
.__
_________ __| |
\____ \ \/ / |
| |_> > <| |__
| __/__/\_ \____/
|__| \/ js
PXL.js
Benjamin Blundell - ben@pxljs.com
http://pxljs.com
This software is released under the MIT Licence. See LICENCE.txt for details
Webcam Access
###
{PXLWarning, PXLError} = require './log'
class WebCamRTC
# Check we have the basic javascript in place
hasGetUserMedia : () ->
navigator.getUserMedia? or navigator.webkitGetUserMedia? or navigator.mozGetUserMedia? or navigator.msGetUserMedia?
# Error callback function
errorCallback : (user_callback) =>
PXLWarning "Cannot create WebRTC video!"
user_callback() if user_callback?
@
# constructor - Creates a webcamrtc instance with the following parameters
#
# dom_object_id (REQUIRED) : the dom id of the video object
# width (OPTIONAL) : the minimum width of the camera
# height (OPTIONAL) : the minimum height of the camera
# grab_audio (OPTIONAL) : boolan - do we want the mic as well?
constructor : (dom_object_id, width, height, grab_audio, on_error) ->
video_params= {}
video_params["video"] = true
if width? or height?
video_params["mandatory"] = {}
video_params["mandatory"]["width"] = width if width?
video_params["mandatory"]["height"] = height if height?
if not @hasGetUserMedia
PXLWarning "No support in this browser for WebRTC."
on_error() if on_error?
return
navigator.getUserMedia = navigator.getUserMedia or navigator.webkitGetUserMedia or navigator.mozGetUserMedia or navigator.msGetUserMedia
if not grab_audio?
grab_audio = false
video_params["audio"] = grab_audio
@dom_object = document.getElementById dom_object_id
error_handler = @errorCallback
error_handler = on_error if on_error?
navigator.getUserMedia(video_params, (stream) =>
@dom_object.src = window.URL.createObjectURL(stream)
,error_handler )
@
'''
MediaStreamTrack.getSources(function(sourceInfos) {
var audioSource = null;
var videoSource = null;
for (var i = 0; i != sourceInfos.length; ++i) {
var sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'audio') {
console.log(sourceInfo.id, sourceInfo.label || 'microphone');
audioSource = sourceInfo.id;
} else if (sourceInfo.kind === 'video') {
console.log(sourceInfo.id, sourceInfo.label || 'camera');
videoSource = sourceInfo.id;
} else {
console.log('Some other kind of source: ', sourceInfo);
}
}
sourceSelected(audioSource, videoSource);
});
function sourceSelected(audioSource, videoSource) {
var constraints = {
audio: {
optional: [{sourceId: audioSource}]
},
video: {
optional: [{sourceId: videoSource}]
}
};
navigator.getUserMedia(constraints, successCallback, errorCallback);
}
'''
module.exports =
WebCamRTC : WebCamRTC
| 215332 | ### ABOUT
.__
_________ __| |
\____ \ \/ / |
| |_> > <| |__
| __/__/\_ \____/
|__| \/ js
PXL.js
<NAME> - <EMAIL>
http://pxljs.com
This software is released under the MIT Licence. See LICENCE.txt for details
Webcam Access
###
{PXLWarning, PXLError} = require './log'
class WebCamRTC
# Check we have the basic javascript in place
hasGetUserMedia : () ->
navigator.getUserMedia? or navigator.webkitGetUserMedia? or navigator.mozGetUserMedia? or navigator.msGetUserMedia?
# Error callback function
errorCallback : (user_callback) =>
PXLWarning "Cannot create WebRTC video!"
user_callback() if user_callback?
@
# constructor - Creates a webcamrtc instance with the following parameters
#
# dom_object_id (REQUIRED) : the dom id of the video object
# width (OPTIONAL) : the minimum width of the camera
# height (OPTIONAL) : the minimum height of the camera
# grab_audio (OPTIONAL) : boolan - do we want the mic as well?
constructor : (dom_object_id, width, height, grab_audio, on_error) ->
video_params= {}
video_params["video"] = true
if width? or height?
video_params["mandatory"] = {}
video_params["mandatory"]["width"] = width if width?
video_params["mandatory"]["height"] = height if height?
if not @hasGetUserMedia
PXLWarning "No support in this browser for WebRTC."
on_error() if on_error?
return
navigator.getUserMedia = navigator.getUserMedia or navigator.webkitGetUserMedia or navigator.mozGetUserMedia or navigator.msGetUserMedia
if not grab_audio?
grab_audio = false
video_params["audio"] = grab_audio
@dom_object = document.getElementById dom_object_id
error_handler = @errorCallback
error_handler = on_error if on_error?
navigator.getUserMedia(video_params, (stream) =>
@dom_object.src = window.URL.createObjectURL(stream)
,error_handler )
@
'''
MediaStreamTrack.getSources(function(sourceInfos) {
var audioSource = null;
var videoSource = null;
for (var i = 0; i != sourceInfos.length; ++i) {
var sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'audio') {
console.log(sourceInfo.id, sourceInfo.label || 'microphone');
audioSource = sourceInfo.id;
} else if (sourceInfo.kind === 'video') {
console.log(sourceInfo.id, sourceInfo.label || 'camera');
videoSource = sourceInfo.id;
} else {
console.log('Some other kind of source: ', sourceInfo);
}
}
sourceSelected(audioSource, videoSource);
});
function sourceSelected(audioSource, videoSource) {
var constraints = {
audio: {
optional: [{sourceId: audioSource}]
},
video: {
optional: [{sourceId: videoSource}]
}
};
navigator.getUserMedia(constraints, successCallback, errorCallback);
}
'''
module.exports =
WebCamRTC : WebCamRTC
| true | ### ABOUT
.__
_________ __| |
\____ \ \/ / |
| |_> > <| |__
| __/__/\_ \____/
|__| \/ js
PXL.js
PI:NAME:<NAME>END_PI - PI:EMAIL:<EMAIL>END_PI
http://pxljs.com
This software is released under the MIT Licence. See LICENCE.txt for details
Webcam Access
###
{PXLWarning, PXLError} = require './log'
class WebCamRTC
# Check we have the basic javascript in place
hasGetUserMedia : () ->
navigator.getUserMedia? or navigator.webkitGetUserMedia? or navigator.mozGetUserMedia? or navigator.msGetUserMedia?
# Error callback function
errorCallback : (user_callback) =>
PXLWarning "Cannot create WebRTC video!"
user_callback() if user_callback?
@
# constructor - Creates a webcamrtc instance with the following parameters
#
# dom_object_id (REQUIRED) : the dom id of the video object
# width (OPTIONAL) : the minimum width of the camera
# height (OPTIONAL) : the minimum height of the camera
# grab_audio (OPTIONAL) : boolan - do we want the mic as well?
constructor : (dom_object_id, width, height, grab_audio, on_error) ->
video_params= {}
video_params["video"] = true
if width? or height?
video_params["mandatory"] = {}
video_params["mandatory"]["width"] = width if width?
video_params["mandatory"]["height"] = height if height?
if not @hasGetUserMedia
PXLWarning "No support in this browser for WebRTC."
on_error() if on_error?
return
navigator.getUserMedia = navigator.getUserMedia or navigator.webkitGetUserMedia or navigator.mozGetUserMedia or navigator.msGetUserMedia
if not grab_audio?
grab_audio = false
video_params["audio"] = grab_audio
@dom_object = document.getElementById dom_object_id
error_handler = @errorCallback
error_handler = on_error if on_error?
navigator.getUserMedia(video_params, (stream) =>
@dom_object.src = window.URL.createObjectURL(stream)
,error_handler )
@
'''
MediaStreamTrack.getSources(function(sourceInfos) {
var audioSource = null;
var videoSource = null;
for (var i = 0; i != sourceInfos.length; ++i) {
var sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'audio') {
console.log(sourceInfo.id, sourceInfo.label || 'microphone');
audioSource = sourceInfo.id;
} else if (sourceInfo.kind === 'video') {
console.log(sourceInfo.id, sourceInfo.label || 'camera');
videoSource = sourceInfo.id;
} else {
console.log('Some other kind of source: ', sourceInfo);
}
}
sourceSelected(audioSource, videoSource);
});
function sourceSelected(audioSource, videoSource) {
var constraints = {
audio: {
optional: [{sourceId: audioSource}]
},
video: {
optional: [{sourceId: videoSource}]
}
};
navigator.getUserMedia(constraints, successCallback, errorCallback);
}
'''
module.exports =
WebCamRTC : WebCamRTC
|
[
{
"context": "ocess.argv\n\n#TODO: MD5 Verification, using http://54.91.159.37/dump.md5 using digest stream https://github.com/j",
"end": 827,
"score": 0.9937232136726379,
"start": 815,
"tag": "IP_ADDRESS",
"value": "54.91.159.37"
},
{
"context": "7/dump.md5 using digest stream https... | scripts/runAfterGit.coffee | JurianLock/codecombat | 2 | # This is written in coffeescript. Run this using coffee, not node. (Line to yield nice warnings on node. :))
return console.log '------------------------------------------------- \n
Commandline utility written in Coffeescript to run all updates, download latest database and install it after you git pushed. \n
Params: \n
\t--skipupdates skips npm and bower update \n
\t--dldb: download the latest database (Over 300 mb!) \n
\t--resetdb: to reset the database and load dump from tmp. Will need a downloaded database or --dbdownload specified \n
\t--mongopath <.path/to/mongo>: to specify mongodb folder if not set in PATH. \n
\t--help: Yo fund this one already. \n
\n
May need an initial npm install upfront if newly checked out. \n
' if '--help' in process.argv
#TODO: MD5 Verification, using http://54.91.159.37/dump.md5 using digest stream https://github.com/jeffbski/digest-stream
dbDump = 'http://analytics.codecombat.com:8080/dump.tar.gz' # Don't change this unless you know what you're doing
dbLocalPath = '../temp'
fs = require 'fs'
tar = require 'tar'
spawn = require('child_process').spawn
http = require 'http'
fs = require 'fs'
zlib = require 'zlib'
Deferred = require 'JQDeferred'
#TODO: Could kill current coco server here.
mongopath = ''
useNext = false
for path in process.argv
if useNext
mongopath = path
break
useNext = path is '--mongopath'
mongopath += '/bin/' if mongopath.length
mongopath += 'mongodb' # mongodb is in path.
run = (proc, args) ->
deferred = Deferred()
spawned = spawn proc, args
spawned.stdout.on 'data', (data) -> process.stdout.write data
spawned.stderr.on 'data', (data) -> process.stderr.write data
spawned.on 'exit', (code) ->
console.log proc + ' exited with code ' + code
# unless code is null doesn't seem to work
# deferred.reject()
deferred.resolve code
spawned.on 'error', (code, error) ->
console.error proc + ' failed!'
deferred.reject()
deferred.promise()
removeDir = (path) ->
if fs.existsSync(path)
fs.readdirSync(path).forEach (file) ->
current = path + '/' + file
if fs.lstatSync(current).isDirectory() # recurse
removeDir current
else # delete file
fs.unlinkSync current
fs.rmdirSync path
resetDB = ->
deferred = Deferred()
console.log 'Dropping Database'
mongodrop = run 'mongo', ['coco', '--eval', 'db.dropDatabase()']
mongodrop.fail -> console.error 'Error occurred while dropping mongo. Make sure CoCo\'s MongoDB is running.'
mongodrop.done ->
console.log 'Restoring from dump.'
mongorestore = run 'mongorestore', [dbLocalPath]
mongorestore.always = deferred.resolve()
deferred.promise()
downloadDB = ->
deferred = Deferred()
#mongoose = require 'mongoose'
# TODO: What if mongo is not running?
console.log 'Downloading Database dump. It\'s big. This may take a while...'
request = http.get dbDump, (response)->
unzip = response.pipe(zlib.createGunzip()).pipe(tar.Extract(path: dbLocalPath))
# Log download
currentChunk = 0
cur = 0
len = parseInt(response.headers['content-length'], 10)
total = len / 1048576 #1048576 - bytes in 1Megabyte
response.on 'data', (chunk) ->
cur += chunk.length
console.log 'DB dump download received chunk ' + currentChunk++ + ', ' + (100.0 * cur / len).toFixed(2) + '% finished of ' + total.toFixed(0) + ' mb'
unzip.on('data', -> console.log 'Unpacking zip...')
unzip.on('error', (err) -> console.log 'An error occurred while downloading DB Dump: ' + err)
unzip.on 'end', ->
console.log 'Finished downloading.'
deferred.resolve()
deferred.promise()
installUpdates = ->
deferred = Deferred()
npm = if process.platform is 'win32' then 'npm.cmd' else 'npm'
npminstall = run npm, ['update']
npminstall.done ->
bowerinstall = run 'bower', ['update']
deferred.resolve()
deferred.promise()
cleanUpTmp = ->
removeDir dbLocalPath
unless '--skipupdates' in process.argv
installUpdates()
if '--resetdb' in process.argv
if '--dldb' in process.argv
downloadDB().done ->
resetDB().done ->
cleanUpTmp() if '--cleanup' in process.argv
else
resetDB().done ->
cleanUpTmp() if '--cleanup' in process.argv
else if '--dldb' in process.argv
downloadDB()
# TODO: Could advice to start SCOCODE.bat et al. here
| 60295 | # This is written in coffeescript. Run this using coffee, not node. (Line to yield nice warnings on node. :))
return console.log '------------------------------------------------- \n
Commandline utility written in Coffeescript to run all updates, download latest database and install it after you git pushed. \n
Params: \n
\t--skipupdates skips npm and bower update \n
\t--dldb: download the latest database (Over 300 mb!) \n
\t--resetdb: to reset the database and load dump from tmp. Will need a downloaded database or --dbdownload specified \n
\t--mongopath <.path/to/mongo>: to specify mongodb folder if not set in PATH. \n
\t--help: Yo fund this one already. \n
\n
May need an initial npm install upfront if newly checked out. \n
' if '--help' in process.argv
#TODO: MD5 Verification, using http://192.168.3.11/dump.md5 using digest stream https://github.com/jeffbski/digest-stream
dbDump = 'http://analytics.codecombat.com:8080/dump.tar.gz' # Don't change this unless you know what you're doing
dbLocalPath = '../temp'
fs = require 'fs'
tar = require 'tar'
spawn = require('child_process').spawn
http = require 'http'
fs = require 'fs'
zlib = require 'zlib'
Deferred = require 'JQDeferred'
#TODO: Could kill current coco server here.
mongopath = ''
useNext = false
for path in process.argv
if useNext
mongopath = path
break
useNext = path is '--mongopath'
mongopath += '/bin/' if mongopath.length
mongopath += 'mongodb' # mongodb is in path.
run = (proc, args) ->
deferred = Deferred()
spawned = spawn proc, args
spawned.stdout.on 'data', (data) -> process.stdout.write data
spawned.stderr.on 'data', (data) -> process.stderr.write data
spawned.on 'exit', (code) ->
console.log proc + ' exited with code ' + code
# unless code is null doesn't seem to work
# deferred.reject()
deferred.resolve code
spawned.on 'error', (code, error) ->
console.error proc + ' failed!'
deferred.reject()
deferred.promise()
removeDir = (path) ->
if fs.existsSync(path)
fs.readdirSync(path).forEach (file) ->
current = path + '/' + file
if fs.lstatSync(current).isDirectory() # recurse
removeDir current
else # delete file
fs.unlinkSync current
fs.rmdirSync path
resetDB = ->
deferred = Deferred()
console.log 'Dropping Database'
mongodrop = run 'mongo', ['coco', '--eval', 'db.dropDatabase()']
mongodrop.fail -> console.error 'Error occurred while dropping mongo. Make sure CoCo\'s MongoDB is running.'
mongodrop.done ->
console.log 'Restoring from dump.'
mongorestore = run 'mongorestore', [dbLocalPath]
mongorestore.always = deferred.resolve()
deferred.promise()
downloadDB = ->
deferred = Deferred()
#mongoose = require 'mongoose'
# TODO: What if mongo is not running?
console.log 'Downloading Database dump. It\'s big. This may take a while...'
request = http.get dbDump, (response)->
unzip = response.pipe(zlib.createGunzip()).pipe(tar.Extract(path: dbLocalPath))
# Log download
currentChunk = 0
cur = 0
len = parseInt(response.headers['content-length'], 10)
total = len / 1048576 #1048576 - bytes in 1Megabyte
response.on 'data', (chunk) ->
cur += chunk.length
console.log 'DB dump download received chunk ' + currentChunk++ + ', ' + (100.0 * cur / len).toFixed(2) + '% finished of ' + total.toFixed(0) + ' mb'
unzip.on('data', -> console.log 'Unpacking zip...')
unzip.on('error', (err) -> console.log 'An error occurred while downloading DB Dump: ' + err)
unzip.on 'end', ->
console.log 'Finished downloading.'
deferred.resolve()
deferred.promise()
installUpdates = ->
deferred = Deferred()
npm = if process.platform is 'win32' then 'npm.cmd' else 'npm'
npminstall = run npm, ['update']
npminstall.done ->
bowerinstall = run 'bower', ['update']
deferred.resolve()
deferred.promise()
cleanUpTmp = ->
removeDir dbLocalPath
unless '--skipupdates' in process.argv
installUpdates()
if '--resetdb' in process.argv
if '--dldb' in process.argv
downloadDB().done ->
resetDB().done ->
cleanUpTmp() if '--cleanup' in process.argv
else
resetDB().done ->
cleanUpTmp() if '--cleanup' in process.argv
else if '--dldb' in process.argv
downloadDB()
# TODO: Could advice to start SCOCODE.bat et al. here
| true | # This is written in coffeescript. Run this using coffee, not node. (Line to yield nice warnings on node. :))
return console.log '------------------------------------------------- \n
Commandline utility written in Coffeescript to run all updates, download latest database and install it after you git pushed. \n
Params: \n
\t--skipupdates skips npm and bower update \n
\t--dldb: download the latest database (Over 300 mb!) \n
\t--resetdb: to reset the database and load dump from tmp. Will need a downloaded database or --dbdownload specified \n
\t--mongopath <.path/to/mongo>: to specify mongodb folder if not set in PATH. \n
\t--help: Yo fund this one already. \n
\n
May need an initial npm install upfront if newly checked out. \n
' if '--help' in process.argv
#TODO: MD5 Verification, using http://PI:IP_ADDRESS:192.168.3.11END_PI/dump.md5 using digest stream https://github.com/jeffbski/digest-stream
dbDump = 'http://analytics.codecombat.com:8080/dump.tar.gz' # Don't change this unless you know what you're doing
dbLocalPath = '../temp'
fs = require 'fs'
tar = require 'tar'
spawn = require('child_process').spawn
http = require 'http'
fs = require 'fs'
zlib = require 'zlib'
Deferred = require 'JQDeferred'
#TODO: Could kill current coco server here.
mongopath = ''
useNext = false
for path in process.argv
if useNext
mongopath = path
break
useNext = path is '--mongopath'
mongopath += '/bin/' if mongopath.length
mongopath += 'mongodb' # mongodb is in path.
run = (proc, args) ->
deferred = Deferred()
spawned = spawn proc, args
spawned.stdout.on 'data', (data) -> process.stdout.write data
spawned.stderr.on 'data', (data) -> process.stderr.write data
spawned.on 'exit', (code) ->
console.log proc + ' exited with code ' + code
# unless code is null doesn't seem to work
# deferred.reject()
deferred.resolve code
spawned.on 'error', (code, error) ->
console.error proc + ' failed!'
deferred.reject()
deferred.promise()
removeDir = (path) ->
if fs.existsSync(path)
fs.readdirSync(path).forEach (file) ->
current = path + '/' + file
if fs.lstatSync(current).isDirectory() # recurse
removeDir current
else # delete file
fs.unlinkSync current
fs.rmdirSync path
resetDB = ->
deferred = Deferred()
console.log 'Dropping Database'
mongodrop = run 'mongo', ['coco', '--eval', 'db.dropDatabase()']
mongodrop.fail -> console.error 'Error occurred while dropping mongo. Make sure CoCo\'s MongoDB is running.'
mongodrop.done ->
console.log 'Restoring from dump.'
mongorestore = run 'mongorestore', [dbLocalPath]
mongorestore.always = deferred.resolve()
deferred.promise()
downloadDB = ->
deferred = Deferred()
#mongoose = require 'mongoose'
# TODO: What if mongo is not running?
console.log 'Downloading Database dump. It\'s big. This may take a while...'
request = http.get dbDump, (response)->
unzip = response.pipe(zlib.createGunzip()).pipe(tar.Extract(path: dbLocalPath))
# Log download
currentChunk = 0
cur = 0
len = parseInt(response.headers['content-length'], 10)
total = len / 1048576 #1048576 - bytes in 1Megabyte
response.on 'data', (chunk) ->
cur += chunk.length
console.log 'DB dump download received chunk ' + currentChunk++ + ', ' + (100.0 * cur / len).toFixed(2) + '% finished of ' + total.toFixed(0) + ' mb'
unzip.on('data', -> console.log 'Unpacking zip...')
unzip.on('error', (err) -> console.log 'An error occurred while downloading DB Dump: ' + err)
unzip.on 'end', ->
console.log 'Finished downloading.'
deferred.resolve()
deferred.promise()
installUpdates = ->
deferred = Deferred()
npm = if process.platform is 'win32' then 'npm.cmd' else 'npm'
npminstall = run npm, ['update']
npminstall.done ->
bowerinstall = run 'bower', ['update']
deferred.resolve()
deferred.promise()
cleanUpTmp = ->
removeDir dbLocalPath
unless '--skipupdates' in process.argv
installUpdates()
if '--resetdb' in process.argv
if '--dldb' in process.argv
downloadDB().done ->
resetDB().done ->
cleanUpTmp() if '--cleanup' in process.argv
else
resetDB().done ->
cleanUpTmp() if '--cleanup' in process.argv
else if '--dldb' in process.argv
downloadDB()
# TODO: Could advice to start SCOCODE.bat et al. here
|
[
{
"context": "client\n username: githubAuth.username\n password: githubAuth.password\n\ngithubRepo = 'Thrillist/Pinnacle'\npinnacle =",
"end": 459,
"score": 0.9986425042152405,
"start": 440,
"tag": "PASSWORD",
"value": "githubAuth.password"
},
{
"context": "e\n password: githu... | server/stgr.coffee | briznad/stgr | 0 | console.log '\nstgr API server is warming up...\n'
###
load required modules
###
file = require 'fs'
_ = require 'underscore'
SSH = require 'ssh2'
express = require 'express'
GitHub = require 'octonode'
githubAuth = require './github_credentials'
###
load global vars
###
settings =
devMode: false
httpPort: 7847
app = do express
github = GitHub.client
username: githubAuth.username
password: githubAuth.password
githubRepo = 'Thrillist/Pinnacle'
pinnacle = github.repo githubRepo
queryIntervalInMinutes = 2
queryInterval = 1000 * 60 * queryIntervalInMinutes
lastChange = 0
data =
serverResults : {}
serverData : {}
serverList = []
propertyList = [
'thrillist'
'supercompressor'
'jackthreads'
'thrillistmediagroup'
]
###
helper utilities
###
devLog = (msg) ->
console.log msg
printLineBreak = ->
console.log '\n'
###
init
###
init = ->
# init server
do initServer
# init server list, then init server query
initServerList initQuery
###
init server
###
initServer = ->
# have app listen
app.listen settings.httpPort
# server started
console.info '\nserver started at http://127.0.0.1:' + settings.httpPort
# ERROR catcher
unless settings.devMode
console.info '\nPROD: errors will be caught and logged'
process.on 'uncaughtException', (err) ->
console.log '\nCaught the following exception:\n' + err
else
console.info '\nDEV: errors will NOT be caught'
# initialize routes
do initRoutes
# locked & loaded!
console.log '\n\n ####################\n s t g r - A P I\n ####################\n'
###
init routes
###
initRoutes = ->
_.each apiResources, (methodRoutes, method) ->
_.each methodRoutes, (route, routeFunction) ->
app[method] route, routeHandlers[routeFunction]
###
define routes
###
apiResources =
'get' :
'root' : [
'/'
'/api/v2/'
]
'test' : [
'/test'
'/api/v2/test'
]
'lastChange' : [
'/lastChange'
'/api/v2/lastChange'
]
'list' : [
'/list'
'/api/v2/servers'
'/api/v2/servers/:server'
]
# 'put' :
# '/update' : 'updateRequest'
# 'post' :
# '/create' : 'createRequest'
###
define route handlers
###
routeHandlers =
root: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json stgrSays: 'Hello World!'
test: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json stgrSays: 'serving test!'
lastChange: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json
lastChange : lastChange
queryIntervalInMinutes : queryIntervalInMinutes
list: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# if verbose query param is set, send detailed list
useList = unless /^$|true/.test req.query.verbose then 'serverResults' else 'serverData'
responseObj =
lastChange : lastChange
queryIntervalInMinutes : queryIntervalInMinutes
data : if req.params.server then data[useList][req.params.server] else data[useList]
res.header 'Access-Control-Allow-Origin', '*'
res.json responseObj
###
set interval to check on available servers
###
initServerList = (callback = ->) ->
t = setInterval ->
do collateServers
, 21600000 # update server list every 6 hours
collateServers callback
###
create list of available servers
###
collateServers = (callback = ->) ->
console.info 'determining which staging servers are in play'
possibleServers = 100
returnedResults = 0
foundServers = []
_.each propertyList, (property) ->
_.times possibleServers, (n) ->
n++
if n.toString().length is 1 then n = '0' + n
pingServer 'stage' + n + '.' + property + '.com', (validServer) ->
returnedResults++
foundServers.push validServer if validServer
if returnedResults is possibleServers * propertyList.length
serverList = foundServers
do callback
###
check for ssh access to server
###
pingServer = (server, callback) ->
conn = new SSH()
conn.on 'ready', ->
callback server
conn.on 'error', (error) ->
callback false
conn.connect
host: server
port: 22
username: 'leeroy'
privateKey: file.readFileSync 'leeroy_id_rsa.pem'
###
init query
###
initQuery = ->
t = setInterval ->
do queryServers
, queryInterval
do queryServers
###
iterate through the staging servers and hand off to be checked
###
queryServers = ->
console.log '\nquerying staging servers'
newResults = {}
serverCount = serverList.length
_.each serverList, (server) ->
queryServer server, (currentBranches) ->
if currentBranches
newResults[server] = currentBranches
else
serverCount--;
if _.keys(newResults).length is serverCount
# do printLineBreak
# devLog newResults
compareResults newResults
###
ask each staging server what branch they're running
###
queryServer = (server, callback = ->) ->
# console.log '\nquerying server:\n' + server
maxAttempts = 10
connAttempts = 0
# test for forward or backward slashes, aka things that shouldn't be in a branch
# if found, rerun branch check
validateResponse = (response) ->
if response? and !/\\|\/|HEAD/.test response
callback
pinnacle : response.split('Pinnaclebranch:')[1].split('Contrabranch:')[0]
contra : response.split('Contrabranch:')[1]
else if connAttempts >= maxAttempts
callback false
else
do printLineBreak
console.info 'uh-oh, SSH branch check ' + connAttempts + ' of ' + maxAttempts + ' for server ' + server + ' returned bad data\ntrying again'
do doQueryServer
doQueryServer = ->
connAttempts++;
conn = new SSH()
conn.on 'ready', ->
conn.shell 'echo "test"', (err, stream) ->
throw err if err
output = null
stream.stderr.on 'data', (data) ->
console.error 'STDERR: ' + data
stream.on 'data', (data) ->
data = data.toString('utf8').replace /\s/g, ''
# remove
return false if data.length < 2
# if the following command gets lumped in with the current line's output, cut it out
data = data.split(/\[/)[0] if /\[/.test data
output = data if /Pinnaclebranch/.test(data) and /Contrabranch/.test(data)
stream.on 'close', ->
do conn.end
# do printLineBreak
# devLog server + ' responded:'
# do printLineBreak
# devLog currentBranch
validateResponse output
stream.end 'cat /tmp/' + server.split('.')[1].toUpperCase() + '_CURRENT_BRANCHES\nexit\n'
conn.connect
host: server
port: 22
username: 'leeroy'
privateKey: file.readFileSync 'leeroy_id_rsa.pem'
# initial server query
do doQueryServer
###
check to see if any servers have changed
###
compareResults = (newResults) ->
console.log '\ncomparing results'
# create an object with only changed servers/branches
changedServers = _.omit newResults, (value, key, object) ->
return _.isEqual value, data.serverResults[key]
changedCount = _.keys(changedServers).length
if changedCount
console.log '\nnew branches!'
lastChange = Date.now()
# ensure serverResults are sorted properly
data.serverResults = objSort newResults
fetchMilestones (activeMilestones) ->
addGithubData changedServers, changedCount, activeMilestones
else
console.log '\nno change'
console.info '\nchecking again in ' + queryIntervalInMinutes + ' minute/s'
###
fetch all milestones from Github
###
fetchMilestones = (callback = ->) ->
activeMilestones = {}
pinnacle.milestones
page : 1
per_page : 100
state : 'all'
sort : 'completeness'
, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
_.each data, (milestone) ->
if _.invert(data.serverResults)[milestone.title]
activeMilestones[milestone.title] = milestone.number
callback activeMilestones
###
iterate through each changed server and pass it off to be Github query function
when done add this info to the serverData object
###
addGithubData = (changedServers, changedCount, activeMilestones) ->
changedServersData = {}
_.each changedServers, (branch, server) ->
queryGithub server, branch.pinnacle, activeMilestones, (server, verboseData) ->
changedServersData[server] =
server : server
property : server.split('.')[1]
branches :
contra : branch.contra
pinnacle : verboseData
if _.keys(changedServersData).length is changedCount
console.log '\nGithub querying complete!'
# extend serverData, sort, and save
data.serverData = objSort _.extend data.serverData, changedServersData
# ALL DONE
# do printLineBreak
# devLog changedServersData
# devLog data.serverData
###
handle the various Github queries and fire callback when all have come back
###
queryGithub = (server, branch, activeMilestones, callback = ->) ->
verboseData =
last_commit : false
milestone : false
author : false
pull : false
branch :
name : branch
link : 'https://github.com/Thrillist/Pinnacle/tree/' + branch
open : false
# set flags to hackily get around async calls
complete =
branch : false
pull : false
labels : false
milestone : false
callbackCheck = (type) ->
complete[type] = true
if complete.branch and complete.pull and complete.labels and complete.milestone then callback server, verboseData
queryBranch branch, (queryBranchData = {}) ->
verboseData = _.extend verboseData, queryBranchData
callbackCheck 'branch'
queryPullByBranch branch, verboseData.author, (queryPullData = {}) ->
verboseData = _.extend verboseData, queryPullData
callbackCheck 'pull'
if verboseData.pull and verboseData.pull.number
queryLabels verboseData.pull.number, (queryLabelsData = []) ->
verboseData.pull.labels = queryLabelsData
callbackCheck 'labels'
else callbackCheck 'labels'
# query for milestone
if activeMilestones[branch]
queryMilestone activeMilestones[branch], (queryMilestoneData = {}) ->
verboseData.milestone = queryMilestoneData
callbackCheck 'milestone'
else callbackCheck 'milestone'
###
query Github for branch info
###
queryBranch = (branch, callback = ->) ->
queryBranchData = {}
pinnacle.branch branch, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
queryBranchData.branch =
name: data.name
link: data._links.html
open: true
queryBranchData.last_commit =
date: data.commit.commit.author.date
message: data.commit.commit.message
queryBranchData.author =
name: data.commit.author.login
link: data.commit.author.html_url
pic: data.commit.author.avatar_url
callback queryBranchData
###
query Github for pull request info by specifying the branch name
###
queryPullByBranch = (branch, currentAuthor, callback = ->) ->
queryPullData = {}
pinnacle.prs
page : 1
per_page : 1
head : 'Thrillist:' + branch
state : 'all'
, (err, data, headers) ->
if data and data.length
data = data[0]
# do printLineBreak
# devLog data
queryPullData.pull =
number : data.number
open : if data.state is 'open' then true else false
merged : if data.merged_at then true else false
name : data.title
link : data._links.html.href
queryPullData.author = _.extend
name : data[if data.assignee then 'assignee' else 'user'].login
link : data[if data.assignee then 'assignee' else 'user'].html_url
pic : data[if data.assignee then 'assignee' else 'user'].avatar_url
, currentAuthor or {} # extend in case branchQuery has already come back with richer data
queryPullData.labels = []
callback queryPullData
###
query Github for label info
###
queryLabels = (number, callback = ->) ->
queryLabelsData = []
# query for a specific pull request's labels
issue = github.issue githubRepo, number
issue.info (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
_.each data.labels, (label) ->
queryLabelsData.push
link : label.url.replace('api.github.com/repos', 'github.com').replace('+', '%20')
color : '#' + label.color
name : label.name
callback queryLabelsData
###
query Github for milestone info
###
queryMilestone = (number, callback = ->) ->
queryMilestoneData = {}
pinnacle.issues
page : 1
per_page : 100
milestone : number
state : 'all'
, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data[0]
queryMilestoneData =
open : if data[0].milestone.state is 'open' then true else false
open_issues : data[0].milestone.open_issues
closed_issues : data[0].milestone.closed_issues
issues = []
_.each data, (issue) ->
issueLabels = []
_.each issue.labels, (label) ->
issueLabels.push
link : label.url.replace('api.github.com/repos', 'github.com').replace('+', '%20')
color : '#' + label.color
name : label.name
tempIssue =
labels : issueLabels
author :
name : issue[if issue.assignee then 'assignee' else 'user'].login
link : issue[if issue.assignee then 'assignee' else 'user'].html_url
pic : issue[if issue.assignee then 'assignee' else 'user'].avatar_url
pull :
number : issue.number
open : if issue.state is 'open' then true else false
name : issue.title
link : issue.html_url
queryPullByNumber issue.number, (queryPullData = {}) ->
issues.push _.extend tempIssue, queryPullData
if issues.length is data.length
# got all milestone data
queryMilestoneData.issues = issues
callback queryMilestoneData
else callback queryMilestoneData
###
query Github for pull request info by specifying the pull number
###
queryPullByNumber = (number, callback = ->) ->
queryPullData = {}
# query for a specific pull request
pull = github.pr githubRepo, number
pull.info (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
queryPullData.branch =
name : data.head.ref
link : 'https://github.com/Thrillist/Pinnacle/tree/' + data.head.ref
queryPullData.pull =
number : data.number
open : if data.state is 'open' then true else false
merged : if data.merged_at then true else false
name : data.title
link : data.html_url
callback queryPullData
###
object sorter helper function
###
objSort = (obj) ->
tempObj = {}
_.each _.keys(obj).sort(), (value) ->
tempObj[value] = obj[value]
tempObj
###
LETS DO THIS THING!
###
do init | 223759 | console.log '\nstgr API server is warming up...\n'
###
load required modules
###
file = require 'fs'
_ = require 'underscore'
SSH = require 'ssh2'
express = require 'express'
GitHub = require 'octonode'
githubAuth = require './github_credentials'
###
load global vars
###
settings =
devMode: false
httpPort: 7847
app = do express
github = GitHub.client
username: githubAuth.username
password: <PASSWORD>
githubRepo = 'Thrillist/Pinnacle'
pinnacle = github.repo githubRepo
queryIntervalInMinutes = 2
queryInterval = 1000 * 60 * queryIntervalInMinutes
lastChange = 0
data =
serverResults : {}
serverData : {}
serverList = []
propertyList = [
'thrillist'
'supercompressor'
'jackthreads'
'thrillistmediagroup'
]
###
helper utilities
###
devLog = (msg) ->
console.log msg
printLineBreak = ->
console.log '\n'
###
init
###
init = ->
# init server
do initServer
# init server list, then init server query
initServerList initQuery
###
init server
###
initServer = ->
# have app listen
app.listen settings.httpPort
# server started
console.info '\nserver started at http://127.0.0.1:' + settings.httpPort
# ERROR catcher
unless settings.devMode
console.info '\nPROD: errors will be caught and logged'
process.on 'uncaughtException', (err) ->
console.log '\nCaught the following exception:\n' + err
else
console.info '\nDEV: errors will NOT be caught'
# initialize routes
do initRoutes
# locked & loaded!
console.log '\n\n ####################\n s t g r - A P I\n ####################\n'
###
init routes
###
initRoutes = ->
_.each apiResources, (methodRoutes, method) ->
_.each methodRoutes, (route, routeFunction) ->
app[method] route, routeHandlers[routeFunction]
###
define routes
###
apiResources =
'get' :
'root' : [
'/'
'/api/v2/'
]
'test' : [
'/test'
'/api/v2/test'
]
'lastChange' : [
'/lastChange'
'/api/v2/lastChange'
]
'list' : [
'/list'
'/api/v2/servers'
'/api/v2/servers/:server'
]
# 'put' :
# '/update' : 'updateRequest'
# 'post' :
# '/create' : 'createRequest'
###
define route handlers
###
routeHandlers =
root: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json stgrSays: 'Hello World!'
test: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json stgrSays: 'serving test!'
lastChange: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json
lastChange : lastChange
queryIntervalInMinutes : queryIntervalInMinutes
list: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# if verbose query param is set, send detailed list
useList = unless /^$|true/.test req.query.verbose then 'serverResults' else 'serverData'
responseObj =
lastChange : lastChange
queryIntervalInMinutes : queryIntervalInMinutes
data : if req.params.server then data[useList][req.params.server] else data[useList]
res.header 'Access-Control-Allow-Origin', '*'
res.json responseObj
###
set interval to check on available servers
###
initServerList = (callback = ->) ->
t = setInterval ->
do collateServers
, 21600000 # update server list every 6 hours
collateServers callback
###
create list of available servers
###
collateServers = (callback = ->) ->
console.info 'determining which staging servers are in play'
possibleServers = 100
returnedResults = 0
foundServers = []
_.each propertyList, (property) ->
_.times possibleServers, (n) ->
n++
if n.toString().length is 1 then n = '0' + n
pingServer 'stage' + n + '.' + property + '.com', (validServer) ->
returnedResults++
foundServers.push validServer if validServer
if returnedResults is possibleServers * propertyList.length
serverList = foundServers
do callback
###
check for ssh access to server
###
pingServer = (server, callback) ->
conn = new SSH()
conn.on 'ready', ->
callback server
conn.on 'error', (error) ->
callback false
conn.connect
host: server
port: 22
username: 'leeroy'
privateKey: file.readFileSync 'leeroy_id_rsa.pem'
###
init query
###
initQuery = ->
t = setInterval ->
do queryServers
, queryInterval
do queryServers
###
iterate through the staging servers and hand off to be checked
###
queryServers = ->
console.log '\nquerying staging servers'
newResults = {}
serverCount = serverList.length
_.each serverList, (server) ->
queryServer server, (currentBranches) ->
if currentBranches
newResults[server] = currentBranches
else
serverCount--;
if _.keys(newResults).length is serverCount
# do printLineBreak
# devLog newResults
compareResults newResults
###
ask each staging server what branch they're running
###
queryServer = (server, callback = ->) ->
# console.log '\nquerying server:\n' + server
maxAttempts = 10
connAttempts = 0
# test for forward or backward slashes, aka things that shouldn't be in a branch
# if found, rerun branch check
validateResponse = (response) ->
if response? and !/\\|\/|HEAD/.test response
callback
pinnacle : response.split('Pinnaclebranch:')[1].split('Contrabranch:')[0]
contra : response.split('Contrabranch:')[1]
else if connAttempts >= maxAttempts
callback false
else
do printLineBreak
console.info 'uh-oh, SSH branch check ' + connAttempts + ' of ' + maxAttempts + ' for server ' + server + ' returned bad data\ntrying again'
do doQueryServer
doQueryServer = ->
connAttempts++;
conn = new SSH()
conn.on 'ready', ->
conn.shell 'echo "test"', (err, stream) ->
throw err if err
output = null
stream.stderr.on 'data', (data) ->
console.error 'STDERR: ' + data
stream.on 'data', (data) ->
data = data.toString('utf8').replace /\s/g, ''
# remove
return false if data.length < 2
# if the following command gets lumped in with the current line's output, cut it out
data = data.split(/\[/)[0] if /\[/.test data
output = data if /Pinnaclebranch/.test(data) and /Contrabranch/.test(data)
stream.on 'close', ->
do conn.end
# do printLineBreak
# devLog server + ' responded:'
# do printLineBreak
# devLog currentBranch
validateResponse output
stream.end 'cat /tmp/' + server.split('.')[1].toUpperCase() + '_CURRENT_BRANCHES\nexit\n'
conn.connect
host: server
port: 22
username: 'leeroy'
privateKey: file.readFileSync 'leeroy_id_rsa.pem'
# initial server query
do doQueryServer
###
check to see if any servers have changed
###
compareResults = (newResults) ->
console.log '\ncomparing results'
# create an object with only changed servers/branches
changedServers = _.omit newResults, (value, key, object) ->
return _.isEqual value, data.serverResults[key]
changedCount = _.keys(changedServers).length
if changedCount
console.log '\nnew branches!'
lastChange = Date.now()
# ensure serverResults are sorted properly
data.serverResults = objSort newResults
fetchMilestones (activeMilestones) ->
addGithubData changedServers, changedCount, activeMilestones
else
console.log '\nno change'
console.info '\nchecking again in ' + queryIntervalInMinutes + ' minute/s'
###
fetch all milestones from Github
###
fetchMilestones = (callback = ->) ->
activeMilestones = {}
pinnacle.milestones
page : 1
per_page : 100
state : 'all'
sort : 'completeness'
, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
_.each data, (milestone) ->
if _.invert(data.serverResults)[milestone.title]
activeMilestones[milestone.title] = milestone.number
callback activeMilestones
###
iterate through each changed server and pass it off to be Github query function
when done add this info to the serverData object
###
addGithubData = (changedServers, changedCount, activeMilestones) ->
changedServersData = {}
_.each changedServers, (branch, server) ->
queryGithub server, branch.pinnacle, activeMilestones, (server, verboseData) ->
changedServersData[server] =
server : server
property : server.split('.')[1]
branches :
contra : branch.contra
pinnacle : verboseData
if _.keys(changedServersData).length is changedCount
console.log '\nGithub querying complete!'
# extend serverData, sort, and save
data.serverData = objSort _.extend data.serverData, changedServersData
# ALL DONE
# do printLineBreak
# devLog changedServersData
# devLog data.serverData
###
handle the various Github queries and fire callback when all have come back
###
queryGithub = (server, branch, activeMilestones, callback = ->) ->
verboseData =
last_commit : false
milestone : false
author : false
pull : false
branch :
name : branch
link : 'https://github.com/Thrillist/Pinnacle/tree/' + branch
open : false
# set flags to hackily get around async calls
complete =
branch : false
pull : false
labels : false
milestone : false
callbackCheck = (type) ->
complete[type] = true
if complete.branch and complete.pull and complete.labels and complete.milestone then callback server, verboseData
queryBranch branch, (queryBranchData = {}) ->
verboseData = _.extend verboseData, queryBranchData
callbackCheck 'branch'
queryPullByBranch branch, verboseData.author, (queryPullData = {}) ->
verboseData = _.extend verboseData, queryPullData
callbackCheck 'pull'
if verboseData.pull and verboseData.pull.number
queryLabels verboseData.pull.number, (queryLabelsData = []) ->
verboseData.pull.labels = queryLabelsData
callbackCheck 'labels'
else callbackCheck 'labels'
# query for milestone
if activeMilestones[branch]
queryMilestone activeMilestones[branch], (queryMilestoneData = {}) ->
verboseData.milestone = queryMilestoneData
callbackCheck 'milestone'
else callbackCheck 'milestone'
###
query Github for branch info
###
queryBranch = (branch, callback = ->) ->
queryBranchData = {}
pinnacle.branch branch, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
queryBranchData.branch =
name: data.name
link: data._links.html
open: true
queryBranchData.last_commit =
date: data.commit.commit.author.date
message: data.commit.commit.message
queryBranchData.author =
name: data.commit.author.login
link: data.commit.author.html_url
pic: data.commit.author.avatar_url
callback queryBranchData
###
query Github for pull request info by specifying the branch name
###
queryPullByBranch = (branch, currentAuthor, callback = ->) ->
queryPullData = {}
pinnacle.prs
page : 1
per_page : 1
head : 'Thrillist:' + branch
state : 'all'
, (err, data, headers) ->
if data and data.length
data = data[0]
# do printLineBreak
# devLog data
queryPullData.pull =
number : data.number
open : if data.state is 'open' then true else false
merged : if data.merged_at then true else false
name : data.title
link : data._links.html.href
queryPullData.author = _.extend
name : data[if data.assignee then 'assignee' else 'user'].login
link : data[if data.assignee then 'assignee' else 'user'].html_url
pic : data[if data.assignee then 'assignee' else 'user'].avatar_url
, currentAuthor or {} # extend in case branchQuery has already come back with richer data
queryPullData.labels = []
callback queryPullData
###
query Github for label info
###
queryLabels = (number, callback = ->) ->
queryLabelsData = []
# query for a specific pull request's labels
issue = github.issue githubRepo, number
issue.info (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
_.each data.labels, (label) ->
queryLabelsData.push
link : label.url.replace('api.github.com/repos', 'github.com').replace('+', '%20')
color : '#' + label.color
name : label.name
callback queryLabelsData
###
query Github for milestone info
###
queryMilestone = (number, callback = ->) ->
queryMilestoneData = {}
pinnacle.issues
page : 1
per_page : 100
milestone : number
state : 'all'
, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data[0]
queryMilestoneData =
open : if data[0].milestone.state is 'open' then true else false
open_issues : data[0].milestone.open_issues
closed_issues : data[0].milestone.closed_issues
issues = []
_.each data, (issue) ->
issueLabels = []
_.each issue.labels, (label) ->
issueLabels.push
link : label.url.replace('api.github.com/repos', 'github.com').replace('+', '%20')
color : '#' + label.color
name : label.name
tempIssue =
labels : issueLabels
author :
name : issue[if issue.assignee then 'assignee' else 'user'].login
link : issue[if issue.assignee then 'assignee' else 'user'].html_url
pic : issue[if issue.assignee then 'assignee' else 'user'].avatar_url
pull :
number : issue.number
open : if issue.state is 'open' then true else false
name : issue.title
link : issue.html_url
queryPullByNumber issue.number, (queryPullData = {}) ->
issues.push _.extend tempIssue, queryPullData
if issues.length is data.length
# got all milestone data
queryMilestoneData.issues = issues
callback queryMilestoneData
else callback queryMilestoneData
###
query Github for pull request info by specifying the pull number
###
queryPullByNumber = (number, callback = ->) ->
queryPullData = {}
# query for a specific pull request
pull = github.pr githubRepo, number
pull.info (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
queryPullData.branch =
name : data.head.ref
link : 'https://github.com/Thrillist/Pinnacle/tree/' + data.head.ref
queryPullData.pull =
number : data.number
open : if data.state is 'open' then true else false
merged : if data.merged_at then true else false
name : data.title
link : data.html_url
callback queryPullData
###
object sorter helper function
###
objSort = (obj) ->
tempObj = {}
_.each _.keys(obj).sort(), (value) ->
tempObj[value] = obj[value]
tempObj
###
LETS DO THIS THING!
###
do init | true | console.log '\nstgr API server is warming up...\n'
###
load required modules
###
file = require 'fs'
_ = require 'underscore'
SSH = require 'ssh2'
express = require 'express'
GitHub = require 'octonode'
githubAuth = require './github_credentials'
###
load global vars
###
settings =
devMode: false
httpPort: 7847
app = do express
github = GitHub.client
username: githubAuth.username
password: PI:PASSWORD:<PASSWORD>END_PI
githubRepo = 'Thrillist/Pinnacle'
pinnacle = github.repo githubRepo
queryIntervalInMinutes = 2
queryInterval = 1000 * 60 * queryIntervalInMinutes
lastChange = 0
data =
serverResults : {}
serverData : {}
serverList = []
propertyList = [
'thrillist'
'supercompressor'
'jackthreads'
'thrillistmediagroup'
]
###
helper utilities
###
devLog = (msg) ->
console.log msg
printLineBreak = ->
console.log '\n'
###
init
###
init = ->
# init server
do initServer
# init server list, then init server query
initServerList initQuery
###
init server
###
initServer = ->
# have app listen
app.listen settings.httpPort
# server started
console.info '\nserver started at http://127.0.0.1:' + settings.httpPort
# ERROR catcher
unless settings.devMode
console.info '\nPROD: errors will be caught and logged'
process.on 'uncaughtException', (err) ->
console.log '\nCaught the following exception:\n' + err
else
console.info '\nDEV: errors will NOT be caught'
# initialize routes
do initRoutes
# locked & loaded!
console.log '\n\n ####################\n s t g r - A P I\n ####################\n'
###
init routes
###
initRoutes = ->
_.each apiResources, (methodRoutes, method) ->
_.each methodRoutes, (route, routeFunction) ->
app[method] route, routeHandlers[routeFunction]
###
define routes
###
apiResources =
'get' :
'root' : [
'/'
'/api/v2/'
]
'test' : [
'/test'
'/api/v2/test'
]
'lastChange' : [
'/lastChange'
'/api/v2/lastChange'
]
'list' : [
'/list'
'/api/v2/servers'
'/api/v2/servers/:server'
]
# 'put' :
# '/update' : 'updateRequest'
# 'post' :
# '/create' : 'createRequest'
###
define route handlers
###
routeHandlers =
root: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json stgrSays: 'Hello World!'
test: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json stgrSays: 'serving test!'
lastChange: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# respond!!
res.header 'Access-Control-Allow-Origin', '*'
res.json
lastChange : lastChange
queryIntervalInMinutes : queryIntervalInMinutes
list: (req, res) ->
console.log '\nOMG, a request!'
console.info 'request made for:\n' + req.url
# if verbose query param is set, send detailed list
useList = unless /^$|true/.test req.query.verbose then 'serverResults' else 'serverData'
responseObj =
lastChange : lastChange
queryIntervalInMinutes : queryIntervalInMinutes
data : if req.params.server then data[useList][req.params.server] else data[useList]
res.header 'Access-Control-Allow-Origin', '*'
res.json responseObj
###
set interval to check on available servers
###
initServerList = (callback = ->) ->
t = setInterval ->
do collateServers
, 21600000 # update server list every 6 hours
collateServers callback
###
create list of available servers
###
collateServers = (callback = ->) ->
console.info 'determining which staging servers are in play'
possibleServers = 100
returnedResults = 0
foundServers = []
_.each propertyList, (property) ->
_.times possibleServers, (n) ->
n++
if n.toString().length is 1 then n = '0' + n
pingServer 'stage' + n + '.' + property + '.com', (validServer) ->
returnedResults++
foundServers.push validServer if validServer
if returnedResults is possibleServers * propertyList.length
serverList = foundServers
do callback
###
check for ssh access to server
###
pingServer = (server, callback) ->
conn = new SSH()
conn.on 'ready', ->
callback server
conn.on 'error', (error) ->
callback false
conn.connect
host: server
port: 22
username: 'leeroy'
privateKey: file.readFileSync 'leeroy_id_rsa.pem'
###
init query
###
initQuery = ->
t = setInterval ->
do queryServers
, queryInterval
do queryServers
###
iterate through the staging servers and hand off to be checked
###
queryServers = ->
console.log '\nquerying staging servers'
newResults = {}
serverCount = serverList.length
_.each serverList, (server) ->
queryServer server, (currentBranches) ->
if currentBranches
newResults[server] = currentBranches
else
serverCount--;
if _.keys(newResults).length is serverCount
# do printLineBreak
# devLog newResults
compareResults newResults
###
ask each staging server what branch they're running
###
queryServer = (server, callback = ->) ->
# console.log '\nquerying server:\n' + server
maxAttempts = 10
connAttempts = 0
# test for forward or backward slashes, aka things that shouldn't be in a branch
# if found, rerun branch check
validateResponse = (response) ->
if response? and !/\\|\/|HEAD/.test response
callback
pinnacle : response.split('Pinnaclebranch:')[1].split('Contrabranch:')[0]
contra : response.split('Contrabranch:')[1]
else if connAttempts >= maxAttempts
callback false
else
do printLineBreak
console.info 'uh-oh, SSH branch check ' + connAttempts + ' of ' + maxAttempts + ' for server ' + server + ' returned bad data\ntrying again'
do doQueryServer
doQueryServer = ->
connAttempts++;
conn = new SSH()
conn.on 'ready', ->
conn.shell 'echo "test"', (err, stream) ->
throw err if err
output = null
stream.stderr.on 'data', (data) ->
console.error 'STDERR: ' + data
stream.on 'data', (data) ->
data = data.toString('utf8').replace /\s/g, ''
# remove
return false if data.length < 2
# if the following command gets lumped in with the current line's output, cut it out
data = data.split(/\[/)[0] if /\[/.test data
output = data if /Pinnaclebranch/.test(data) and /Contrabranch/.test(data)
stream.on 'close', ->
do conn.end
# do printLineBreak
# devLog server + ' responded:'
# do printLineBreak
# devLog currentBranch
validateResponse output
stream.end 'cat /tmp/' + server.split('.')[1].toUpperCase() + '_CURRENT_BRANCHES\nexit\n'
conn.connect
host: server
port: 22
username: 'leeroy'
privateKey: file.readFileSync 'leeroy_id_rsa.pem'
# initial server query
do doQueryServer
###
check to see if any servers have changed
###
compareResults = (newResults) ->
console.log '\ncomparing results'
# create an object with only changed servers/branches
changedServers = _.omit newResults, (value, key, object) ->
return _.isEqual value, data.serverResults[key]
changedCount = _.keys(changedServers).length
if changedCount
console.log '\nnew branches!'
lastChange = Date.now()
# ensure serverResults are sorted properly
data.serverResults = objSort newResults
fetchMilestones (activeMilestones) ->
addGithubData changedServers, changedCount, activeMilestones
else
console.log '\nno change'
console.info '\nchecking again in ' + queryIntervalInMinutes + ' minute/s'
###
fetch all milestones from Github
###
fetchMilestones = (callback = ->) ->
activeMilestones = {}
pinnacle.milestones
page : 1
per_page : 100
state : 'all'
sort : 'completeness'
, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
_.each data, (milestone) ->
if _.invert(data.serverResults)[milestone.title]
activeMilestones[milestone.title] = milestone.number
callback activeMilestones
###
iterate through each changed server and pass it off to be Github query function
when done add this info to the serverData object
###
addGithubData = (changedServers, changedCount, activeMilestones) ->
changedServersData = {}
_.each changedServers, (branch, server) ->
queryGithub server, branch.pinnacle, activeMilestones, (server, verboseData) ->
changedServersData[server] =
server : server
property : server.split('.')[1]
branches :
contra : branch.contra
pinnacle : verboseData
if _.keys(changedServersData).length is changedCount
console.log '\nGithub querying complete!'
# extend serverData, sort, and save
data.serverData = objSort _.extend data.serverData, changedServersData
# ALL DONE
# do printLineBreak
# devLog changedServersData
# devLog data.serverData
###
handle the various Github queries and fire callback when all have come back
###
queryGithub = (server, branch, activeMilestones, callback = ->) ->
verboseData =
last_commit : false
milestone : false
author : false
pull : false
branch :
name : branch
link : 'https://github.com/Thrillist/Pinnacle/tree/' + branch
open : false
# set flags to hackily get around async calls
complete =
branch : false
pull : false
labels : false
milestone : false
callbackCheck = (type) ->
complete[type] = true
if complete.branch and complete.pull and complete.labels and complete.milestone then callback server, verboseData
queryBranch branch, (queryBranchData = {}) ->
verboseData = _.extend verboseData, queryBranchData
callbackCheck 'branch'
queryPullByBranch branch, verboseData.author, (queryPullData = {}) ->
verboseData = _.extend verboseData, queryPullData
callbackCheck 'pull'
if verboseData.pull and verboseData.pull.number
queryLabels verboseData.pull.number, (queryLabelsData = []) ->
verboseData.pull.labels = queryLabelsData
callbackCheck 'labels'
else callbackCheck 'labels'
# query for milestone
if activeMilestones[branch]
queryMilestone activeMilestones[branch], (queryMilestoneData = {}) ->
verboseData.milestone = queryMilestoneData
callbackCheck 'milestone'
else callbackCheck 'milestone'
###
query Github for branch info
###
queryBranch = (branch, callback = ->) ->
queryBranchData = {}
pinnacle.branch branch, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
queryBranchData.branch =
name: data.name
link: data._links.html
open: true
queryBranchData.last_commit =
date: data.commit.commit.author.date
message: data.commit.commit.message
queryBranchData.author =
name: data.commit.author.login
link: data.commit.author.html_url
pic: data.commit.author.avatar_url
callback queryBranchData
###
query Github for pull request info by specifying the branch name
###
queryPullByBranch = (branch, currentAuthor, callback = ->) ->
queryPullData = {}
pinnacle.prs
page : 1
per_page : 1
head : 'Thrillist:' + branch
state : 'all'
, (err, data, headers) ->
if data and data.length
data = data[0]
# do printLineBreak
# devLog data
queryPullData.pull =
number : data.number
open : if data.state is 'open' then true else false
merged : if data.merged_at then true else false
name : data.title
link : data._links.html.href
queryPullData.author = _.extend
name : data[if data.assignee then 'assignee' else 'user'].login
link : data[if data.assignee then 'assignee' else 'user'].html_url
pic : data[if data.assignee then 'assignee' else 'user'].avatar_url
, currentAuthor or {} # extend in case branchQuery has already come back with richer data
queryPullData.labels = []
callback queryPullData
###
query Github for label info
###
queryLabels = (number, callback = ->) ->
queryLabelsData = []
# query for a specific pull request's labels
issue = github.issue githubRepo, number
issue.info (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
_.each data.labels, (label) ->
queryLabelsData.push
link : label.url.replace('api.github.com/repos', 'github.com').replace('+', '%20')
color : '#' + label.color
name : label.name
callback queryLabelsData
###
query Github for milestone info
###
queryMilestone = (number, callback = ->) ->
queryMilestoneData = {}
pinnacle.issues
page : 1
per_page : 100
milestone : number
state : 'all'
, (err, data, headers) ->
unless err
# do printLineBreak
# devLog data[0]
queryMilestoneData =
open : if data[0].milestone.state is 'open' then true else false
open_issues : data[0].milestone.open_issues
closed_issues : data[0].milestone.closed_issues
issues = []
_.each data, (issue) ->
issueLabels = []
_.each issue.labels, (label) ->
issueLabels.push
link : label.url.replace('api.github.com/repos', 'github.com').replace('+', '%20')
color : '#' + label.color
name : label.name
tempIssue =
labels : issueLabels
author :
name : issue[if issue.assignee then 'assignee' else 'user'].login
link : issue[if issue.assignee then 'assignee' else 'user'].html_url
pic : issue[if issue.assignee then 'assignee' else 'user'].avatar_url
pull :
number : issue.number
open : if issue.state is 'open' then true else false
name : issue.title
link : issue.html_url
queryPullByNumber issue.number, (queryPullData = {}) ->
issues.push _.extend tempIssue, queryPullData
if issues.length is data.length
# got all milestone data
queryMilestoneData.issues = issues
callback queryMilestoneData
else callback queryMilestoneData
###
query Github for pull request info by specifying the pull number
###
queryPullByNumber = (number, callback = ->) ->
queryPullData = {}
# query for a specific pull request
pull = github.pr githubRepo, number
pull.info (err, data, headers) ->
unless err
# do printLineBreak
# devLog data
queryPullData.branch =
name : data.head.ref
link : 'https://github.com/Thrillist/Pinnacle/tree/' + data.head.ref
queryPullData.pull =
number : data.number
open : if data.state is 'open' then true else false
merged : if data.merged_at then true else false
name : data.title
link : data.html_url
callback queryPullData
###
object sorter helper function
###
objSort = (obj) ->
tempObj = {}
_.each _.keys(obj).sort(), (value) ->
tempObj[value] = obj[value]
tempObj
###
LETS DO THIS THING!
###
do init |
[
{
"context": "### \nCopyright (c) 2013 Iain Hamilton & Edward Smyth\n\nPermission is hereby granted, fre",
"end": 38,
"score": 0.9998689889907837,
"start": 25,
"tag": "NAME",
"value": "Iain Hamilton"
},
{
"context": "### \nCopyright (c) 2013 Iain Hamilton & Edward Smyth\n\nPermissi... | jsiso/pathfind/worker.coffee | WahlbergRu/Go-In-Shadow | 0 | ###
Copyright (c) 2013 Iain Hamilton & Edward Smyth
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
###
###
Pathfind Worker
###
self.addEventListener 'message', ((evt) ->
# Initial passed values
s = evt.data.s
e = evt.data.e
m = evt.data.m
d = if evt.data.d == false then false else true
# Allow Diagonal Movement
###
Nodes -
x: x position
y: y position
p: Index of the parent node (Stored in closed array)
g: Cost from start to current node
h: Heuristic cost from current node to destination
f: Cost from start to desination going through current node
###
node = (x, y, p, g, h, f) ->
@x = x
@y = y
@p = p
@g = g
@h = h
@f = f
return
###
Heuristic - Estimated movement cost from current square to end position
###
heuristic = (current, end) ->
x = current.x - (end.x)
y = current.y - (end.y)
x ** 2 + y ** 2
###
Difference
###
diff = (a, b) ->
Math.abs if a > b then a - b else b - a
# Set-up Nodes
s = new node(s[0], s[1], -1, -1, -1, -1)
# Start Node
e = new node(e[0], e[1], -1, -1, -1, -1)
# End Node
###
Set-up Variables
###
cols = m.length - 1
rows = m[0].length - 1
o = []
c = []
mn = new Array(rows * cols)
g = 0
h = heuristic(s, e)
f = g + h
# Place start node onto list of open nodes
o.push s
# Initiate Search Loop, keep going while there are nodes in the open list
while o.length > 0
# Locate Best Node
best =
c: o[0].f
n: 0
i = 1
len = o.length
while i < len
if o[i].f < best.c
best.c = o[i].f
best.n = i
i++
# Set current to best
current = o[best.n]
# Check if end point has been reached
if current.x == e.x and current.y == e.y
path = [ {
x: e.x
y: e.y
} ]
# Create Path
# Loop back through parents to complete the path
while current.p != -1
current = c[current.p]
path.unshift
x: current.x
y: current.y
self.postMessage path
# Return the path
return true
# Remove current node from open list
o.splice best.n, 1
mn[current.x + current.y * rows * cols] = false
# Set bit to closed
c.push current
# Search new nodes in all directions
x = Math.max(0, current.x - 1)
lenx = Math.min(cols, current.x + 1)
while x <= lenx
y = Math.max(0, current.y - 1)
leny = Math.min(rows, current.y + 1)
while y <= leny
if d or diff(current.x, x) + diff(current.y, y) <= 1
# Check if location square is open
if Number(m[x][y]) == 0
# Check if square is in closed list
if mn[x + y * rows * cols] == false
y++
continue
# If square not in open list use it
if mn[x + y * rows * cols] != true
n = new node(x, y, c.length - 1, -1, -1, -1)
# Create new node
n.g = current.g + Math.floor(Math.sqrt((n.x - (current.x)) ** 2 + (n.y - (current.y)) ** 2))
n.h = heuristic(n, e)
n.f = n.g + n.h
o.push n
# Push node onto open list
mn[x + y * rows * cols] = true
# Set bit into open list
y++
x++
self.postMessage []
# No Path Found!
true
), false
| 148432 | ###
Copyright (c) 2013 <NAME> & <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
###
###
Pathfind Worker
###
self.addEventListener 'message', ((evt) ->
# Initial passed values
s = evt.data.s
e = evt.data.e
m = evt.data.m
d = if evt.data.d == false then false else true
# Allow Diagonal Movement
###
Nodes -
x: x position
y: y position
p: Index of the parent node (Stored in closed array)
g: Cost from start to current node
h: Heuristic cost from current node to destination
f: Cost from start to desination going through current node
###
node = (x, y, p, g, h, f) ->
@x = x
@y = y
@p = p
@g = g
@h = h
@f = f
return
###
Heuristic - Estimated movement cost from current square to end position
###
heuristic = (current, end) ->
x = current.x - (end.x)
y = current.y - (end.y)
x ** 2 + y ** 2
###
Difference
###
diff = (a, b) ->
Math.abs if a > b then a - b else b - a
# Set-up Nodes
s = new node(s[0], s[1], -1, -1, -1, -1)
# Start Node
e = new node(e[0], e[1], -1, -1, -1, -1)
# End Node
###
Set-up Variables
###
cols = m.length - 1
rows = m[0].length - 1
o = []
c = []
mn = new Array(rows * cols)
g = 0
h = heuristic(s, e)
f = g + h
# Place start node onto list of open nodes
o.push s
# Initiate Search Loop, keep going while there are nodes in the open list
while o.length > 0
# Locate Best Node
best =
c: o[0].f
n: 0
i = 1
len = o.length
while i < len
if o[i].f < best.c
best.c = o[i].f
best.n = i
i++
# Set current to best
current = o[best.n]
# Check if end point has been reached
if current.x == e.x and current.y == e.y
path = [ {
x: e.x
y: e.y
} ]
# Create Path
# Loop back through parents to complete the path
while current.p != -1
current = c[current.p]
path.unshift
x: current.x
y: current.y
self.postMessage path
# Return the path
return true
# Remove current node from open list
o.splice best.n, 1
mn[current.x + current.y * rows * cols] = false
# Set bit to closed
c.push current
# Search new nodes in all directions
x = Math.max(0, current.x - 1)
lenx = Math.min(cols, current.x + 1)
while x <= lenx
y = Math.max(0, current.y - 1)
leny = Math.min(rows, current.y + 1)
while y <= leny
if d or diff(current.x, x) + diff(current.y, y) <= 1
# Check if location square is open
if Number(m[x][y]) == 0
# Check if square is in closed list
if mn[x + y * rows * cols] == false
y++
continue
# If square not in open list use it
if mn[x + y * rows * cols] != true
n = new node(x, y, c.length - 1, -1, -1, -1)
# Create new node
n.g = current.g + Math.floor(Math.sqrt((n.x - (current.x)) ** 2 + (n.y - (current.y)) ** 2))
n.h = heuristic(n, e)
n.f = n.g + n.h
o.push n
# Push node onto open list
mn[x + y * rows * cols] = true
# Set bit into open list
y++
x++
self.postMessage []
# No Path Found!
true
), false
| true | ###
Copyright (c) 2013 PI:NAME:<NAME>END_PI & PI:NAME:<NAME>END_PI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
###
###
Pathfind Worker
###
self.addEventListener 'message', ((evt) ->
# Initial passed values
s = evt.data.s
e = evt.data.e
m = evt.data.m
d = if evt.data.d == false then false else true
# Allow Diagonal Movement
###
Nodes -
x: x position
y: y position
p: Index of the parent node (Stored in closed array)
g: Cost from start to current node
h: Heuristic cost from current node to destination
f: Cost from start to desination going through current node
###
node = (x, y, p, g, h, f) ->
@x = x
@y = y
@p = p
@g = g
@h = h
@f = f
return
###
Heuristic - Estimated movement cost from current square to end position
###
heuristic = (current, end) ->
x = current.x - (end.x)
y = current.y - (end.y)
x ** 2 + y ** 2
###
Difference
###
diff = (a, b) ->
Math.abs if a > b then a - b else b - a
# Set-up Nodes
s = new node(s[0], s[1], -1, -1, -1, -1)
# Start Node
e = new node(e[0], e[1], -1, -1, -1, -1)
# End Node
###
Set-up Variables
###
cols = m.length - 1
rows = m[0].length - 1
o = []
c = []
mn = new Array(rows * cols)
g = 0
h = heuristic(s, e)
f = g + h
# Place start node onto list of open nodes
o.push s
# Initiate Search Loop, keep going while there are nodes in the open list
while o.length > 0
# Locate Best Node
best =
c: o[0].f
n: 0
i = 1
len = o.length
while i < len
if o[i].f < best.c
best.c = o[i].f
best.n = i
i++
# Set current to best
current = o[best.n]
# Check if end point has been reached
if current.x == e.x and current.y == e.y
path = [ {
x: e.x
y: e.y
} ]
# Create Path
# Loop back through parents to complete the path
while current.p != -1
current = c[current.p]
path.unshift
x: current.x
y: current.y
self.postMessage path
# Return the path
return true
# Remove current node from open list
o.splice best.n, 1
mn[current.x + current.y * rows * cols] = false
# Set bit to closed
c.push current
# Search new nodes in all directions
x = Math.max(0, current.x - 1)
lenx = Math.min(cols, current.x + 1)
while x <= lenx
y = Math.max(0, current.y - 1)
leny = Math.min(rows, current.y + 1)
while y <= leny
if d or diff(current.x, x) + diff(current.y, y) <= 1
# Check if location square is open
if Number(m[x][y]) == 0
# Check if square is in closed list
if mn[x + y * rows * cols] == false
y++
continue
# If square not in open list use it
if mn[x + y * rows * cols] != true
n = new node(x, y, c.length - 1, -1, -1, -1)
# Create new node
n.g = current.g + Math.floor(Math.sqrt((n.x - (current.x)) ** 2 + (n.y - (current.y)) ** 2))
n.h = heuristic(n, e)
n.f = n.g + n.h
o.push n
# Push node onto open list
mn[x + y * rows * cols] = true
# Set bit into open list
y++
x++
self.postMessage []
# No Path Found!
true
), false
|
[
{
"context": "# * http://foundation.zurb.com\n# * Copyright 2012, ZURB\n# * Free to use under the MIT license.\n# * http:",
"end": 160,
"score": 0.5246183276176453,
"start": 157,
"tag": "NAME",
"value": "ZUR"
}
] | coffee/cursorup.coffee | alejo8591/shurikend | 0 | ###
Inspired in foundation v.3.2
magellan: magellan.coffee
###
#
# * jQuery Foundation Magellan 0.1.0
# * http://foundation.zurb.com
# * Copyright 2012, ZURB
# * Free to use under the MIT license.
# * http://www.opensource.org/licenses/mit-license.php
#
#jslint unparam: true, browser: true, indent: 2
(($, window) ->
"use strict"
$.fn.Magellan = (options) ->
$window = $(window)
$document = $(document)
$fixedMagellan = $("[data-magellan-expedition=fixed]")
defaults =
threshold: (if ($fixedMagellan.length) then $fixedMagellan.outerHeight(true) else 0)
activeClass: "active"
options = $.extend({}, defaults, options)
# Indicate we have arrived at a destination
$document.on "magellan.arrival", "[data-magellan-arrival]", (e) ->
$destination = $(this)
$expedition = $destination.closest("[data-magellan-expedition]")
activeClass = $expedition.attr("data-magellan-active-class") or options.activeClass
$destination.closest("[data-magellan-expedition]").find("[data-magellan-arrival]").not(this).removeClass activeClass
$destination.addClass activeClass
# Set starting point as the current destination
$expedition = $("[data-magellan-expedition]")
$expedition.find("[data-magellan-arrival]:first").addClass $expedition.attr("data-magellan-active-class") or options.activeClass
# Update fixed position
$fixedMagellan.on("magellan.update-position", ->
$el = $(this)
$el.data "magellan-fixed-position", ""
$el.data "magellan-top-offset", ""
).trigger "magellan.update-position"
$window.on "resize.magellan", ->
$fixedMagellan.trigger "magellan.update-position"
$window.on "scroll.magellan", ->
windowScrollTop = $window.scrollTop()
$fixedMagellan.each ->
$expedition = $(this)
$expedition.data "magellan-top-offset", $expedition.offset().top if $expedition.data("magellan-top-offset") is ""
fixed_position = (windowScrollTop + options.threshold) > $expedition.data("magellan-top-offset")
unless $expedition.data("magellan-fixed-position") is fixed_position
$expedition.data "magellan-fixed-position", fixed_position
if fixed_position
$expedition.css
position: "fixed"
top: 0
else
$expedition.css
position: ""
top: ""
# Determine when a destination has been reached, ah0y!
$lastDestination = $("[data-magellan-destination]:last")
# Determine if a destination has been set
if $lastDestination.length > 0
$window.on "scroll.magellan", (e) ->
windowScrollTop = $window.scrollTop()
scrolltopPlusHeight = windowScrollTop + $window.outerHeight(true)
lastDestinationTop = Math.ceil($lastDestination.offset().top)
$("[data-magellan-destination]").each ->
$destination = $(this)
destination_name = $destination.attr("data-magellan-destination")
topOffset = $destination.offset().top - windowScrollTop
$("[data-magellan-arrival=" + destination_name + "]").trigger "magellan.arrival" if topOffset <= options.threshold
# In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
$("[data-magellan-arrival]:last").trigger "magellan.arrival" if scrolltopPlusHeight >= $document.outerHeight(true) and lastDestinationTop > windowScrollTop and lastDestinationTop < scrolltopPlusHeight
) jQuery, this
| 99421 | ###
Inspired in foundation v.3.2
magellan: magellan.coffee
###
#
# * jQuery Foundation Magellan 0.1.0
# * http://foundation.zurb.com
# * Copyright 2012, <NAME>B
# * Free to use under the MIT license.
# * http://www.opensource.org/licenses/mit-license.php
#
#jslint unparam: true, browser: true, indent: 2
(($, window) ->
"use strict"
$.fn.Magellan = (options) ->
$window = $(window)
$document = $(document)
$fixedMagellan = $("[data-magellan-expedition=fixed]")
defaults =
threshold: (if ($fixedMagellan.length) then $fixedMagellan.outerHeight(true) else 0)
activeClass: "active"
options = $.extend({}, defaults, options)
# Indicate we have arrived at a destination
$document.on "magellan.arrival", "[data-magellan-arrival]", (e) ->
$destination = $(this)
$expedition = $destination.closest("[data-magellan-expedition]")
activeClass = $expedition.attr("data-magellan-active-class") or options.activeClass
$destination.closest("[data-magellan-expedition]").find("[data-magellan-arrival]").not(this).removeClass activeClass
$destination.addClass activeClass
# Set starting point as the current destination
$expedition = $("[data-magellan-expedition]")
$expedition.find("[data-magellan-arrival]:first").addClass $expedition.attr("data-magellan-active-class") or options.activeClass
# Update fixed position
$fixedMagellan.on("magellan.update-position", ->
$el = $(this)
$el.data "magellan-fixed-position", ""
$el.data "magellan-top-offset", ""
).trigger "magellan.update-position"
$window.on "resize.magellan", ->
$fixedMagellan.trigger "magellan.update-position"
$window.on "scroll.magellan", ->
windowScrollTop = $window.scrollTop()
$fixedMagellan.each ->
$expedition = $(this)
$expedition.data "magellan-top-offset", $expedition.offset().top if $expedition.data("magellan-top-offset") is ""
fixed_position = (windowScrollTop + options.threshold) > $expedition.data("magellan-top-offset")
unless $expedition.data("magellan-fixed-position") is fixed_position
$expedition.data "magellan-fixed-position", fixed_position
if fixed_position
$expedition.css
position: "fixed"
top: 0
else
$expedition.css
position: ""
top: ""
# Determine when a destination has been reached, ah0y!
$lastDestination = $("[data-magellan-destination]:last")
# Determine if a destination has been set
if $lastDestination.length > 0
$window.on "scroll.magellan", (e) ->
windowScrollTop = $window.scrollTop()
scrolltopPlusHeight = windowScrollTop + $window.outerHeight(true)
lastDestinationTop = Math.ceil($lastDestination.offset().top)
$("[data-magellan-destination]").each ->
$destination = $(this)
destination_name = $destination.attr("data-magellan-destination")
topOffset = $destination.offset().top - windowScrollTop
$("[data-magellan-arrival=" + destination_name + "]").trigger "magellan.arrival" if topOffset <= options.threshold
# In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
$("[data-magellan-arrival]:last").trigger "magellan.arrival" if scrolltopPlusHeight >= $document.outerHeight(true) and lastDestinationTop > windowScrollTop and lastDestinationTop < scrolltopPlusHeight
) jQuery, this
| true | ###
Inspired in foundation v.3.2
magellan: magellan.coffee
###
#
# * jQuery Foundation Magellan 0.1.0
# * http://foundation.zurb.com
# * Copyright 2012, PI:NAME:<NAME>END_PIB
# * Free to use under the MIT license.
# * http://www.opensource.org/licenses/mit-license.php
#
#jslint unparam: true, browser: true, indent: 2
(($, window) ->
"use strict"
$.fn.Magellan = (options) ->
$window = $(window)
$document = $(document)
$fixedMagellan = $("[data-magellan-expedition=fixed]")
defaults =
threshold: (if ($fixedMagellan.length) then $fixedMagellan.outerHeight(true) else 0)
activeClass: "active"
options = $.extend({}, defaults, options)
# Indicate we have arrived at a destination
$document.on "magellan.arrival", "[data-magellan-arrival]", (e) ->
$destination = $(this)
$expedition = $destination.closest("[data-magellan-expedition]")
activeClass = $expedition.attr("data-magellan-active-class") or options.activeClass
$destination.closest("[data-magellan-expedition]").find("[data-magellan-arrival]").not(this).removeClass activeClass
$destination.addClass activeClass
# Set starting point as the current destination
$expedition = $("[data-magellan-expedition]")
$expedition.find("[data-magellan-arrival]:first").addClass $expedition.attr("data-magellan-active-class") or options.activeClass
# Update fixed position
$fixedMagellan.on("magellan.update-position", ->
$el = $(this)
$el.data "magellan-fixed-position", ""
$el.data "magellan-top-offset", ""
).trigger "magellan.update-position"
$window.on "resize.magellan", ->
$fixedMagellan.trigger "magellan.update-position"
$window.on "scroll.magellan", ->
windowScrollTop = $window.scrollTop()
$fixedMagellan.each ->
$expedition = $(this)
$expedition.data "magellan-top-offset", $expedition.offset().top if $expedition.data("magellan-top-offset") is ""
fixed_position = (windowScrollTop + options.threshold) > $expedition.data("magellan-top-offset")
unless $expedition.data("magellan-fixed-position") is fixed_position
$expedition.data "magellan-fixed-position", fixed_position
if fixed_position
$expedition.css
position: "fixed"
top: 0
else
$expedition.css
position: ""
top: ""
# Determine when a destination has been reached, ah0y!
$lastDestination = $("[data-magellan-destination]:last")
# Determine if a destination has been set
if $lastDestination.length > 0
$window.on "scroll.magellan", (e) ->
windowScrollTop = $window.scrollTop()
scrolltopPlusHeight = windowScrollTop + $window.outerHeight(true)
lastDestinationTop = Math.ceil($lastDestination.offset().top)
$("[data-magellan-destination]").each ->
$destination = $(this)
destination_name = $destination.attr("data-magellan-destination")
topOffset = $destination.offset().top - windowScrollTop
$("[data-magellan-arrival=" + destination_name + "]").trigger "magellan.arrival" if topOffset <= options.threshold
# In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
$("[data-magellan-arrival]:last").trigger "magellan.arrival" if scrolltopPlusHeight >= $document.outerHeight(true) and lastDestinationTop > windowScrollTop and lastDestinationTop < scrolltopPlusHeight
) jQuery, this
|
[
{
"context": "Ctrl', ($scope, playRoutes) ->\n $scope.text = \"Albert osti fagotin ja töräytti puhkuvan melodian maakun",
"end": 702,
"score": 0.9887834191322327,
"start": 696,
"tag": "NAME",
"value": "Albert"
},
{
"context": "Ctrl', ($scope, playRoutes) ->\n $scope.text = \"Al... | app/assets/javascripts/index.coffee | jiemakel/seco-lexicalanalysis-play | 5 | 'use strict'
angular.module('index',['play.routing'])
.controller('IdentifyCtrl', ($scope, playRoutes) ->
$scope.text = "The quick brown fox jumps over the lazy dog"
$scope.$watch('text', _.throttle((text) ->
playRoutes.controllers.LexicalAnalysisController.identifyGET(text).get().success((data) ->
$scope.errorStatus = ''
$scope.guessedLang=data
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('LemmatizeCtrl', ($scope, playRoutes) ->
$scope.text = "Albert osti fagotin ja töräytti puhkuvan melodian maakunnanvoudinvirastossa."
$scope.depth = "1"
$scope.guess = true
$scope.$watchCollection('[text,locale,segments,depth]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.baseformGET($scope.text,locale,$scope.segments, $scope.guess, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"), if ($scope.depth && $scope.depth!="") then $scope.depth else "1").get().success((data) ->
$scope.errorStatus = ''
$scope.baseform=data
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('AnalyzeCtrl', ($scope, playRoutes) ->
$scope.text = "Albert osti fagotin ja töräytti puhkuvan melodian."
$scope.locale = "fi"
$scope.forms = "V N Nom Sg, N Nom Pl, A Pos Nom Pl"
$scope.guess = true
$scope.segmentGuessed = true
$scope.depth = "2"
$scope.$watchCollection('[text,locale,forms,segments,depth]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.analyzeGET($scope.text,locale,$scope.forms.split(/, */),$scope.segments,$scope.guess,$scope.segmentGuessed, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"),if ($scope.depth && $scope.depth!="") then $scope.depth else "2").get().success((data) ->
$scope.analysis=data
$scope.errorStatus = ''
dta = []
for word,index in data
da = null
cw = Number.MAX_VALUE
for analysis in word.analysis when analysis.globalTags['HEAD']? && analysis.weight<cw
cw=analysis.weight
da = {
dephead:analysis.globalTags['HEAD'][0]
deprel:analysis.globalTags['DEPREL'][0]
pos:analysis.wordParts[analysis.wordParts.length-1].tags['UPOS'][0]
word:word.word
data:word
ref:""+(index+1)
}
if da!=null then dta.push(da)
draw_deptree(dta,'depanalysis',(data) -> if (data.data?.data?)
$scope.analysis=[data.data.data]
$scope.$apply()
);
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('InflectionCtrl', ($scope, playRoutes) ->
$scope.text = "Albert osti fagotin ja töräytti puhkuvan melodian."
$scope.locale = "fi"
$scope.baseform=true
$scope.guess=true
$scope.forms = "V N Nom Sg, N Nom Pl, A Pos Nom Pl"
$scope.$watchCollection('[text,locale,segments,baseform,forms]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.inflectGET($scope.text, $scope.forms.split(/, */),$scope.segments,$scope.baseform,$scope.guess, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"),locale).get().success((data) ->
$scope.inflection=data
$scope.errorStatus = ''
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('HyphenationCtrl', ($scope, playRoutes) ->
$scope.text = "Albert osti fagotin ja töräytti puhkuvan melodian."
$scope.$watchCollection('[text,locale]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.hyphenateGET($scope.text,locale).get().success((data) ->
$scope.hyphenation=data
$scope.errorStatus = ''
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
| 12199 | 'use strict'
angular.module('index',['play.routing'])
.controller('IdentifyCtrl', ($scope, playRoutes) ->
$scope.text = "The quick brown fox jumps over the lazy dog"
$scope.$watch('text', _.throttle((text) ->
playRoutes.controllers.LexicalAnalysisController.identifyGET(text).get().success((data) ->
$scope.errorStatus = ''
$scope.guessedLang=data
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('LemmatizeCtrl', ($scope, playRoutes) ->
$scope.text = "<NAME> osti fagotin ja töräytti puhkuvan melodian maakunnanvoudinvirastossa."
$scope.depth = "1"
$scope.guess = true
$scope.$watchCollection('[text,locale,segments,depth]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.baseformGET($scope.text,locale,$scope.segments, $scope.guess, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"), if ($scope.depth && $scope.depth!="") then $scope.depth else "1").get().success((data) ->
$scope.errorStatus = ''
$scope.baseform=data
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('AnalyzeCtrl', ($scope, playRoutes) ->
$scope.text = "<NAME> osti fagotin ja töräytti puhkuvan melodian."
$scope.locale = "fi"
$scope.forms = "V N Nom Sg, N Nom Pl, A Pos Nom Pl"
$scope.guess = true
$scope.segmentGuessed = true
$scope.depth = "2"
$scope.$watchCollection('[text,locale,forms,segments,depth]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.analyzeGET($scope.text,locale,$scope.forms.split(/, */),$scope.segments,$scope.guess,$scope.segmentGuessed, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"),if ($scope.depth && $scope.depth!="") then $scope.depth else "2").get().success((data) ->
$scope.analysis=data
$scope.errorStatus = ''
dta = []
for word,index in data
da = null
cw = Number.MAX_VALUE
for analysis in word.analysis when analysis.globalTags['HEAD']? && analysis.weight<cw
cw=analysis.weight
da = {
dephead:analysis.globalTags['HEAD'][0]
deprel:analysis.globalTags['DEPREL'][0]
pos:analysis.wordParts[analysis.wordParts.length-1].tags['UPOS'][0]
word:word.word
data:word
ref:""+(index+1)
}
if da!=null then dta.push(da)
draw_deptree(dta,'depanalysis',(data) -> if (data.data?.data?)
$scope.analysis=[data.data.data]
$scope.$apply()
);
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('InflectionCtrl', ($scope, playRoutes) ->
$scope.text = "Albert osti fagotin ja töräytti puhkuvan melodian."
$scope.locale = "fi"
$scope.baseform=true
$scope.guess=true
$scope.forms = "V N Nom Sg, N Nom Pl, A Pos Nom Pl"
$scope.$watchCollection('[text,locale,segments,baseform,forms]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.inflectGET($scope.text, $scope.forms.split(/, */),$scope.segments,$scope.baseform,$scope.guess, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"),locale).get().success((data) ->
$scope.inflection=data
$scope.errorStatus = ''
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('HyphenationCtrl', ($scope, playRoutes) ->
$scope.text = "<NAME> osti fagotin ja töräytti puhkuvan melodian."
$scope.$watchCollection('[text,locale]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.hyphenateGET($scope.text,locale).get().success((data) ->
$scope.hyphenation=data
$scope.errorStatus = ''
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
| true | 'use strict'
angular.module('index',['play.routing'])
.controller('IdentifyCtrl', ($scope, playRoutes) ->
$scope.text = "The quick brown fox jumps over the lazy dog"
$scope.$watch('text', _.throttle((text) ->
playRoutes.controllers.LexicalAnalysisController.identifyGET(text).get().success((data) ->
$scope.errorStatus = ''
$scope.guessedLang=data
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('LemmatizeCtrl', ($scope, playRoutes) ->
$scope.text = "PI:NAME:<NAME>END_PI osti fagotin ja töräytti puhkuvan melodian maakunnanvoudinvirastossa."
$scope.depth = "1"
$scope.guess = true
$scope.$watchCollection('[text,locale,segments,depth]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.baseformGET($scope.text,locale,$scope.segments, $scope.guess, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"), if ($scope.depth && $scope.depth!="") then $scope.depth else "1").get().success((data) ->
$scope.errorStatus = ''
$scope.baseform=data
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('AnalyzeCtrl', ($scope, playRoutes) ->
$scope.text = "PI:NAME:<NAME>END_PI osti fagotin ja töräytti puhkuvan melodian."
$scope.locale = "fi"
$scope.forms = "V N Nom Sg, N Nom Pl, A Pos Nom Pl"
$scope.guess = true
$scope.segmentGuessed = true
$scope.depth = "2"
$scope.$watchCollection('[text,locale,forms,segments,depth]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.analyzeGET($scope.text,locale,$scope.forms.split(/, */),$scope.segments,$scope.guess,$scope.segmentGuessed, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"),if ($scope.depth && $scope.depth!="") then $scope.depth else "2").get().success((data) ->
$scope.analysis=data
$scope.errorStatus = ''
dta = []
for word,index in data
da = null
cw = Number.MAX_VALUE
for analysis in word.analysis when analysis.globalTags['HEAD']? && analysis.weight<cw
cw=analysis.weight
da = {
dephead:analysis.globalTags['HEAD'][0]
deprel:analysis.globalTags['DEPREL'][0]
pos:analysis.wordParts[analysis.wordParts.length-1].tags['UPOS'][0]
word:word.word
data:word
ref:""+(index+1)
}
if da!=null then dta.push(da)
draw_deptree(dta,'depanalysis',(data) -> if (data.data?.data?)
$scope.analysis=[data.data.data]
$scope.$apply()
);
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('InflectionCtrl', ($scope, playRoutes) ->
$scope.text = "Albert osti fagotin ja töräytti puhkuvan melodian."
$scope.locale = "fi"
$scope.baseform=true
$scope.guess=true
$scope.forms = "V N Nom Sg, N Nom Pl, A Pos Nom Pl"
$scope.$watchCollection('[text,locale,segments,baseform,forms]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.inflectGET($scope.text, $scope.forms.split(/, */),$scope.segments,$scope.baseform,$scope.guess, (if ($scope.maxEditDistance && $scope.maxEditDistance!="") then $scope.maxEditDistance else "0"),locale).get().success((data) ->
$scope.inflection=data
$scope.errorStatus = ''
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
.controller('HyphenationCtrl', ($scope, playRoutes) ->
$scope.text = "PI:NAME:<NAME>END_PI osti fagotin ja töräytti puhkuvan melodian."
$scope.$watchCollection('[text,locale]', _.throttle(() ->
locale = $scope.locale
if locale=='' then locale=null
playRoutes.controllers.LexicalAnalysisController.hyphenateGET($scope.text,locale).get().success((data) ->
$scope.hyphenation=data
$scope.errorStatus = ''
).error((data,status) ->
if (status==0)
$scope.errorStatus = 503
$scope.error = "Service unavailable"
else
$scope.errorStatus = status
$scope.error = data
)
,1000))
)
|
[
{
"context": ".891762199999999 ]).addTo(map)\n .bindPopup('<b>Steinmühle Lemgo</b><br /> Entruper Weg 88 <br />32657 Lemgo')\n ",
"end": 329,
"score": 0.9995922446250916,
"start": 313,
"tag": "NAME",
"value": "Steinmühle Lemgo"
}
] | source/javascripts/leaflet.coffee | steinmuehle/stm | 0 | onMapClick = (e) ->
map = L.map("map").setView([ 52.0420556802915, 8.8904132197084979 ], 13)
map.scrollWheelZoom.disable()
baseLayers = [ "OpenStreetMap.DE" ]
layerControl = L.control.layers.provided(baseLayers).addTo(map)
marker = L.marker([ 52.0407066999999, 8.891762199999999 ]).addTo(map)
.bindPopup('<b>Steinmühle Lemgo</b><br /> Entruper Weg 88 <br />32657 Lemgo')
.openPopup();
| 170817 | onMapClick = (e) ->
map = L.map("map").setView([ 52.0420556802915, 8.8904132197084979 ], 13)
map.scrollWheelZoom.disable()
baseLayers = [ "OpenStreetMap.DE" ]
layerControl = L.control.layers.provided(baseLayers).addTo(map)
marker = L.marker([ 52.0407066999999, 8.891762199999999 ]).addTo(map)
.bindPopup('<b><NAME></b><br /> Entruper Weg 88 <br />32657 Lemgo')
.openPopup();
| true | onMapClick = (e) ->
map = L.map("map").setView([ 52.0420556802915, 8.8904132197084979 ], 13)
map.scrollWheelZoom.disable()
baseLayers = [ "OpenStreetMap.DE" ]
layerControl = L.control.layers.provided(baseLayers).addTo(map)
marker = L.marker([ 52.0407066999999, 8.891762199999999 ]).addTo(map)
.bindPopup('<b>PI:NAME:<NAME>END_PI</b><br /> Entruper Weg 88 <br />32657 Lemgo')
.openPopup();
|
[
{
"context": " id: \"m_3\"\n threadID: \"t_1\"\n threadName: \"Jing and Bill\"\n authorName: \"Jing\"\n text: \"Sounds good. ",
"end": 78,
"score": 0.9983032941818237,
"start": 65,
"tag": "NAME",
"value": "Jing and Bill"
},
{
"context": "\n threadName: \"Jing and Bi... | src/client/chat/thread/item/thread-item-directive_test.coffee | DavidSouther/song-flux-chat | 1 | lastMessage =
id: "m_3"
threadID: "t_1"
threadName: "Jing and Bill"
authorName: "Jing"
text: "Sounds good. Will they be serving dessert?"
timestamp: 1419135814671
isRead: true
lastMessage.date = new Date lastMessage.timestamp
thread = {
id: "t_1"
name: "Jing and Bill"
lastMessage
}
describe 'ThreadItemDirective', ->
sut = null
beforeEach module 'song.chat.thread.item.directive'
beforeEach module ($exceptionHandlerProvider)->
$exceptionHandlerProvider.mode('log')
return false
describe 'ThreadItemController', ->
beforeEach inject ($controller)->
$el = renderElement 'thread-item',
{ thread: thread }, # data
{ thread: 'thread', key: 't_1', 'current-thread-id': 't_1' } #HTML Attrs
sut = $el.isolateScope().state
it 'manages a thread', ->
sut.key.should.equal 't_1'
sut.currentThreadId.should.equal 't_1'
sut.lastMessage.id.should.equal lastMessage.id
it 'generates click actions', inject (
songDispatcherFactory,
Actions
)->
clickedId = 'bad_id'
songDispatcherFactory.get('song.chat')
.register Actions.Click, (click)->
clickedId = click.threadID
sut.clickThread()
clickedId.should.equal 't_1'
describe 'rendering', ->
beforeEach ->
sut = renderElement 'thread-item',
{ thread: thread, key: 't_1', currentThreadID: 't_1' },
{ thread: 'thread', key: 'key', 'current-thread-id': 'currentThreadID' }
it 'shows thread details', ->
name = sut[0].querySelector('.thread-name').innerText
time = sut[0].querySelector('.thread-time').innerText
message = sut[0].querySelector('.thread-last-message').innerText
name.should.equal thread.name
message.should.match /dessert\?/
time.length.should.be.greaterThan 2
| 131083 | lastMessage =
id: "m_3"
threadID: "t_1"
threadName: "<NAME>"
authorName: "<NAME>"
text: "Sounds good. Will they be serving dessert?"
timestamp: 1419135814671
isRead: true
lastMessage.date = new Date lastMessage.timestamp
thread = {
id: "t_1"
name: "<NAME>"
lastMessage
}
describe 'ThreadItemDirective', ->
sut = null
beforeEach module 'song.chat.thread.item.directive'
beforeEach module ($exceptionHandlerProvider)->
$exceptionHandlerProvider.mode('log')
return false
describe 'ThreadItemController', ->
beforeEach inject ($controller)->
$el = renderElement 'thread-item',
{ thread: thread }, # data
{ thread: 'thread', key: '<KEY>', 'current-thread-id': 't_1' } #HTML Attrs
sut = $el.isolateScope().state
it 'manages a thread', ->
sut.key.should.equal '<KEY>'
sut.currentThreadId.should.equal 't_1'
sut.lastMessage.id.should.equal lastMessage.id
it 'generates click actions', inject (
songDispatcherFactory,
Actions
)->
clickedId = 'bad_id'
songDispatcherFactory.get('song.chat')
.register Actions.Click, (click)->
clickedId = click.threadID
sut.clickThread()
clickedId.should.equal 't_1'
describe 'rendering', ->
beforeEach ->
sut = renderElement 'thread-item',
{ thread: thread, key: '<KEY>', currentThreadID: 't_1' },
{ thread: 'thread', key: 'key', 'current-thread-id': 'currentThreadID' }
it 'shows thread details', ->
name = sut[0].querySelector('.thread-name').innerText
time = sut[0].querySelector('.thread-time').innerText
message = sut[0].querySelector('.thread-last-message').innerText
name.should.equal thread.name
message.should.match /dessert\?/
time.length.should.be.greaterThan 2
| true | lastMessage =
id: "m_3"
threadID: "t_1"
threadName: "PI:NAME:<NAME>END_PI"
authorName: "PI:NAME:<NAME>END_PI"
text: "Sounds good. Will they be serving dessert?"
timestamp: 1419135814671
isRead: true
lastMessage.date = new Date lastMessage.timestamp
thread = {
id: "t_1"
name: "PI:NAME:<NAME>END_PI"
lastMessage
}
describe 'ThreadItemDirective', ->
sut = null
beforeEach module 'song.chat.thread.item.directive'
beforeEach module ($exceptionHandlerProvider)->
$exceptionHandlerProvider.mode('log')
return false
describe 'ThreadItemController', ->
beforeEach inject ($controller)->
$el = renderElement 'thread-item',
{ thread: thread }, # data
{ thread: 'thread', key: 'PI:KEY:<KEY>END_PI', 'current-thread-id': 't_1' } #HTML Attrs
sut = $el.isolateScope().state
it 'manages a thread', ->
sut.key.should.equal 'PI:KEY:<KEY>END_PI'
sut.currentThreadId.should.equal 't_1'
sut.lastMessage.id.should.equal lastMessage.id
it 'generates click actions', inject (
songDispatcherFactory,
Actions
)->
clickedId = 'bad_id'
songDispatcherFactory.get('song.chat')
.register Actions.Click, (click)->
clickedId = click.threadID
sut.clickThread()
clickedId.should.equal 't_1'
describe 'rendering', ->
beforeEach ->
sut = renderElement 'thread-item',
{ thread: thread, key: 'PI:KEY:<KEY>END_PI', currentThreadID: 't_1' },
{ thread: 'thread', key: 'key', 'current-thread-id': 'currentThreadID' }
it 'shows thread details', ->
name = sut[0].querySelector('.thread-name').innerText
time = sut[0].querySelector('.thread-time').innerText
message = sut[0].querySelector('.thread-last-message').innerText
name.should.equal thread.name
message.should.match /dessert\?/
time.length.should.be.greaterThan 2
|
[
{
"context": "###\n# scripts/directives/style.coffee\n#\n# © 2014 Dan Nichols\n# See LICENSE for more details\n###\n'use strict'\n\n",
"end": 60,
"score": 0.9995724558830261,
"start": 49,
"tag": "NAME",
"value": "Dan Nichols"
}
] | app/scripts/directives/styler.coffee | dlnichols/h_media | 0 | ###
# scripts/directives/style.coffee
#
# © 2014 Dan Nichols
# See LICENSE for more details
###
'use strict'
angular.module 'hMediaApp'
.constant 'styles',
default: 'Slate'
available: [
'Amelia'
'Cerulean'
'Cosmo'
'Cyborg'
'Flatly'
'Journal'
'Lumen'
'Readable'
'Simplex'
'Slate'
'Spacelab'
'Standard'
'Superhero'
'United'
'Yeti'
]
.controller 'styleController', ($scope, styles) ->
# Grab the style from localStorage
currentStyle = localStorage.style || styles.default
# Check whether the style actually exists
isAvailableStyle = (style) ->
styles.available.indexOf(style) >= 0
# If it doesn't exist, use the default
unless isAvailableStyle currentStyle
currentStyle = styles.default
localStorage.removeItem 'style'
# Set the available styles
$scope.styles = styles.available
# Derive the stylesheet URI from the name
$scope.currentStylesheet = ->
'/styles/bootstrap.' + currentStyle.toLowerCase() + '.css'
# Change the stylesheet when selected from the dropdown
$scope.changeStyle = (newStyle) ->
if isAvailableStyle newStyle
currentStyle = newStyle
localStorage.style = newStyle
.directive 'styler', ->
restrict: 'E'
template: '\
<ul class="nav navbar-nav">
<li dropdown>
<a dropdown-toggle>Themes <b class="caret"></b></a>
<ul class="dropdown-menu">
<li ng-repeat="style in styles"><a ng-click="changeStyle(style)">{{style}}</a></li>
</ul>
</li>
</ul>'
| 26101 | ###
# scripts/directives/style.coffee
#
# © 2014 <NAME>
# See LICENSE for more details
###
'use strict'
angular.module 'hMediaApp'
.constant 'styles',
default: 'Slate'
available: [
'Amelia'
'Cerulean'
'Cosmo'
'Cyborg'
'Flatly'
'Journal'
'Lumen'
'Readable'
'Simplex'
'Slate'
'Spacelab'
'Standard'
'Superhero'
'United'
'Yeti'
]
.controller 'styleController', ($scope, styles) ->
# Grab the style from localStorage
currentStyle = localStorage.style || styles.default
# Check whether the style actually exists
isAvailableStyle = (style) ->
styles.available.indexOf(style) >= 0
# If it doesn't exist, use the default
unless isAvailableStyle currentStyle
currentStyle = styles.default
localStorage.removeItem 'style'
# Set the available styles
$scope.styles = styles.available
# Derive the stylesheet URI from the name
$scope.currentStylesheet = ->
'/styles/bootstrap.' + currentStyle.toLowerCase() + '.css'
# Change the stylesheet when selected from the dropdown
$scope.changeStyle = (newStyle) ->
if isAvailableStyle newStyle
currentStyle = newStyle
localStorage.style = newStyle
.directive 'styler', ->
restrict: 'E'
template: '\
<ul class="nav navbar-nav">
<li dropdown>
<a dropdown-toggle>Themes <b class="caret"></b></a>
<ul class="dropdown-menu">
<li ng-repeat="style in styles"><a ng-click="changeStyle(style)">{{style}}</a></li>
</ul>
</li>
</ul>'
| true | ###
# scripts/directives/style.coffee
#
# © 2014 PI:NAME:<NAME>END_PI
# See LICENSE for more details
###
'use strict'
angular.module 'hMediaApp'
.constant 'styles',
default: 'Slate'
available: [
'Amelia'
'Cerulean'
'Cosmo'
'Cyborg'
'Flatly'
'Journal'
'Lumen'
'Readable'
'Simplex'
'Slate'
'Spacelab'
'Standard'
'Superhero'
'United'
'Yeti'
]
.controller 'styleController', ($scope, styles) ->
# Grab the style from localStorage
currentStyle = localStorage.style || styles.default
# Check whether the style actually exists
isAvailableStyle = (style) ->
styles.available.indexOf(style) >= 0
# If it doesn't exist, use the default
unless isAvailableStyle currentStyle
currentStyle = styles.default
localStorage.removeItem 'style'
# Set the available styles
$scope.styles = styles.available
# Derive the stylesheet URI from the name
$scope.currentStylesheet = ->
'/styles/bootstrap.' + currentStyle.toLowerCase() + '.css'
# Change the stylesheet when selected from the dropdown
$scope.changeStyle = (newStyle) ->
if isAvailableStyle newStyle
currentStyle = newStyle
localStorage.style = newStyle
.directive 'styler', ->
restrict: 'E'
template: '\
<ul class="nav navbar-nav">
<li dropdown>
<a dropdown-toggle>Themes <b class="caret"></b></a>
<ul class="dropdown-menu">
<li ng-repeat="style in styles"><a ng-click="changeStyle(style)">{{style}}</a></li>
</ul>
</li>
</ul>'
|
[
{
"context": "# ------\n# SOUNDCRAFT\n# Adam Marshall\n# Josef Witchell\n# © 2015\n# ------\n\ngulp ",
"end": 37,
"score": 0.9996656775474548,
"start": 24,
"tag": "NAME",
"value": "Adam Marshall"
},
{
"context": "# ------\n# SOUNDCRAFT\n# Adam Marshall\n# Josef Witchell\n# &c... | app/templates/Gulpfile.coffee | AppSynergy/generator-gulp-coffee-compass | 0 | # ------
# SOUNDCRAFT
# Adam Marshall
# Josef Witchell
# © 2015
# ------
gulp = require 'gulp'
coffee = require 'gulp-coffee'
watch = require 'gulp-watch'
serve = require 'gulp-serve'
clean = require 'gulp-clean'
uglify = require 'gulp-uglify'
compass = require 'gulp-compass'
swig = require 'gulp-swig'
data = require 'gulp-data'
# Data for swig
defaultData = (file) ->
return require('./src/data/default.json')
# boilerplatey Route class and chain methods
Route = require('./Gulproute.coffee').Route
# source files
src = {
html: 'src/*.html'
coffee: 'src/coffee/{,**/}*.coffee',
sass: 'src/sass/{,**}*.sass',
bower: {
js: 'bower_components/*/dist/{,js/}*.min.{map,js}',
css: 'bower_components/*/dist/css/*.min.{map,css}',
}
}
# options
opts = {
svg: {
full: true,
plugins: [
{cleanupIDs: false},
{removeDoctype: true},
{removeMetadata: true},
{removeXMLProcInst: true},
{removeViewBox: true}
]
},
sass: {
config_file: 'src/sass/config.rb',
sass: 'src/sass',
css: 'public/css'
}
swig: {
load_json: true,
defaults: {
cache: false,
locals: {
site_name: "<%= appName %>"
}
}
}
}
# TYPICAL TASKS
# -------------
# default task compiles for distribution
gulp.task 'default', ['deps', 'html', 'coffee', 'sass']
# dev task runs dev versions of build tasks, watches for changes, and runs a server
gulp.task 'dev', ['serve', 'html', 'sass', 'coffee-dev', 'watch']
# DEVELOPMENT TASKS
# -----------------
gulp.task 'serve', serve('public')
gulp.task 'watch', ->
gulp.watch src.html, ['html']
gulp.watch src.coffee, ['coffee-dev']
gulp.watch src.sass, ['sass']
# WATCHED TASKS
# -------------
gulp.task 'html', ->
a = new Route src.html, './public/', "Swigging html files.."
a.chain [data(defaultData), swig(opts.swig)]
gulp.task 'coffee', ->
a = new Route src.coffee, 'public/js/', "Compiling coffeescipt and uglifying js.."
a.chain [coffee(),uglify()]
gulp.task 'coffee-dev', ->
a = new Route src.coffee, 'public/js/', "Compiling dev coffeescipt.."
a.chain [coffee({bare: true})]
gulp.task 'sass', ->
a = new Route src.sass, 'public/css/', "Compiling sass to css.."
a.chain [compass(opts.sass)], false
# DEPENDANCY TASKS
# ----------------
gulp.task 'deps', ['bower'] # add more dependancy tasks here
gulp.task 'bower', ->
a = new Route src.bower.css, 'public/css/', "Compiling bower css assets.."
a.chain []
b = new Route src.bower.js, 'public/js/', "Compiling bower js assets.."
b.chain []
# CLEAN TASK
# ----------
gulp.task 'clean', ->
gulp.src('public/*', {read: false}).pipe(clean())
| 14576 | # ------
# SOUNDCRAFT
# <NAME>
# <NAME>
# © 2015
# ------
gulp = require 'gulp'
coffee = require 'gulp-coffee'
watch = require 'gulp-watch'
serve = require 'gulp-serve'
clean = require 'gulp-clean'
uglify = require 'gulp-uglify'
compass = require 'gulp-compass'
swig = require 'gulp-swig'
data = require 'gulp-data'
# Data for swig
defaultData = (file) ->
return require('./src/data/default.json')
# boilerplatey Route class and chain methods
Route = require('./Gulproute.coffee').Route
# source files
src = {
html: 'src/*.html'
coffee: 'src/coffee/{,**/}*.coffee',
sass: 'src/sass/{,**}*.sass',
bower: {
js: 'bower_components/*/dist/{,js/}*.min.{map,js}',
css: 'bower_components/*/dist/css/*.min.{map,css}',
}
}
# options
opts = {
svg: {
full: true,
plugins: [
{cleanupIDs: false},
{removeDoctype: true},
{removeMetadata: true},
{removeXMLProcInst: true},
{removeViewBox: true}
]
},
sass: {
config_file: 'src/sass/config.rb',
sass: 'src/sass',
css: 'public/css'
}
swig: {
load_json: true,
defaults: {
cache: false,
locals: {
site_name: "<%= appName %>"
}
}
}
}
# TYPICAL TASKS
# -------------
# default task compiles for distribution
gulp.task 'default', ['deps', 'html', 'coffee', 'sass']
# dev task runs dev versions of build tasks, watches for changes, and runs a server
gulp.task 'dev', ['serve', 'html', 'sass', 'coffee-dev', 'watch']
# DEVELOPMENT TASKS
# -----------------
gulp.task 'serve', serve('public')
gulp.task 'watch', ->
gulp.watch src.html, ['html']
gulp.watch src.coffee, ['coffee-dev']
gulp.watch src.sass, ['sass']
# WATCHED TASKS
# -------------
gulp.task 'html', ->
a = new Route src.html, './public/', "Swigging html files.."
a.chain [data(defaultData), swig(opts.swig)]
gulp.task 'coffee', ->
a = new Route src.coffee, 'public/js/', "Compiling coffeescipt and uglifying js.."
a.chain [coffee(),uglify()]
gulp.task 'coffee-dev', ->
a = new Route src.coffee, 'public/js/', "Compiling dev coffeescipt.."
a.chain [coffee({bare: true})]
gulp.task 'sass', ->
a = new Route src.sass, 'public/css/', "Compiling sass to css.."
a.chain [compass(opts.sass)], false
# DEPENDANCY TASKS
# ----------------
gulp.task 'deps', ['bower'] # add more dependancy tasks here
gulp.task 'bower', ->
a = new Route src.bower.css, 'public/css/', "Compiling bower css assets.."
a.chain []
b = new Route src.bower.js, 'public/js/', "Compiling bower js assets.."
b.chain []
# CLEAN TASK
# ----------
gulp.task 'clean', ->
gulp.src('public/*', {read: false}).pipe(clean())
| true | # ------
# SOUNDCRAFT
# PI:NAME:<NAME>END_PI
# PI:NAME:<NAME>END_PI
# © 2015
# ------
gulp = require 'gulp'
coffee = require 'gulp-coffee'
watch = require 'gulp-watch'
serve = require 'gulp-serve'
clean = require 'gulp-clean'
uglify = require 'gulp-uglify'
compass = require 'gulp-compass'
swig = require 'gulp-swig'
data = require 'gulp-data'
# Data for swig
defaultData = (file) ->
return require('./src/data/default.json')
# boilerplatey Route class and chain methods
Route = require('./Gulproute.coffee').Route
# source files
src = {
html: 'src/*.html'
coffee: 'src/coffee/{,**/}*.coffee',
sass: 'src/sass/{,**}*.sass',
bower: {
js: 'bower_components/*/dist/{,js/}*.min.{map,js}',
css: 'bower_components/*/dist/css/*.min.{map,css}',
}
}
# options
opts = {
svg: {
full: true,
plugins: [
{cleanupIDs: false},
{removeDoctype: true},
{removeMetadata: true},
{removeXMLProcInst: true},
{removeViewBox: true}
]
},
sass: {
config_file: 'src/sass/config.rb',
sass: 'src/sass',
css: 'public/css'
}
swig: {
load_json: true,
defaults: {
cache: false,
locals: {
site_name: "<%= appName %>"
}
}
}
}
# TYPICAL TASKS
# -------------
# default task compiles for distribution
gulp.task 'default', ['deps', 'html', 'coffee', 'sass']
# dev task runs dev versions of build tasks, watches for changes, and runs a server
gulp.task 'dev', ['serve', 'html', 'sass', 'coffee-dev', 'watch']
# DEVELOPMENT TASKS
# -----------------
gulp.task 'serve', serve('public')
gulp.task 'watch', ->
gulp.watch src.html, ['html']
gulp.watch src.coffee, ['coffee-dev']
gulp.watch src.sass, ['sass']
# WATCHED TASKS
# -------------
gulp.task 'html', ->
a = new Route src.html, './public/', "Swigging html files.."
a.chain [data(defaultData), swig(opts.swig)]
gulp.task 'coffee', ->
a = new Route src.coffee, 'public/js/', "Compiling coffeescipt and uglifying js.."
a.chain [coffee(),uglify()]
gulp.task 'coffee-dev', ->
a = new Route src.coffee, 'public/js/', "Compiling dev coffeescipt.."
a.chain [coffee({bare: true})]
gulp.task 'sass', ->
a = new Route src.sass, 'public/css/', "Compiling sass to css.."
a.chain [compass(opts.sass)], false
# DEPENDANCY TASKS
# ----------------
gulp.task 'deps', ['bower'] # add more dependancy tasks here
gulp.task 'bower', ->
a = new Route src.bower.css, 'public/css/', "Compiling bower css assets.."
a.chain []
b = new Route src.bower.js, 'public/js/', "Compiling bower js assets.."
b.chain []
# CLEAN TASK
# ----------
gulp.task 'clean', ->
gulp.src('public/*', {read: false}).pipe(clean())
|
[
{
"context": "# Copyright Joyent, Inc. and other Node contributors.\n#\n# Permission",
"end": 18,
"score": 0.9988296627998352,
"start": 12,
"tag": "NAME",
"value": "Joyent"
}
] | test/simple/test-vm-context.coffee | lxe/io.coffee | 0 | # Copyright Joyent, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
vm = require("vm")
Script = vm.Script
script = new Script("\"passed\";")
console.error "run in a new empty context"
context = vm.createContext()
result = script.runInContext(context)
assert.equal "passed", result
console.error "create a new pre-populated context"
context = vm.createContext(
foo: "bar"
thing: "lala"
)
assert.equal "bar", context.foo
assert.equal "lala", context.thing
console.error "test updating context"
script = new Script("foo = 3;")
result = script.runInContext(context)
assert.equal 3, context.foo
assert.equal "lala", context.thing
# Issue GH-227:
assert.throws (->
vm.runInNewContext "", null, "some.js"
return
), TypeError
# Issue GH-1140:
console.error "test runInContext signature"
gh1140Exception = undefined
try
vm.runInContext "throw new Error()", context, "expected-filename.js"
catch e
gh1140Exception = e
assert.ok /expected-filename/.test(e.stack), "expected appearance of filename in Error stack"
assert.ok gh1140Exception, "expected exception from runInContext signature test"
# GH-558, non-context argument segfaults / raises assertion
[
`undefined`
null
0
0.0
""
{
{}
}
[]
].forEach (e) ->
assert.throws (->
script.runInContext e
return
), TypeError
assert.throws (->
vm.runInContext "", e
return
), TypeError
return
# Issue GH-693:
console.error "test RegExp as argument to assert.throws"
script = vm.createScript("var assert = require('assert'); assert.throws(" + "function() { throw \"hello world\"; }, /hello/);", "some.js")
script.runInNewContext require: require
# Issue GH-7529
script = vm.createScript("delete b")
ctx = {}
Object.defineProperty ctx, "b",
configurable: false
ctx = vm.createContext(ctx)
assert.equal script.runInContext(ctx), false
| 17561 | # Copyright <NAME>, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
vm = require("vm")
Script = vm.Script
script = new Script("\"passed\";")
console.error "run in a new empty context"
context = vm.createContext()
result = script.runInContext(context)
assert.equal "passed", result
console.error "create a new pre-populated context"
context = vm.createContext(
foo: "bar"
thing: "lala"
)
assert.equal "bar", context.foo
assert.equal "lala", context.thing
console.error "test updating context"
script = new Script("foo = 3;")
result = script.runInContext(context)
assert.equal 3, context.foo
assert.equal "lala", context.thing
# Issue GH-227:
assert.throws (->
vm.runInNewContext "", null, "some.js"
return
), TypeError
# Issue GH-1140:
console.error "test runInContext signature"
gh1140Exception = undefined
try
vm.runInContext "throw new Error()", context, "expected-filename.js"
catch e
gh1140Exception = e
assert.ok /expected-filename/.test(e.stack), "expected appearance of filename in Error stack"
assert.ok gh1140Exception, "expected exception from runInContext signature test"
# GH-558, non-context argument segfaults / raises assertion
[
`undefined`
null
0
0.0
""
{
{}
}
[]
].forEach (e) ->
assert.throws (->
script.runInContext e
return
), TypeError
assert.throws (->
vm.runInContext "", e
return
), TypeError
return
# Issue GH-693:
console.error "test RegExp as argument to assert.throws"
script = vm.createScript("var assert = require('assert'); assert.throws(" + "function() { throw \"hello world\"; }, /hello/);", "some.js")
script.runInNewContext require: require
# Issue GH-7529
script = vm.createScript("delete b")
ctx = {}
Object.defineProperty ctx, "b",
configurable: false
ctx = vm.createContext(ctx)
assert.equal script.runInContext(ctx), false
| true | # Copyright PI:NAME:<NAME>END_PI, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
common = require("../common")
assert = require("assert")
vm = require("vm")
Script = vm.Script
script = new Script("\"passed\";")
console.error "run in a new empty context"
context = vm.createContext()
result = script.runInContext(context)
assert.equal "passed", result
console.error "create a new pre-populated context"
context = vm.createContext(
foo: "bar"
thing: "lala"
)
assert.equal "bar", context.foo
assert.equal "lala", context.thing
console.error "test updating context"
script = new Script("foo = 3;")
result = script.runInContext(context)
assert.equal 3, context.foo
assert.equal "lala", context.thing
# Issue GH-227:
assert.throws (->
vm.runInNewContext "", null, "some.js"
return
), TypeError
# Issue GH-1140:
console.error "test runInContext signature"
gh1140Exception = undefined
try
vm.runInContext "throw new Error()", context, "expected-filename.js"
catch e
gh1140Exception = e
assert.ok /expected-filename/.test(e.stack), "expected appearance of filename in Error stack"
assert.ok gh1140Exception, "expected exception from runInContext signature test"
# GH-558, non-context argument segfaults / raises assertion
[
`undefined`
null
0
0.0
""
{
{}
}
[]
].forEach (e) ->
assert.throws (->
script.runInContext e
return
), TypeError
assert.throws (->
vm.runInContext "", e
return
), TypeError
return
# Issue GH-693:
console.error "test RegExp as argument to assert.throws"
script = vm.createScript("var assert = require('assert'); assert.throws(" + "function() { throw \"hello world\"; }, /hello/);", "some.js")
script.runInNewContext require: require
# Issue GH-7529
script = vm.createScript("delete b")
ctx = {}
Object.defineProperty ctx, "b",
configurable: false
ctx = vm.createContext(ctx)
assert.equal script.runInContext(ctx), false
|
[
{
"context": "Animation Set\n# Manages a set of Animations\n#\n# by Isaac Weinhausen\n# http://isaacw.com\n\n\nclass exports.AnimationSet ",
"end": 69,
"score": 0.9998706579208374,
"start": 53,
"tag": "NAME",
"value": "Isaac Weinhausen"
}
] | examples/mixed-collections.framer/modules/AnimationSet.coffee | ekfuhrmann/framer-animation-collections | 0 | # Animation Set
# Manages a set of Animations
#
# by Isaac Weinhausen
# http://isaacw.com
class exports.AnimationSet extends Framer.EventEmitter
constructor: (options = {}) ->
@_animationsArray = []
@add(animation) for k, animation of options.animations
@repeat = options.repeat ? false
add: (animation) =>
# Ensure the animation is stopped (needed when passed via the layer.animate method)
animation.stop()
# Have the animation track its animating state
animation.isAnimatingCheck = false
animation.on Events.AnimationEnd, =>
animation.isAnimatingCheck = false
@_update()
@_animationsArray.push animation
_update: () =>
# Have all animations stopped?
if not @isAnimatingCheck()
if @repeat
@start()
else
@emit Events.AnimationEnd
isAnimatingCheck: =>
_.some(@_animationsArray, "isAnimatingCheck", true)
start: =>
for animation in @_animationsArray
animation.start()
animation.isAnimatingCheck = true
@emit Events.AnimationStart
stop: =>
for animation in @_animationsArray
animation.stop()
animation.isAnimatingCheck = false
@emit Events.AnimationStop | 123189 | # Animation Set
# Manages a set of Animations
#
# by <NAME>
# http://isaacw.com
class exports.AnimationSet extends Framer.EventEmitter
constructor: (options = {}) ->
@_animationsArray = []
@add(animation) for k, animation of options.animations
@repeat = options.repeat ? false
add: (animation) =>
# Ensure the animation is stopped (needed when passed via the layer.animate method)
animation.stop()
# Have the animation track its animating state
animation.isAnimatingCheck = false
animation.on Events.AnimationEnd, =>
animation.isAnimatingCheck = false
@_update()
@_animationsArray.push animation
_update: () =>
# Have all animations stopped?
if not @isAnimatingCheck()
if @repeat
@start()
else
@emit Events.AnimationEnd
isAnimatingCheck: =>
_.some(@_animationsArray, "isAnimatingCheck", true)
start: =>
for animation in @_animationsArray
animation.start()
animation.isAnimatingCheck = true
@emit Events.AnimationStart
stop: =>
for animation in @_animationsArray
animation.stop()
animation.isAnimatingCheck = false
@emit Events.AnimationStop | true | # Animation Set
# Manages a set of Animations
#
# by PI:NAME:<NAME>END_PI
# http://isaacw.com
class exports.AnimationSet extends Framer.EventEmitter
constructor: (options = {}) ->
@_animationsArray = []
@add(animation) for k, animation of options.animations
@repeat = options.repeat ? false
add: (animation) =>
# Ensure the animation is stopped (needed when passed via the layer.animate method)
animation.stop()
# Have the animation track its animating state
animation.isAnimatingCheck = false
animation.on Events.AnimationEnd, =>
animation.isAnimatingCheck = false
@_update()
@_animationsArray.push animation
_update: () =>
# Have all animations stopped?
if not @isAnimatingCheck()
if @repeat
@start()
else
@emit Events.AnimationEnd
isAnimatingCheck: =>
_.some(@_animationsArray, "isAnimatingCheck", true)
start: =>
for animation in @_animationsArray
animation.start()
animation.isAnimatingCheck = true
@emit Events.AnimationStart
stop: =>
for animation in @_animationsArray
animation.stop()
animation.isAnimatingCheck = false
@emit Events.AnimationStop |
[
{
"context": "rview Rule to check for implicit objects\n# @author Julian Rosse\n###\n\n'use strict'\n\n#-----------------------------",
"end": 78,
"score": 0.9998760223388672,
"start": 66,
"tag": "NAME",
"value": "Julian Rosse"
}
] | src/rules/implicit-call.coffee | danielbayley/eslint-plugin-coffee | 21 | ###*
# @fileoverview Rule to check for implicit objects
# @author Julian Rosse
###
'use strict'
#------------------------------------------------------------------------------
# Rule Definition
#------------------------------------------------------------------------------
module.exports =
meta:
docs:
description: 'forbid implicit calls'
category: 'Stylistic Issues'
recommended: no
# url: 'https://eslint.org/docs/rules/max-len'
schema: []
create: (context) ->
check = (node) ->
return unless node.implicit
context.report {
node
message: 'Use explicit parentheses around function call arguments'
}
#--------------------------------------------------------------------------
# Public API
#--------------------------------------------------------------------------
NewExpression: check
CallExpression: check
| 178690 | ###*
# @fileoverview Rule to check for implicit objects
# @author <NAME>
###
'use strict'
#------------------------------------------------------------------------------
# Rule Definition
#------------------------------------------------------------------------------
module.exports =
meta:
docs:
description: 'forbid implicit calls'
category: 'Stylistic Issues'
recommended: no
# url: 'https://eslint.org/docs/rules/max-len'
schema: []
create: (context) ->
check = (node) ->
return unless node.implicit
context.report {
node
message: 'Use explicit parentheses around function call arguments'
}
#--------------------------------------------------------------------------
# Public API
#--------------------------------------------------------------------------
NewExpression: check
CallExpression: check
| true | ###*
# @fileoverview Rule to check for implicit objects
# @author PI:NAME:<NAME>END_PI
###
'use strict'
#------------------------------------------------------------------------------
# Rule Definition
#------------------------------------------------------------------------------
module.exports =
meta:
docs:
description: 'forbid implicit calls'
category: 'Stylistic Issues'
recommended: no
# url: 'https://eslint.org/docs/rules/max-len'
schema: []
create: (context) ->
check = (node) ->
return unless node.implicit
context.report {
node
message: 'Use explicit parentheses around function call arguments'
}
#--------------------------------------------------------------------------
# Public API
#--------------------------------------------------------------------------
NewExpression: check
CallExpression: check
|
[
{
"context": ".key)\n\n key = relationship.key\n idsKey = key.substr(0, key.length-1) + \"_ids\"\n relationshipType = DS",
"end": 432,
"score": 0.8420281410217285,
"start": 424,
"tag": "KEY",
"value": "substr(0"
},
{
"context": "= relationship.key\n idsKey = key.substr(0,... | app/assets/javascripts/mixins/serialize_hasmany.js.coffee | johan--/tahi | 1 | ETahi.SerializesHasMany = Ember.Mixin.create
relationshipMap: ->
{
manyToNone: true
manyToMany: true
manyToOne: true
}
toSnakeCase: (string)->
string.replace /([A-Z])/g, ($1)->
"_" + $1.toLowerCase()
serializeHasMany: (record, json, relationship) ->
return unless record.get('relationshipsToSerialize')?.contains(relationship.key)
key = relationship.key
idsKey = key.substr(0, key.length-1) + "_ids"
relationshipType = DS.RelationshipChange.determineRelationshipType(record.constructor, relationship)
if @relationshipMap relationshipType
json[@toSnakeCase(idsKey)] = Em.get(record, key).mapBy("id")
return
| 157078 | ETahi.SerializesHasMany = Ember.Mixin.create
relationshipMap: ->
{
manyToNone: true
manyToMany: true
manyToOne: true
}
toSnakeCase: (string)->
string.replace /([A-Z])/g, ($1)->
"_" + $1.toLowerCase()
serializeHasMany: (record, json, relationship) ->
return unless record.get('relationshipsToSerialize')?.contains(relationship.key)
key = relationship.key
idsKey = key.<KEY>, key.<KEY>"
relationshipType = DS.RelationshipChange.determineRelationshipType(record.constructor, relationship)
if @relationshipMap relationshipType
json[@toSnakeCase(idsKey)] = Em.get(record, key).mapBy("id")
return
| true | ETahi.SerializesHasMany = Ember.Mixin.create
relationshipMap: ->
{
manyToNone: true
manyToMany: true
manyToOne: true
}
toSnakeCase: (string)->
string.replace /([A-Z])/g, ($1)->
"_" + $1.toLowerCase()
serializeHasMany: (record, json, relationship) ->
return unless record.get('relationshipsToSerialize')?.contains(relationship.key)
key = relationship.key
idsKey = key.PI:KEY:<KEY>END_PI, key.PI:KEY:<KEY>END_PI"
relationshipType = DS.RelationshipChange.determineRelationshipType(record.constructor, relationship)
if @relationshipMap relationshipType
json[@toSnakeCase(idsKey)] = Em.get(record, key).mapBy("id")
return
|
[
{
"context": "***\n# JSRange - Text Range Manage Class\n# Coded by Hajime Oh-yake 2013.03.31\n#*************************************",
"end": 104,
"score": 0.9998990297317505,
"start": 90,
"tag": "NAME",
"value": "Hajime Oh-yake"
}
] | JSKit/01_JSRange.coffee | digitarhythm/codeJS | 0 | #*****************************************
# JSRange - Text Range Manage Class
# Coded by Hajime Oh-yake 2013.03.31
#*****************************************
class JSRange extends JSObject
constructor:->
super()
@location = 0
@length = 0
| 6553 | #*****************************************
# JSRange - Text Range Manage Class
# Coded by <NAME> 2013.03.31
#*****************************************
class JSRange extends JSObject
constructor:->
super()
@location = 0
@length = 0
| true | #*****************************************
# JSRange - Text Range Manage Class
# Coded by PI:NAME:<NAME>END_PI 2013.03.31
#*****************************************
class JSRange extends JSObject
constructor:->
super()
@location = 0
@length = 0
|
[
{
"context": "# Copyright Joyent, Inc. and other Node contributors.\n#\n# Permission",
"end": 18,
"score": 0.9992771148681641,
"start": 12,
"tag": "NAME",
"value": "Joyent"
}
] | test/simple/test-repl-timeout-throw.coffee | lxe/io.coffee | 0 | # Copyright Joyent, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
assert = require("assert")
common = require("../common.js")
spawn = require("child_process").spawn
child = spawn(process.execPath, ["-i"],
stdio: [
null
null
2
]
)
stdout = ""
child.stdout.setEncoding "utf8"
child.stdout.on "data", (c) ->
process.stdout.write c
stdout += c
return
child.stdin.write = (original) ->
(c) ->
process.stderr.write c
original.call child.stdin, c
(child.stdin.write)
child.stdout.once "data", ->
fsTest = ->
f = JSON.stringify(__filename)
child.stdin.write "fs.readFile(" + f + ", thrower);\n"
setTimeout eeTest, 50
return
eeTest = ->
child.stdin.write "setTimeout(function() {\n" + " var events = require(\"events\");\n" + " var e = new events.EventEmitter;\n" + " process.nextTick(function() {\n" + " e.on(\"x\", thrower);\n" + " setTimeout(function() {\n" + " e.emit(\"x\");\n" + " });\n" + " });\n" + "});\"\";\n"
setTimeout child.stdin.end.bind(child.stdin), 200
return
child.stdin.write "var throws = 0;"
child.stdin.write "process.on(\"exit\",function(){console.log(throws)});"
child.stdin.write "function thrower(){console.log(\"THROW\",throws++);XXX};"
child.stdin.write "setTimeout(thrower);\"\"\n"
setTimeout fsTest, 50
return
child.on "close", (c) ->
assert not c
# make sure we got 3 throws, in the end.
lastLine = stdout.trim().split(/\r?\n/).pop()
assert.equal lastLine, "> 3"
return
| 99998 | # Copyright <NAME>, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
assert = require("assert")
common = require("../common.js")
spawn = require("child_process").spawn
child = spawn(process.execPath, ["-i"],
stdio: [
null
null
2
]
)
stdout = ""
child.stdout.setEncoding "utf8"
child.stdout.on "data", (c) ->
process.stdout.write c
stdout += c
return
child.stdin.write = (original) ->
(c) ->
process.stderr.write c
original.call child.stdin, c
(child.stdin.write)
child.stdout.once "data", ->
fsTest = ->
f = JSON.stringify(__filename)
child.stdin.write "fs.readFile(" + f + ", thrower);\n"
setTimeout eeTest, 50
return
eeTest = ->
child.stdin.write "setTimeout(function() {\n" + " var events = require(\"events\");\n" + " var e = new events.EventEmitter;\n" + " process.nextTick(function() {\n" + " e.on(\"x\", thrower);\n" + " setTimeout(function() {\n" + " e.emit(\"x\");\n" + " });\n" + " });\n" + "});\"\";\n"
setTimeout child.stdin.end.bind(child.stdin), 200
return
child.stdin.write "var throws = 0;"
child.stdin.write "process.on(\"exit\",function(){console.log(throws)});"
child.stdin.write "function thrower(){console.log(\"THROW\",throws++);XXX};"
child.stdin.write "setTimeout(thrower);\"\"\n"
setTimeout fsTest, 50
return
child.on "close", (c) ->
assert not c
# make sure we got 3 throws, in the end.
lastLine = stdout.trim().split(/\r?\n/).pop()
assert.equal lastLine, "> 3"
return
| true | # Copyright PI:NAME:<NAME>END_PI, Inc. and other Node contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
assert = require("assert")
common = require("../common.js")
spawn = require("child_process").spawn
child = spawn(process.execPath, ["-i"],
stdio: [
null
null
2
]
)
stdout = ""
child.stdout.setEncoding "utf8"
child.stdout.on "data", (c) ->
process.stdout.write c
stdout += c
return
child.stdin.write = (original) ->
(c) ->
process.stderr.write c
original.call child.stdin, c
(child.stdin.write)
child.stdout.once "data", ->
fsTest = ->
f = JSON.stringify(__filename)
child.stdin.write "fs.readFile(" + f + ", thrower);\n"
setTimeout eeTest, 50
return
eeTest = ->
child.stdin.write "setTimeout(function() {\n" + " var events = require(\"events\");\n" + " var e = new events.EventEmitter;\n" + " process.nextTick(function() {\n" + " e.on(\"x\", thrower);\n" + " setTimeout(function() {\n" + " e.emit(\"x\");\n" + " });\n" + " });\n" + "});\"\";\n"
setTimeout child.stdin.end.bind(child.stdin), 200
return
child.stdin.write "var throws = 0;"
child.stdin.write "process.on(\"exit\",function(){console.log(throws)});"
child.stdin.write "function thrower(){console.log(\"THROW\",throws++);XXX};"
child.stdin.write "setTimeout(thrower);\"\"\n"
setTimeout fsTest, 50
return
child.on "close", (c) ->
assert not c
# make sure we got 3 throws, in the end.
lastLine = stdout.trim().split(/\r?\n/).pop()
assert.equal lastLine, "> 3"
return
|
[
{
"context": "arentheses in empty function param lists\n# @author Julian Rosse\n###\n\n'use strict'\n\n#-----------------------------",
"end": 106,
"score": 0.9998475313186646,
"start": 94,
"tag": "NAME",
"value": "Julian Rosse"
}
] | src/rules/empty-func-parens.coffee | danielbayley/eslint-plugin-coffee | 21 | ###*
# @fileoverview Rule to check use of parentheses in empty function param lists
# @author Julian Rosse
###
'use strict'
#------------------------------------------------------------------------------
# Rule Definition
#------------------------------------------------------------------------------
module.exports =
meta:
docs:
description: 'prefer or disallow parentheses in empty param lists'
category: 'Stylistic Issues'
recommended: no
# url: 'https://eslint.org/docs/rules/max-len'
schema: [
type: 'string'
enum: ['never', 'always']
]
create: (context) ->
sourceCode = context.getSourceCode()
useParens = context.options[0] is 'always'
check = (node) ->
return if node.params.length
hasParens = sourceCode.getFirstToken(node).value is '('
if hasParens and not useParens
context.report {
node
message: "Don't use parentheses for empty function parameter list"
}
else if not hasParens and useParens
context.report {
node
message: 'Use empty parentheses for function parameter list'
}
#--------------------------------------------------------------------------
# Public API
#--------------------------------------------------------------------------
FunctionExpression: check
ArrowFunctionExpression: check
| 197839 | ###*
# @fileoverview Rule to check use of parentheses in empty function param lists
# @author <NAME>
###
'use strict'
#------------------------------------------------------------------------------
# Rule Definition
#------------------------------------------------------------------------------
module.exports =
meta:
docs:
description: 'prefer or disallow parentheses in empty param lists'
category: 'Stylistic Issues'
recommended: no
# url: 'https://eslint.org/docs/rules/max-len'
schema: [
type: 'string'
enum: ['never', 'always']
]
create: (context) ->
sourceCode = context.getSourceCode()
useParens = context.options[0] is 'always'
check = (node) ->
return if node.params.length
hasParens = sourceCode.getFirstToken(node).value is '('
if hasParens and not useParens
context.report {
node
message: "Don't use parentheses for empty function parameter list"
}
else if not hasParens and useParens
context.report {
node
message: 'Use empty parentheses for function parameter list'
}
#--------------------------------------------------------------------------
# Public API
#--------------------------------------------------------------------------
FunctionExpression: check
ArrowFunctionExpression: check
| true | ###*
# @fileoverview Rule to check use of parentheses in empty function param lists
# @author PI:NAME:<NAME>END_PI
###
'use strict'
#------------------------------------------------------------------------------
# Rule Definition
#------------------------------------------------------------------------------
module.exports =
meta:
docs:
description: 'prefer or disallow parentheses in empty param lists'
category: 'Stylistic Issues'
recommended: no
# url: 'https://eslint.org/docs/rules/max-len'
schema: [
type: 'string'
enum: ['never', 'always']
]
create: (context) ->
sourceCode = context.getSourceCode()
useParens = context.options[0] is 'always'
check = (node) ->
return if node.params.length
hasParens = sourceCode.getFirstToken(node).value is '('
if hasParens and not useParens
context.report {
node
message: "Don't use parentheses for empty function parameter list"
}
else if not hasParens and useParens
context.report {
node
message: 'Use empty parentheses for function parameter list'
}
#--------------------------------------------------------------------------
# Public API
#--------------------------------------------------------------------------
FunctionExpression: check
ArrowFunctionExpression: check
|
[
{
"context": "ngerprint:\n#\n# > echo \"hello\" | gpg --sign -a -u 9A82C74B75E3410C1C00338CF4C7E8F4AC11D4F3 | gpg --li",
"end": 142,
"score": 0.8888705968856812,
"start": 141,
"tag": "KEY",
"value": "9"
},
{
"context": "o \"hello\" | gpg --sign -a -u 9A82C74B75E3410C1C00338CF4C7E8F... | test/files/subpacket33.iced | samkenxstream/kbpgp | 464 |
{KeyRing,box,unbox,KeyManager} = require '../..'
# This sig has a subpacket 33 issuer fingerprint:
#
# > echo "hello" | gpg --sign -a -u 9A82C74B75E3410C1C00338CF4C7E8F4AC11D4F3 | gpg --list-packets
#
# # off=0 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
# :compressed packet: algo=1
# # off=2 ctb=90 tag=4 hlen=2 plen=13
# :onepass_sig packet: keyid F4C7E8F4AC11D4F3
# version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# # off=17 ctb=cb tag=11 hlen=2 plen=12 new-ctb
# :literal data packet:
# mode b (62), created 1481135087, name="",
# raw data: 6 bytes
# # off=31 ctb=89 tag=2 hlen=3 plen=307
# :signature packet: algo 1, keyid F4C7E8F4AC11D4F3
# version 4, created 1481135087, md5len 0, sigclass 0x00
# digest algo 8, begin of digest dd 5a
# hashed subpkt 33 len 21 (issuer fpr v4 9A82C74B75E3410C1C00338CF4C7E8F4AC11D4F3)
# hashed subpkt 2 len 4 (sig created 2016-12-07)
# subpkt 16 len 8 (issuer key ID F4C7E8F4AC11D4F3)
# data: [2048 bits]
#
sig0 = """-----BEGIN PGP MESSAGE-----
owEBUwGs/pANAwAIAfTH6PSsEdTzAcsMYgBYSEwKaGVsbG8KiQEzBAABCAAdFiEE
moLHS3XjQQwcADOM9Mfo9KwR1PMFAlhITAoACgkQ9Mfo9KwR1PNK2AgA4cTQNfnu
F6vfIfmLrnuNm+OFSffkgQmDQc48RV2ppA35r0dDJDi1lF/UBei+RZVNP2zntZ2z
glxivl4qM7qdqojI1HZxP9cT25GuQNWZI3M0LXsderQtv6z4M6q8wj5OjI6kNMN3
QoBLL+cVcqEy0ocW1+oQ4NGemiQ4TLnH3or83OVoUXHSbtM6jBmedqs2taReRx20
RYl5iEr6kQGHmqYt1K142QORPrjYyvGJl8k8cKDjRxOo65ufTB+iztG312cVTnnJ
/gCEVjvAARdrDuroooJwxqx5BFpi7Z5qb4osmxJwdib9lrt1r/fV7QwY1LrCn5eF
YcO0GnR3O1jT9w==
=YRAG
-----END PGP MESSAGE-----
"""
key0 = """-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFhIScUBCADp3DNt8ENU2U4kuWzdIe6SXQQ9klLyOcm4MzRWJa4kvHjVvaG8
CFHeluTITvXk+HYS06a+w4h7uDj6bQRiQTu+byvj2NuvWjgfiVvkD2BLZ5gsgM7N
IKXlHm+mbTK2FdCCzM7cRiphlySPjL7lflpjOz+iMf2E6phLh6uTsD3js8sxu5Hk
9EJ9sUKDBgLpJf92wL0FaxADP6BLPqn1DzEAe/NE4O6nY6ITqLziNv2UBxdfACe9
06ZPetOJhb/HFHGMkpZNS13BZS60rvMPxtHmzGsTqxP9hdrVqQx/Yi1PrH3UTZRR
/dEty1hHCMbY/gWzDmOxUcV64BxhKztsFxvJABEBAAG0FlRhY28gVGVzdCA8dGFj
b0B0ZS5zdD6JAU4EEwEIADgWIQSagsdLdeNBDBwAM4z0x+j0rBHU8wUCWEhJxQIb
AwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRD0x+j0rBHU8wuvCACWnqhXhMkc
ZxQQ5PebCWt2q1xAEYEbdHWglAnbbsBmJz8aKyfMx5BRVKl3/9efNbBvlM+e3oUo
J40uhTCeGdmmZteM4PUQPCCl+sGYZ4aZuTD8BDnUo79V2ymFMGvYmk8vw79TVjcT
7OGF7jQiJwYycqhOri2FT+jEPSYlLsn7G9PIa40DQcbKQBqSzzt9H5C8hPLQX2b1
OfL+TDv/wa8i6stx/SYn6a1drnFFtyoRTxFwdryPEkRTotS70+Cb4Mg+QH9WgL+D
AppZVBYzZNPWX1bGL5FC7Er/cVeluHEmnfpMURgvtWK87ZW53imbgYixnnbZ2peC
iLgltpS95wFJuQENBFhIScUBCAC5psaWkHr6sJTVEa66t7uWsivvrohoQO1luOjL
QVJcHpGHnSeP8ZFx1B1vseXokMeBDZ9yRowOusiBHve4Tov0bwgp70TCcNZjeB6q
NqtJK7//mPuXBR51JKSlaO9DHi5k3RQ8DjeWm+I5FbDOhfz3vorPcNmrtUZRHjTE
W6Vqaf+Lv6EyLlkD7QRvE/FYbAVQ/+Ht/0pvxeZbVW076YD7tVm+J7AyeMK5u6t9
S7F0K4l/dNpBtoiRToG19BwfsNbjjJh/UDjUGaEgD0gGyhzzrpM2LiwJTmv13yGt
oK8/Wc8hpbT1yp0vSVagJ0FJ50cbqAI8H5LOLHSRroZwpWVtABEBAAGJATYEGAEI
ACAWIQSagsdLdeNBDBwAM4z0x+j0rBHU8wUCWEhJxQIbDAAKCRD0x+j0rBHU8wnB
CACs3EwT0En//ItF/GJdjdrpZyZkcSkOiGFWY/TeTi5SGjAIinJcJWFYDibLKbWx
dbBirDm+ep93VCyGT8CbUjSL5f6zt67tJA4SM+djTW0luCTh8X5RgDntz36tVo6G
pyWSAatyMOmsJqTKYuksIhvkVaJQHLzFBer/5ltzJkTkVZJuuGxqNMP4VUcBXoJG
WIieaZJUW8cNgP3jAR4sa0dSQE+hWBRnsZlWVOdsO1BucoqHz/ytvposCWRPaf83
dDhhp617omZLdCQGFDov0uE0MvIkwQxQIAaQVRfB5ZGH67K3ebyrFxOu6xdoArAF
gdDIgUoBsCGhjerF6Qvcj1dx
=rJOL
-----END PGP PUBLIC KEY BLOCK-----
"""
test = ({T,sig,key},cb) ->
await KeyManager.import_from_armored_pgp { armored : key }, T.esc(defer(km), cb, "load key taco test")
T.waypoint "loaded key"
await unbox { keyfetch : km, armored : sig }, T.esc(defer(literals), cb, "verify")
T.assert (literals[0].get_data_signer()?), "was signed!"
fp1 = literals[0].get_data_signer()?.get_key_manager()?.get_pgp_fingerprint()?.toString("hex")
fp2 = km.get_pgp_fingerprint().toString("hex")
T.equal fp1, fp2, "Fingerprint was right"
cb()
exports.test_subpacket33 = (T,cb) -> test { T, key: key0, sig : sig0 }, cb
| 73944 |
{KeyRing,box,unbox,KeyManager} = require '../..'
# This sig has a subpacket 33 issuer fingerprint:
#
# > echo "hello" | gpg --sign -a -u <KEY>A82C74B75E3410C1C00<KEY>8CF4C7E8F4<KEY>11D4F3 | gpg --list-packets
#
# # off=0 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
# :compressed packet: algo=1
# # off=2 ctb=90 tag=4 hlen=2 plen=13
# :onepass_sig packet: keyid <KEY>
# version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# # off=17 ctb=cb tag=11 hlen=2 plen=12 new-ctb
# :literal data packet:
# mode b (62), created 1481135087, name="",
# raw data: 6 bytes
# # off=31 ctb=89 tag=2 hlen=3 plen=307
# :signature packet: algo 1, keyid <KEY>
# version 4, created 1481135087, md5len 0, sigclass 0x00
# digest algo 8, begin of digest dd 5a
# hashed subpkt 33 len 21 (issuer fpr v4 9A82C74B75E3410C1C00338CF4C7E8F4AC11D4F3)
# hashed subpkt 2 len 4 (sig created 2016-12-07)
# subpkt 16 len 8 (issuer key ID <KEY>)
# data: [2048 bits]
#
sig0 = """-----BEGIN PGP MESSAGE-----
<KEY>
=YRAG
-----END PGP MESSAGE-----
"""
key0 = """-----BEGIN PGP PUBLIC KEY BLOCK-----
<KEY>
-----END PGP PUBLIC KEY BLOCK-----
"""
test = ({T,sig,key},cb) ->
await KeyManager.import_from_armored_pgp { armored : key }, T.esc(defer(km), cb, "load key taco test")
T.waypoint "loaded key"
await unbox { keyfetch : km, armored : sig }, T.esc(defer(literals), cb, "verify")
T.assert (literals[0].get_data_signer()?), "was signed!"
fp1 = literals[0].get_data_signer()?.get_key_manager()?.get_pgp_fingerprint()?.toString("hex")
fp2 = km.get_pgp_fingerprint().toString("hex")
T.equal fp1, fp2, "Fingerprint was right"
cb()
exports.test_subpacket33 = (T,cb) -> test { T, key: key0, sig : sig0 }, cb
| true |
{KeyRing,box,unbox,KeyManager} = require '../..'
# This sig has a subpacket 33 issuer fingerprint:
#
# > echo "hello" | gpg --sign -a -u PI:KEY:<KEY>END_PIA82C74B75E3410C1C00PI:KEY:<KEY>END_PI8CF4C7E8F4PI:KEY:<KEY>END_PI11D4F3 | gpg --list-packets
#
# # off=0 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
# :compressed packet: algo=1
# # off=2 ctb=90 tag=4 hlen=2 plen=13
# :onepass_sig packet: keyid PI:KEY:<KEY>END_PI
# version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# # off=17 ctb=cb tag=11 hlen=2 plen=12 new-ctb
# :literal data packet:
# mode b (62), created 1481135087, name="",
# raw data: 6 bytes
# # off=31 ctb=89 tag=2 hlen=3 plen=307
# :signature packet: algo 1, keyid PI:KEY:<KEY>END_PI
# version 4, created 1481135087, md5len 0, sigclass 0x00
# digest algo 8, begin of digest dd 5a
# hashed subpkt 33 len 21 (issuer fpr v4 9A82C74B75E3410C1C00338CF4C7E8F4AC11D4F3)
# hashed subpkt 2 len 4 (sig created 2016-12-07)
# subpkt 16 len 8 (issuer key ID PI:KEY:<KEY>END_PI)
# data: [2048 bits]
#
sig0 = """-----BEGIN PGP MESSAGE-----
PI:KEY:<KEY>END_PI
=YRAG
-----END PGP MESSAGE-----
"""
key0 = """-----BEGIN PGP PUBLIC KEY BLOCK-----
PI:KEY:<KEY>END_PI
-----END PGP PUBLIC KEY BLOCK-----
"""
test = ({T,sig,key},cb) ->
await KeyManager.import_from_armored_pgp { armored : key }, T.esc(defer(km), cb, "load key taco test")
T.waypoint "loaded key"
await unbox { keyfetch : km, armored : sig }, T.esc(defer(literals), cb, "verify")
T.assert (literals[0].get_data_signer()?), "was signed!"
fp1 = literals[0].get_data_signer()?.get_key_manager()?.get_pgp_fingerprint()?.toString("hex")
fp2 = km.get_pgp_fingerprint().toString("hex")
T.equal fp1, fp2, "Fingerprint was right"
cb()
exports.test_subpacket33 = (T,cb) -> test { T, key: key0, sig : sig0 }, cb
|
[
{
"context": "oad libraries, modules and templates.\n\t\t\n\t\t@author Sebastian Sachtleben\n###\n(->\n\t\t# Variable declaration\n\t\tmodules={}\n\t\tl",
"end": 130,
"score": 0.9998762011528015,
"start": 110,
"tag": "NAME",
"value": "Sebastian Sachtleben"
}
] | app/assets/javascripts/require.coffee | ssachtleben/herowar | 1 | ###
The loader provides the define and require logic to load libraries, modules and templates.
@author Sebastian Sachtleben
###
(->
# Variable declaration
modules={}
loaded={}
###
Define a module with name and callback.
@param {String} The name to define.
@param {Function} The callback function.
###
@define = (name, callback) ->
modules[name] = callback
###
Require a defined callback.
@param {String} The defined name.
###
@require = (name) ->
# create an array out of names if only one string
if _.isArray name
#.log('isArray')
require element for element in name
else
##console.log('string ', name, loadModule name)
throw 'The module "' + name + '" could not be found' unless modules[name]
return loaded[name] if loaded[name]
loadModule name
###
Load module by name.
@param {String} The module name.
###
loadModule = (name) ->
loaded[name] ?= if typeof modules[name] is 'string' then globalEval modules[name] else modules[name].call window
###
Use global eval (IE needs execScript).
@param {String} The data to eval.
###
globalEval = (data) ->
if data
data = "(#{data})" if data.indexOf 'function' is 0
content = eval.call @, data
if typeof content is 'function' then content() else true
).call this | 16981 | ###
The loader provides the define and require logic to load libraries, modules and templates.
@author <NAME>
###
(->
# Variable declaration
modules={}
loaded={}
###
Define a module with name and callback.
@param {String} The name to define.
@param {Function} The callback function.
###
@define = (name, callback) ->
modules[name] = callback
###
Require a defined callback.
@param {String} The defined name.
###
@require = (name) ->
# create an array out of names if only one string
if _.isArray name
#.log('isArray')
require element for element in name
else
##console.log('string ', name, loadModule name)
throw 'The module "' + name + '" could not be found' unless modules[name]
return loaded[name] if loaded[name]
loadModule name
###
Load module by name.
@param {String} The module name.
###
loadModule = (name) ->
loaded[name] ?= if typeof modules[name] is 'string' then globalEval modules[name] else modules[name].call window
###
Use global eval (IE needs execScript).
@param {String} The data to eval.
###
globalEval = (data) ->
if data
data = "(#{data})" if data.indexOf 'function' is 0
content = eval.call @, data
if typeof content is 'function' then content() else true
).call this | true | ###
The loader provides the define and require logic to load libraries, modules and templates.
@author PI:NAME:<NAME>END_PI
###
(->
# Variable declaration
modules={}
loaded={}
###
Define a module with name and callback.
@param {String} The name to define.
@param {Function} The callback function.
###
@define = (name, callback) ->
modules[name] = callback
###
Require a defined callback.
@param {String} The defined name.
###
@require = (name) ->
# create an array out of names if only one string
if _.isArray name
#.log('isArray')
require element for element in name
else
##console.log('string ', name, loadModule name)
throw 'The module "' + name + '" could not be found' unless modules[name]
return loaded[name] if loaded[name]
loadModule name
###
Load module by name.
@param {String} The module name.
###
loadModule = (name) ->
loaded[name] ?= if typeof modules[name] is 'string' then globalEval modules[name] else modules[name].call window
###
Use global eval (IE needs execScript).
@param {String} The data to eval.
###
globalEval = (data) ->
if data
data = "(#{data})" if data.indexOf 'function' is 0
content = eval.call @, data
if typeof content is 'function' then content() else true
).call this |
[
{
"context": "# Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public Li",
"end": 43,
"score": 0.9999106526374817,
"start": 29,
"tag": "EMAIL",
"value": "contact@ppy.sh"
}
] | resources/assets/coffee/react/modding-profile/detail-bar.coffee | osu-katakuna/osu-katakuna-web | 5 | # Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import { Rank } from '../profile-page/rank'
import { BlockButton } from 'block-button'
import { FriendButton } from 'friend-button'
import * as React from 'react'
import { a, button, div, i, span } from 'react-dom-factories'
import { ReportReportable } from 'report-reportable'
el = React.createElement
export class DetailBar extends React.PureComponent
bn = 'profile-detail-bar'
constructor: (props) ->
super props
@eventId = "profile-page-#{osu.uuid()}"
@state = currentUser: osu.jsonClone(currentUser)
componentDidMount: =>
$.subscribe "user:update.#{@eventId}", @updateCurrentUser
componentWillUnmount: =>
$.unsubscribe ".#{@eventId}"
render: =>
isBlocked = _.find(@state.currentUser.blocks, target_id: @props.user.id)?
div className: bn,
div className: "#{bn}__column #{bn}__column--left",
div className: "#{bn}__entry",
el FriendButton,
userId: @props.user.id
showFollowerCounter: true
followers: @props.user.follower_count
modifiers: ['profile-page']
alwaysVisible: true
if @state.currentUser.id != @props.user.id && !isBlocked
div className: "#{bn}__entry",
a
className: 'user-action-button user-action-button--profile-page'
href: laroute.route 'messages.users.show', user: @props.user.id
title: osu.trans('users.card.send_message')
i className: 'fas fa-envelope'
@renderExtraMenu()
div className: "#{bn}__column #{bn}__column--right",
div className: "#{bn}__entry",
el Rank, type: 'global', stats: @props.stats
div className: "#{bn}__entry",
el Rank, type: 'country', stats: @props.stats
div className: "#{bn}__entry #{bn}__entry--level",
div
className: "#{bn}__level"
title: osu.trans('users.show.stats.level', level: @props.stats.level.current)
@props.stats.level.current
renderExtraMenu: =>
items = []
if @state.currentUser.id? && @state.currentUser.id != @props.user.id
blockButton = el BlockButton,
key: 'block'
userId: @props.user.id
wrapperClass: 'simple-menu__item'
modifiers: ['inline']
items.push blockButton
reportButton = el ReportReportable,
className: 'simple-menu__item'
icon: true
key: 'report'
reportableId: @props.user.id
reportableType: 'user'
user: @props.user
items.push reportButton
return null if items.length == 0
div className: "#{bn}__entry",
button
className: 'profile-page-toggle js-click-menu'
title: osu.trans('common.buttons.show_more_options')
'data-click-menu-target': "profile-page-bar-#{@id}"
span className: 'fas fa-ellipsis-v'
div
className: 'simple-menu simple-menu--profile-page-bar js-click-menu'
'data-click-menu-id': "profile-page-bar-#{@id}"
'data-visibility': 'hidden'
items
updateCurrentUser: (_e, user) =>
return unless @state.currentUser.id == user.id
@setState currentUser: osu.jsonClone(user)
| 142809 | # Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import { Rank } from '../profile-page/rank'
import { BlockButton } from 'block-button'
import { FriendButton } from 'friend-button'
import * as React from 'react'
import { a, button, div, i, span } from 'react-dom-factories'
import { ReportReportable } from 'report-reportable'
el = React.createElement
export class DetailBar extends React.PureComponent
bn = 'profile-detail-bar'
constructor: (props) ->
super props
@eventId = "profile-page-#{osu.uuid()}"
@state = currentUser: osu.jsonClone(currentUser)
componentDidMount: =>
$.subscribe "user:update.#{@eventId}", @updateCurrentUser
componentWillUnmount: =>
$.unsubscribe ".#{@eventId}"
render: =>
isBlocked = _.find(@state.currentUser.blocks, target_id: @props.user.id)?
div className: bn,
div className: "#{bn}__column #{bn}__column--left",
div className: "#{bn}__entry",
el FriendButton,
userId: @props.user.id
showFollowerCounter: true
followers: @props.user.follower_count
modifiers: ['profile-page']
alwaysVisible: true
if @state.currentUser.id != @props.user.id && !isBlocked
div className: "#{bn}__entry",
a
className: 'user-action-button user-action-button--profile-page'
href: laroute.route 'messages.users.show', user: @props.user.id
title: osu.trans('users.card.send_message')
i className: 'fas fa-envelope'
@renderExtraMenu()
div className: "#{bn}__column #{bn}__column--right",
div className: "#{bn}__entry",
el Rank, type: 'global', stats: @props.stats
div className: "#{bn}__entry",
el Rank, type: 'country', stats: @props.stats
div className: "#{bn}__entry #{bn}__entry--level",
div
className: "#{bn}__level"
title: osu.trans('users.show.stats.level', level: @props.stats.level.current)
@props.stats.level.current
renderExtraMenu: =>
items = []
if @state.currentUser.id? && @state.currentUser.id != @props.user.id
blockButton = el BlockButton,
key: 'block'
userId: @props.user.id
wrapperClass: 'simple-menu__item'
modifiers: ['inline']
items.push blockButton
reportButton = el ReportReportable,
className: 'simple-menu__item'
icon: true
key: 'report'
reportableId: @props.user.id
reportableType: 'user'
user: @props.user
items.push reportButton
return null if items.length == 0
div className: "#{bn}__entry",
button
className: 'profile-page-toggle js-click-menu'
title: osu.trans('common.buttons.show_more_options')
'data-click-menu-target': "profile-page-bar-#{@id}"
span className: 'fas fa-ellipsis-v'
div
className: 'simple-menu simple-menu--profile-page-bar js-click-menu'
'data-click-menu-id': "profile-page-bar-#{@id}"
'data-visibility': 'hidden'
items
updateCurrentUser: (_e, user) =>
return unless @state.currentUser.id == user.id
@setState currentUser: osu.jsonClone(user)
| true | # Copyright (c) ppy Pty Ltd <PI:EMAIL:<EMAIL>END_PI>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import { Rank } from '../profile-page/rank'
import { BlockButton } from 'block-button'
import { FriendButton } from 'friend-button'
import * as React from 'react'
import { a, button, div, i, span } from 'react-dom-factories'
import { ReportReportable } from 'report-reportable'
el = React.createElement
export class DetailBar extends React.PureComponent
bn = 'profile-detail-bar'
constructor: (props) ->
super props
@eventId = "profile-page-#{osu.uuid()}"
@state = currentUser: osu.jsonClone(currentUser)
componentDidMount: =>
$.subscribe "user:update.#{@eventId}", @updateCurrentUser
componentWillUnmount: =>
$.unsubscribe ".#{@eventId}"
render: =>
isBlocked = _.find(@state.currentUser.blocks, target_id: @props.user.id)?
div className: bn,
div className: "#{bn}__column #{bn}__column--left",
div className: "#{bn}__entry",
el FriendButton,
userId: @props.user.id
showFollowerCounter: true
followers: @props.user.follower_count
modifiers: ['profile-page']
alwaysVisible: true
if @state.currentUser.id != @props.user.id && !isBlocked
div className: "#{bn}__entry",
a
className: 'user-action-button user-action-button--profile-page'
href: laroute.route 'messages.users.show', user: @props.user.id
title: osu.trans('users.card.send_message')
i className: 'fas fa-envelope'
@renderExtraMenu()
div className: "#{bn}__column #{bn}__column--right",
div className: "#{bn}__entry",
el Rank, type: 'global', stats: @props.stats
div className: "#{bn}__entry",
el Rank, type: 'country', stats: @props.stats
div className: "#{bn}__entry #{bn}__entry--level",
div
className: "#{bn}__level"
title: osu.trans('users.show.stats.level', level: @props.stats.level.current)
@props.stats.level.current
renderExtraMenu: =>
items = []
if @state.currentUser.id? && @state.currentUser.id != @props.user.id
blockButton = el BlockButton,
key: 'block'
userId: @props.user.id
wrapperClass: 'simple-menu__item'
modifiers: ['inline']
items.push blockButton
reportButton = el ReportReportable,
className: 'simple-menu__item'
icon: true
key: 'report'
reportableId: @props.user.id
reportableType: 'user'
user: @props.user
items.push reportButton
return null if items.length == 0
div className: "#{bn}__entry",
button
className: 'profile-page-toggle js-click-menu'
title: osu.trans('common.buttons.show_more_options')
'data-click-menu-target': "profile-page-bar-#{@id}"
span className: 'fas fa-ellipsis-v'
div
className: 'simple-menu simple-menu--profile-page-bar js-click-menu'
'data-click-menu-id': "profile-page-bar-#{@id}"
'data-visibility': 'hidden'
items
updateCurrentUser: (_e, user) =>
return unless @state.currentUser.id == user.id
@setState currentUser: osu.jsonClone(user)
|
[
{
"context": "ght} = $options\n\n$tim = new Person age: 4, name: 'Tim', height: '71 in'\n\n",
"end": 117,
"score": 0.9997846484184265,
"start": 114,
"tag": "NAME",
"value": "Tim"
}
] | documentation/coffee/constructor_destructuring.coffee | zeel-dev/copheescript | 3 | class Person
__construct: ($options) ->
{@name, @age, @height} = $options
$tim = new Person age: 4, name: 'Tim', height: '71 in'
| 114687 | class Person
__construct: ($options) ->
{@name, @age, @height} = $options
$tim = new Person age: 4, name: '<NAME>', height: '71 in'
| true | class Person
__construct: ($options) ->
{@name, @age, @height} = $options
$tim = new Person age: 4, name: 'PI:NAME:<NAME>END_PI', height: '71 in'
|
[
{
"context": "ther assistance please contact the Species team on species@unep-wcmc.org')\n error: (error) ->\n console.log(err",
"end": 2543,
"score": 0.9999329447746277,
"start": 2522,
"tag": "EMAIL",
"value": "species@unep-wcmc.org"
}
] | app/assets/javascripts/trade/controllers/search_results_controller.js.coffee | unepwcmc/SAPI | 6 | Trade.SearchResultsController = Ember.ArrayController.extend Trade.QueryParams, Trade.ShipmentPagination, Trade.Flash, Trade.CustomTransition,
needs: ['search', 'geoEntities', 'terms', 'units', 'sources', 'purposes']
content: null
currentShipment: null
batchUpdateParams: Trade.ShipmentBatchUpdate.create()
init: ->
transaction = @get('store').transaction()
@set('transaction', transaction)
# note: this maps a property on the controller to a query param
# changing a property will change the url
queryParams: [
'page',
'selectedTaxonConcepts:taxon_concepts_ids',
'selectedReportedTaxonConcepts:reported_taxon_concepts_ids',
'selectedAppendices:appendices',
'selectedTimeStart:time_range_start',
'selectedTimeEnd:time_range_end',
'selectedTerms:terms_ids',
'selectedUnits:units_ids',
'selectedPurposes:purposes_ids',
'selectedSources:sources_ids',
'selectedReporterType:reporter_type',
'selectedImporters:importers_ids',
'selectedExporters:exporters_ids',
'selectedCountriesOfOrigin:countries_of_origin_ids',
'selectedPermits:permits_ids',
'selectedQuantity:quantity',
'unitBlank:unit_blank',
'purposeBlank:purpose_blank',
'sourceBlank:source_blank',
'countryOfOriginBlank:country_of_origin_blank',
'permitBlank:permit_blank'
]
# need to initialize those array query params
# otherwise they're not passed as arrays
selectedTaxonConcepts: []
selectedReportedTaxonConcepts: []
selectedAppendices: []
selectedTerms: []
selectedUnits: []
selectedPurposes: []
selectedSources: []
selectedImporters: []
selectedExporters: []
selectedCountriesOfOrigin: []
selectedPermits: []
shipmentsSaving: ( ->
return false unless @get('content.isLoaded')
@get('content').filterBy('isSaving', true).length > 0
).property('content.@each.isSaving')
transitionToPage: (forward) ->
page = if forward
parseInt(@get('page')) + 1
else
parseInt(@get('page')) - 1
@set('page', page)
@customTransitionToRoute('search.results', { queryParams: $.extend({}, @get('controllers.search.searchParams'), { page: page }) })
userCanEdit: (callback) ->
$.ajax({
type: 'GET'
url: "/trade/user_can_edit"
data: {}
dataType: 'json'
success: (response) =>
if response.can_edit
callback()
else
alert('It is not possible to perform this action. If you require further assistance please contact the Species team on species@unep-wcmc.org')
error: (error) ->
console.log(error)
})
actions:
newShipment: () ->
shipment = Trade.Shipment.createRecord()
transaction = @get('transaction')
transaction.add(shipment)
@set('currentShipment', shipment)
$('.shipment-form-modal').modal('show')
# saves the new shipment (bound to currentShipment) to the db
saveShipment: (shipment, ignoreWarnings) ->
shipment.set('ignoreWarnings', ignoreWarnings)
# Before trying to save a shipment
# we need to reset the model to a valid state.
unless shipment.get('isValid')
shipment.send("becameValid")
unless shipment.get('isSaving')
transaction = @get('transaction')
transaction.add(shipment)
transaction.commit()
# this is here so that after another validation
# the user gets the secondary validation warning
shipment.set('propertyChanged', false)
shipment.one('didCreate', this, ->
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
@flashSuccess(message: 'Successfully created shipment.')
@send("dataChanged")
)
shipment.one('didUpdate', this, ->
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
@flashSuccess(message: 'Successfully updated shipment.')
)
cancelShipment: () ->
@get('transaction').rollback()
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
cancelBatch: () ->
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
# discards the new shipment (bound to currentShipment)
deleteShipment: (shipment) ->
@userCanEdit( =>
if confirm("This will delete a shipment. Proceed?")
if (!shipment.get('isSaving'))
shipment.deleteRecord()
shipment.get('transaction').commit()
shipment.one('didDelete', this, ->
@set('currentShipment', null)
@flashSuccess(message: 'Successfully deleted shipment.')
@send("dataChanged")
)
)
deleteBatchTransition: ->
@userCanEdit( =>
@customTransitionToRoute('search.results', {queryParams: $.extend({}, @get('controllers.search.searchParams'), {mode: 'delete'})})
)
deleteBatch: ->
if confirm("This will delete #{@get('total')} shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/destroy_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
)
.done( (data) =>
@flashSuccess(message: "Successfully deleted #{data.rows} shipments.")
@send("dataChanged")
)
.fail( (xhr) =>
@flashError(message: 'Error occurred when deleting shipments.')
console.log "bad luck: ", xhr.responseText
)
.always( () =>
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
)
editShipment: (shipment) ->
transaction = @get('transaction')
transaction.add(shipment)
@set('currentShipment', shipment)
$('.shipment-form-modal').modal('show')
editBatchTransition: ->
@customTransitionToRoute('search.results', {queryParams: $.extend({}, @get('controllers.search.searchParams'), {mode: 'edit'})})
editBatch: ->
@get('batchUpdateParams').reset()
@set('currentShipment', @get('batchUpdateParams'))
$('.batch-form-modal').modal('show')
updateBatch: ->
updates = @get('batchUpdateParams').export()
if Object.keys(updates).length == 0
alert("No changes detected.")
return false
if confirm("This will update " + @get('total') + " shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/update_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
updates: updates
)
.done( (data) =>
@flashSuccess(message: 'Successfully updated ' + data.rows + ' shipments.')
@send("dataChanged")
)
.fail( (xhr) =>
@flashError(message: 'Error occurred when updating shipments.')
console.log "bad luck: ", xhr.responseText
)
.always( () =>
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
)
resolveReportedTaxonConcept: (reported_taxon_concept_id) ->
$.ajax(
url: '/trade/shipments/accepted_taxa_for_reported_taxon_concept'
type: 'GET'
data:
reported_taxon_concept_id: reported_taxon_concept_id
)
.done( (data) =>
first = data['shipments'].shift()
if first
taxon_concept_id = first.id
Trade.TaxonConcept.find(taxon_concept_id).then( () =>
@set('currentShipment.taxonConceptId', taxon_concept_id)
)
else
# there were no accepted names found, this is likely a data error
# so clear the accepted taxon to draw attention to it
@set('currentShipment.taxonConceptId', null)
)
| 59305 | Trade.SearchResultsController = Ember.ArrayController.extend Trade.QueryParams, Trade.ShipmentPagination, Trade.Flash, Trade.CustomTransition,
needs: ['search', 'geoEntities', 'terms', 'units', 'sources', 'purposes']
content: null
currentShipment: null
batchUpdateParams: Trade.ShipmentBatchUpdate.create()
init: ->
transaction = @get('store').transaction()
@set('transaction', transaction)
# note: this maps a property on the controller to a query param
# changing a property will change the url
queryParams: [
'page',
'selectedTaxonConcepts:taxon_concepts_ids',
'selectedReportedTaxonConcepts:reported_taxon_concepts_ids',
'selectedAppendices:appendices',
'selectedTimeStart:time_range_start',
'selectedTimeEnd:time_range_end',
'selectedTerms:terms_ids',
'selectedUnits:units_ids',
'selectedPurposes:purposes_ids',
'selectedSources:sources_ids',
'selectedReporterType:reporter_type',
'selectedImporters:importers_ids',
'selectedExporters:exporters_ids',
'selectedCountriesOfOrigin:countries_of_origin_ids',
'selectedPermits:permits_ids',
'selectedQuantity:quantity',
'unitBlank:unit_blank',
'purposeBlank:purpose_blank',
'sourceBlank:source_blank',
'countryOfOriginBlank:country_of_origin_blank',
'permitBlank:permit_blank'
]
# need to initialize those array query params
# otherwise they're not passed as arrays
selectedTaxonConcepts: []
selectedReportedTaxonConcepts: []
selectedAppendices: []
selectedTerms: []
selectedUnits: []
selectedPurposes: []
selectedSources: []
selectedImporters: []
selectedExporters: []
selectedCountriesOfOrigin: []
selectedPermits: []
shipmentsSaving: ( ->
return false unless @get('content.isLoaded')
@get('content').filterBy('isSaving', true).length > 0
).property('content.@each.isSaving')
transitionToPage: (forward) ->
page = if forward
parseInt(@get('page')) + 1
else
parseInt(@get('page')) - 1
@set('page', page)
@customTransitionToRoute('search.results', { queryParams: $.extend({}, @get('controllers.search.searchParams'), { page: page }) })
userCanEdit: (callback) ->
$.ajax({
type: 'GET'
url: "/trade/user_can_edit"
data: {}
dataType: 'json'
success: (response) =>
if response.can_edit
callback()
else
alert('It is not possible to perform this action. If you require further assistance please contact the Species team on <EMAIL>')
error: (error) ->
console.log(error)
})
actions:
newShipment: () ->
shipment = Trade.Shipment.createRecord()
transaction = @get('transaction')
transaction.add(shipment)
@set('currentShipment', shipment)
$('.shipment-form-modal').modal('show')
# saves the new shipment (bound to currentShipment) to the db
saveShipment: (shipment, ignoreWarnings) ->
shipment.set('ignoreWarnings', ignoreWarnings)
# Before trying to save a shipment
# we need to reset the model to a valid state.
unless shipment.get('isValid')
shipment.send("becameValid")
unless shipment.get('isSaving')
transaction = @get('transaction')
transaction.add(shipment)
transaction.commit()
# this is here so that after another validation
# the user gets the secondary validation warning
shipment.set('propertyChanged', false)
shipment.one('didCreate', this, ->
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
@flashSuccess(message: 'Successfully created shipment.')
@send("dataChanged")
)
shipment.one('didUpdate', this, ->
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
@flashSuccess(message: 'Successfully updated shipment.')
)
cancelShipment: () ->
@get('transaction').rollback()
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
cancelBatch: () ->
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
# discards the new shipment (bound to currentShipment)
deleteShipment: (shipment) ->
@userCanEdit( =>
if confirm("This will delete a shipment. Proceed?")
if (!shipment.get('isSaving'))
shipment.deleteRecord()
shipment.get('transaction').commit()
shipment.one('didDelete', this, ->
@set('currentShipment', null)
@flashSuccess(message: 'Successfully deleted shipment.')
@send("dataChanged")
)
)
deleteBatchTransition: ->
@userCanEdit( =>
@customTransitionToRoute('search.results', {queryParams: $.extend({}, @get('controllers.search.searchParams'), {mode: 'delete'})})
)
deleteBatch: ->
if confirm("This will delete #{@get('total')} shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/destroy_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
)
.done( (data) =>
@flashSuccess(message: "Successfully deleted #{data.rows} shipments.")
@send("dataChanged")
)
.fail( (xhr) =>
@flashError(message: 'Error occurred when deleting shipments.')
console.log "bad luck: ", xhr.responseText
)
.always( () =>
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
)
editShipment: (shipment) ->
transaction = @get('transaction')
transaction.add(shipment)
@set('currentShipment', shipment)
$('.shipment-form-modal').modal('show')
editBatchTransition: ->
@customTransitionToRoute('search.results', {queryParams: $.extend({}, @get('controllers.search.searchParams'), {mode: 'edit'})})
editBatch: ->
@get('batchUpdateParams').reset()
@set('currentShipment', @get('batchUpdateParams'))
$('.batch-form-modal').modal('show')
updateBatch: ->
updates = @get('batchUpdateParams').export()
if Object.keys(updates).length == 0
alert("No changes detected.")
return false
if confirm("This will update " + @get('total') + " shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/update_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
updates: updates
)
.done( (data) =>
@flashSuccess(message: 'Successfully updated ' + data.rows + ' shipments.')
@send("dataChanged")
)
.fail( (xhr) =>
@flashError(message: 'Error occurred when updating shipments.')
console.log "bad luck: ", xhr.responseText
)
.always( () =>
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
)
resolveReportedTaxonConcept: (reported_taxon_concept_id) ->
$.ajax(
url: '/trade/shipments/accepted_taxa_for_reported_taxon_concept'
type: 'GET'
data:
reported_taxon_concept_id: reported_taxon_concept_id
)
.done( (data) =>
first = data['shipments'].shift()
if first
taxon_concept_id = first.id
Trade.TaxonConcept.find(taxon_concept_id).then( () =>
@set('currentShipment.taxonConceptId', taxon_concept_id)
)
else
# there were no accepted names found, this is likely a data error
# so clear the accepted taxon to draw attention to it
@set('currentShipment.taxonConceptId', null)
)
| true | Trade.SearchResultsController = Ember.ArrayController.extend Trade.QueryParams, Trade.ShipmentPagination, Trade.Flash, Trade.CustomTransition,
needs: ['search', 'geoEntities', 'terms', 'units', 'sources', 'purposes']
content: null
currentShipment: null
batchUpdateParams: Trade.ShipmentBatchUpdate.create()
init: ->
transaction = @get('store').transaction()
@set('transaction', transaction)
# note: this maps a property on the controller to a query param
# changing a property will change the url
queryParams: [
'page',
'selectedTaxonConcepts:taxon_concepts_ids',
'selectedReportedTaxonConcepts:reported_taxon_concepts_ids',
'selectedAppendices:appendices',
'selectedTimeStart:time_range_start',
'selectedTimeEnd:time_range_end',
'selectedTerms:terms_ids',
'selectedUnits:units_ids',
'selectedPurposes:purposes_ids',
'selectedSources:sources_ids',
'selectedReporterType:reporter_type',
'selectedImporters:importers_ids',
'selectedExporters:exporters_ids',
'selectedCountriesOfOrigin:countries_of_origin_ids',
'selectedPermits:permits_ids',
'selectedQuantity:quantity',
'unitBlank:unit_blank',
'purposeBlank:purpose_blank',
'sourceBlank:source_blank',
'countryOfOriginBlank:country_of_origin_blank',
'permitBlank:permit_blank'
]
# need to initialize those array query params
# otherwise they're not passed as arrays
selectedTaxonConcepts: []
selectedReportedTaxonConcepts: []
selectedAppendices: []
selectedTerms: []
selectedUnits: []
selectedPurposes: []
selectedSources: []
selectedImporters: []
selectedExporters: []
selectedCountriesOfOrigin: []
selectedPermits: []
shipmentsSaving: ( ->
return false unless @get('content.isLoaded')
@get('content').filterBy('isSaving', true).length > 0
).property('content.@each.isSaving')
transitionToPage: (forward) ->
page = if forward
parseInt(@get('page')) + 1
else
parseInt(@get('page')) - 1
@set('page', page)
@customTransitionToRoute('search.results', { queryParams: $.extend({}, @get('controllers.search.searchParams'), { page: page }) })
userCanEdit: (callback) ->
$.ajax({
type: 'GET'
url: "/trade/user_can_edit"
data: {}
dataType: 'json'
success: (response) =>
if response.can_edit
callback()
else
alert('It is not possible to perform this action. If you require further assistance please contact the Species team on PI:EMAIL:<EMAIL>END_PI')
error: (error) ->
console.log(error)
})
actions:
newShipment: () ->
shipment = Trade.Shipment.createRecord()
transaction = @get('transaction')
transaction.add(shipment)
@set('currentShipment', shipment)
$('.shipment-form-modal').modal('show')
# saves the new shipment (bound to currentShipment) to the db
saveShipment: (shipment, ignoreWarnings) ->
shipment.set('ignoreWarnings', ignoreWarnings)
# Before trying to save a shipment
# we need to reset the model to a valid state.
unless shipment.get('isValid')
shipment.send("becameValid")
unless shipment.get('isSaving')
transaction = @get('transaction')
transaction.add(shipment)
transaction.commit()
# this is here so that after another validation
# the user gets the secondary validation warning
shipment.set('propertyChanged', false)
shipment.one('didCreate', this, ->
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
@flashSuccess(message: 'Successfully created shipment.')
@send("dataChanged")
)
shipment.one('didUpdate', this, ->
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
@flashSuccess(message: 'Successfully updated shipment.')
)
cancelShipment: () ->
@get('transaction').rollback()
@set('currentShipment', null)
$('.shipment-form-modal').modal('hide')
cancelBatch: () ->
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
# discards the new shipment (bound to currentShipment)
deleteShipment: (shipment) ->
@userCanEdit( =>
if confirm("This will delete a shipment. Proceed?")
if (!shipment.get('isSaving'))
shipment.deleteRecord()
shipment.get('transaction').commit()
shipment.one('didDelete', this, ->
@set('currentShipment', null)
@flashSuccess(message: 'Successfully deleted shipment.')
@send("dataChanged")
)
)
deleteBatchTransition: ->
@userCanEdit( =>
@customTransitionToRoute('search.results', {queryParams: $.extend({}, @get('controllers.search.searchParams'), {mode: 'delete'})})
)
deleteBatch: ->
if confirm("This will delete #{@get('total')} shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/destroy_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
)
.done( (data) =>
@flashSuccess(message: "Successfully deleted #{data.rows} shipments.")
@send("dataChanged")
)
.fail( (xhr) =>
@flashError(message: 'Error occurred when deleting shipments.')
console.log "bad luck: ", xhr.responseText
)
.always( () =>
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
)
editShipment: (shipment) ->
transaction = @get('transaction')
transaction.add(shipment)
@set('currentShipment', shipment)
$('.shipment-form-modal').modal('show')
editBatchTransition: ->
@customTransitionToRoute('search.results', {queryParams: $.extend({}, @get('controllers.search.searchParams'), {mode: 'edit'})})
editBatch: ->
@get('batchUpdateParams').reset()
@set('currentShipment', @get('batchUpdateParams'))
$('.batch-form-modal').modal('show')
updateBatch: ->
updates = @get('batchUpdateParams').export()
if Object.keys(updates).length == 0
alert("No changes detected.")
return false
if confirm("This will update " + @get('total') + " shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/update_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
updates: updates
)
.done( (data) =>
@flashSuccess(message: 'Successfully updated ' + data.rows + ' shipments.')
@send("dataChanged")
)
.fail( (xhr) =>
@flashError(message: 'Error occurred when updating shipments.')
console.log "bad luck: ", xhr.responseText
)
.always( () =>
@set('currentShipment', null)
$('.batch-form-modal').modal('hide')
)
resolveReportedTaxonConcept: (reported_taxon_concept_id) ->
$.ajax(
url: '/trade/shipments/accepted_taxa_for_reported_taxon_concept'
type: 'GET'
data:
reported_taxon_concept_id: reported_taxon_concept_id
)
.done( (data) =>
first = data['shipments'].shift()
if first
taxon_concept_id = first.id
Trade.TaxonConcept.find(taxon_concept_id).then( () =>
@set('currentShipment.taxonConceptId', taxon_concept_id)
)
else
# there were no accepted names found, this is likely a data error
# so clear the accepted taxon to draw attention to it
@set('currentShipment.taxonConceptId', null)
)
|
[
{
"context": "()\napp.keys = [process.env.OBI_WEB_SESSION_KEY ? 'ObiLovesTheWeb']\napp\n .use require('koa-static')(\"#{__dirname}/",
"end": 308,
"score": 0.9909303784370422,
"start": 294,
"tag": "KEY",
"value": "ObiLovesTheWeb"
},
{
"context": " stream: bunyanLogentries.create... | server/application.coffee | burtonjc/obi-web | 0 | koa = require 'koa'
router = require('koa-router')()
logger = require 'koa-bunyan-logger'
bunyanLogentries = require 'bunyan-logentries'
passport = require 'koa-passport'
require('./passport').initialize()
require('./routes') router
app = koa()
app.keys = [process.env.OBI_WEB_SESSION_KEY ? 'ObiLovesTheWeb']
app
.use require('koa-static')("#{__dirname}/../client/dist/")
.use logger
name: 'obi-server'
level: process.env.LOG_LEVEL || 'debug'
streams: [
level: 'info'
stream: bunyanLogentries.createStream token: process.env.OBI_LOGENTRIES_TOKEN
type: 'raw'
,
level: 'info',
stream: process.stdout
]
.use logger.requestIdContext()
.use logger.timeContext()
.use logger.requestLogger()
.use require('koa-bodyparser')()
.use require('koa-render')("#{__dirname}/views", 'jade')
.use require('koa-generic-session')()
.use passport.initialize()
.use passport.session()
.use router.routes()
.use router.allowedMethods()
module.exports = app
| 100189 | koa = require 'koa'
router = require('koa-router')()
logger = require 'koa-bunyan-logger'
bunyanLogentries = require 'bunyan-logentries'
passport = require 'koa-passport'
require('./passport').initialize()
require('./routes') router
app = koa()
app.keys = [process.env.OBI_WEB_SESSION_KEY ? '<KEY>']
app
.use require('koa-static')("#{__dirname}/../client/dist/")
.use logger
name: 'obi-server'
level: process.env.LOG_LEVEL || 'debug'
streams: [
level: 'info'
stream: bunyanLogentries.createStream token: <KEY>.OBI<KEY>_LOGENTRIES_TOKEN
type: 'raw'
,
level: 'info',
stream: process.stdout
]
.use logger.requestIdContext()
.use logger.timeContext()
.use logger.requestLogger()
.use require('koa-bodyparser')()
.use require('koa-render')("#{__dirname}/views", 'jade')
.use require('koa-generic-session')()
.use passport.initialize()
.use passport.session()
.use router.routes()
.use router.allowedMethods()
module.exports = app
| true | koa = require 'koa'
router = require('koa-router')()
logger = require 'koa-bunyan-logger'
bunyanLogentries = require 'bunyan-logentries'
passport = require 'koa-passport'
require('./passport').initialize()
require('./routes') router
app = koa()
app.keys = [process.env.OBI_WEB_SESSION_KEY ? 'PI:KEY:<KEY>END_PI']
app
.use require('koa-static')("#{__dirname}/../client/dist/")
.use logger
name: 'obi-server'
level: process.env.LOG_LEVEL || 'debug'
streams: [
level: 'info'
stream: bunyanLogentries.createStream token: PI:KEY:<KEY>END_PI.OBIPI:KEY:<KEY>END_PI_LOGENTRIES_TOKEN
type: 'raw'
,
level: 'info',
stream: process.stdout
]
.use logger.requestIdContext()
.use logger.timeContext()
.use logger.requestLogger()
.use require('koa-bodyparser')()
.use require('koa-render')("#{__dirname}/views", 'jade')
.use require('koa-generic-session')()
.use passport.initialize()
.use passport.session()
.use router.routes()
.use router.allowedMethods()
module.exports = app
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.