example added
parent
42d56c4a1a
commit
14254cc819
@ -1,13 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"es2015",
|
||||
{
|
||||
"modules": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"external-helpers"
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1,77 +0,0 @@
|
||||
// Karma configuration
|
||||
// Generated on Fri Nov 03 2017 16:10:03 GMT+0600 (+06)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'test/*.js'
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'test/*.js': ['rollup']
|
||||
},
|
||||
|
||||
rollupPreprocessor: {
|
||||
plugins: [
|
||||
require('rollup-plugin-node-globals')(),
|
||||
require('rollup-plugin-node-builtins')(),
|
||||
require('rollup-plugin-babel')()
|
||||
],
|
||||
format: 'iife', // Helps prevent naming collisions.
|
||||
name: 'Decoder', // Required for 'iife' format.
|
||||
sourcemap: 'inline' // Sensible for testing.
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: false,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['Chrome'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: true,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/* global process */
|
||||
|
||||
// Rollup plugins
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import eslint from 'rollup-plugin-eslint';
|
||||
import replace from 'rollup-plugin-replace';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
|
||||
export default {
|
||||
input: 'src/opus-to-pcm.js',
|
||||
output: {
|
||||
file: 'dist/opus_to_pcm.js',
|
||||
format: 'iife',
|
||||
name: 'Decoder',
|
||||
sourcemap: false, //inline
|
||||
},
|
||||
plugins: [
|
||||
eslint(),
|
||||
babel({
|
||||
exclude: 'node_modules/**',
|
||||
}),
|
||||
replace({
|
||||
exclude: 'node_modules/**',
|
||||
ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||
}),
|
||||
(process.env.NODE_ENV === 'production' && uglify()),
|
||||
],
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
import {equal, deepEqual} from 'assert';
|
||||
import Event from '../src/utils/event.js';
|
||||
|
||||
var event = new Event('XYZ');
|
||||
|
||||
var callback = function() {
|
||||
};
|
||||
|
||||
describe('event tests --', function() {
|
||||
|
||||
beforeEach(function(){
|
||||
event.offAll();
|
||||
event.on('topic1',callback);
|
||||
event.on('topic1',callback);
|
||||
event.on('topic2',callback);
|
||||
});
|
||||
|
||||
it('listener should be 2 for the topic1', function() {
|
||||
equal(event.listener.topic1.length, 2);
|
||||
});
|
||||
|
||||
it('event dispatcher should be return true for a successful dispatcher', function() {
|
||||
equal(event.dispatch('topic1', true), true);
|
||||
});
|
||||
|
||||
it('listener should be zero after removing all listeners', function() {
|
||||
event.offAll();
|
||||
deepEqual(event.listener, {});
|
||||
});
|
||||
});
|
||||
|
@ -1,34 +0,0 @@
|
||||
import {equal} from 'assert';
|
||||
import Ogg from '../src/utils/ogg.js';
|
||||
var channel = 1,
|
||||
decoder = new Ogg(channel),
|
||||
audioCtx = new (window.AudioContext || window.webkitAudioContext)(),
|
||||
sampleRate = audioCtx.sampleRate;
|
||||
|
||||
|
||||
describe('Ogg tests -- ', function() {
|
||||
it('sample rate should be same system sample rate', function() {
|
||||
equal(decoder.getSampleRate(), sampleRate);
|
||||
});
|
||||
|
||||
it('magic Signature of ID header should be Opus Head', function() {
|
||||
var idHeader = decoder.getIDHeader();
|
||||
var dv = new DataView(idHeader.buffer);
|
||||
equal(dv.getUint32(0, true), 1937076303);
|
||||
equal(dv.getUint32(4, true), 1684104520);
|
||||
});
|
||||
|
||||
it('magic Signature of comment header should be Opus Tags', function() {
|
||||
var commonHeader = decoder.getCommentHeader();
|
||||
var dv = new DataView(commonHeader.buffer);
|
||||
equal(dv.getUint32(0, true), 1937076303);
|
||||
equal(dv.getUint32(4, true), 1936154964);
|
||||
});
|
||||
|
||||
it('page header should be started with OggS', function() {
|
||||
var segmentData = new Uint8Array(20);
|
||||
var page = decoder.getPage(segmentData, 4);
|
||||
var dv = new DataView(page.buffer);
|
||||
equal(dv.getUint32(0, true), 1399285583);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue