aboutsummaryrefslogtreecommitdiff
path: root/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-09 10:55:03 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-09 13:09:38 +0100
commit04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa (patch)
tree5c691241355c943a3c68ddb06b8cf8c60aa11319 /srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js
parent7e0d85db834d6351ed85d01e5126ac31dc510b86 (diff)
downloadft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.gz
ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.bz2
ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.zip
phpmyadmin working
Diffstat (limited to 'srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js')
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js193
1 files changed, 193 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js
new file mode 100644
index 0000000..007207e
--- /dev/null
+++ b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/cleaner.js
@@ -0,0 +1,193 @@
+'use strict';
+
+const expect = require('chai').expect;
+const cleaner = require(__dirname + '/../src/cleaner');
+
+module.exports = function() {
+ suite('cleaner', function() {
+ test('clean cli html code', function(done) {
+ const cli = cleaner.cleanCli('<code>--test-argument</code>');
+ expect(cli).to.equal('--test-argument');
+ done();
+ });
+ test('clean cli html code not closed', function(done) {
+ const cli = cleaner.cleanCli('<code>--test-argument');
+ expect(cli).to.equal('--test-argument');
+ done();
+ });
+ test('clean cli nothing to clean', function(done) {
+ const cli = cleaner.cleanCli('--test-argument');
+ expect(cli).to.equal('--test-argument');
+ done();
+ });
+ test('clean cli undefined', function(done) {
+ const cli = cleaner.cleanCli(undefined);
+ expect(cli).to.equal(undefined);
+ done();
+ });
+ test('clean range undefined', function(done) {
+ const range = cleaner.cleanRange(undefined);
+ expect(range).to.deep.equal(undefined);
+ done();
+ });
+ test('clean range.from typeof object (dataset-1)', function(done) {
+ const range = cleaner.cleanRange({
+ from: null,
+ to: null,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof object (dataset-2)', function(done) {
+ const range = cleaner.cleanRange({
+ to: null,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof object (dataset-3)', function(done) {
+ const range = cleaner.cleanRange({
+ from: null,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof object (dataset-4)', function(done) {
+ const range = cleaner.cleanRange({
+ from: undefined,
+ to: undefined,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof object (dataset-5)', function(done) {
+ const range = cleaner.cleanRange({
+ to: undefined,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof object (dataset-6)', function(done) {
+ const range = cleaner.cleanRange({
+ from: undefined,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof object (dataset-7)', function(done) {
+ const range = cleaner.cleanRange({
+ from: NaN,
+ to: NaN,
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.from typeof int', function(done) {
+ const range = cleaner.cleanRange({
+ from: 1024,
+ });
+ expect(range).to.deep.equal({
+ from: 1024,
+ });
+ done();
+ });
+ test('clean range.from typeof string', function(done) {
+ const range = cleaner.cleanRange({
+ from: '1024',
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.to typeof int', function(done) {
+ const range = cleaner.cleanRange({
+ to: 1024,
+ });
+ expect(range).to.deep.equal({
+ to: 1024,
+ });
+ done();
+ });
+ test('clean range.to typeof string', function(done) {
+ const range = cleaner.cleanRange({
+ to: '1024',
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range.to typeof object', function(done) {
+ const range = cleaner.cleanRange({
+ to: {},
+ });
+ expect(range).to.deep.equal({});
+ done();
+ });
+ test('clean range to upwards', function(done) {
+ const range = cleaner.cleanRange({
+ to: 'upwards',
+ });
+ expect(range).to.deep.equal({
+ to: 'upwards',
+ });
+ done();
+ });
+ test('clean range to upwards match', function(done) {
+ const range = cleaner.cleanRange({
+ to: '(128KB) upwards',
+ });
+ expect(range).to.deep.equal({
+ to: 'upwards',
+ });
+ done();
+ });
+ test('clean binary types in bytes', function(done) {
+ const type = cleaner.cleanType('in bytes');
+ expect(type).to.deep.equal('byte');
+ done();
+ });
+ test('clean binary types size in mb', function(done) {
+ const type = cleaner.cleanType('size in mb');
+ expect(type).to.deep.equal('byte');
+ done();
+ });
+ test('clean binary types number of bytes', function(done) {
+ const type = cleaner.cleanType('number of bytes');
+ expect(type).to.deep.equal('byte');
+ done();
+ });
+ test('clean binary types number of', function(done) {
+ const type = cleaner.cleanType('number of');
+ expect(type).to.deep.equal('integer');
+ done();
+ });
+ test('clean binary types size of', function(done) {
+ const type = cleaner.cleanType('size of');
+ expect(type).to.deep.equal('integer');
+ done();
+ });
+ test('clean binary types in microseconds', function(done) {
+ const type = cleaner.cleanType('in microseconds');
+ expect(type).to.deep.equal('integer');
+ done();
+ });
+ test('clean binary types in seconds', function(done) {
+ const type = cleaner.cleanType('in seconds');
+ expect(type).to.deep.equal('integer');
+ done();
+ });
+ test('clean wtf type', function(done) {
+ const type = cleaner.cleanType('wtf');
+ expect(type).to.deep.equal(undefined);
+ done();
+ });
+ test('clean enumeration type', function(done) {
+ const type = cleaner.cleanType('enumeration');
+ expect(type).to.deep.equal('enumeration');
+ done();
+ });
+ test('clean undefined type', function(done) {
+ const type = cleaner.cleanType(undefined);
+ expect(type).to.deep.equal(undefined);
+ done();
+ });
+ });
+};