Update Node_modules
This commit is contained in:
+49
-43
@@ -1,70 +1,76 @@
|
||||
import test from 'ava'
|
||||
import saslprep from '../'
|
||||
'use strict';
|
||||
|
||||
const chr = String.fromCodePoint
|
||||
const saslprep = require('..');
|
||||
|
||||
test('should work with liatin letters', (t) => {
|
||||
const str = 'user'
|
||||
t.is(saslprep(str), str)
|
||||
})
|
||||
const chr = String.fromCodePoint;
|
||||
|
||||
test('should work be case preserved', (t) => {
|
||||
const str = 'USER'
|
||||
t.is(saslprep(str), str)
|
||||
})
|
||||
test('should work with liatin letters', () => {
|
||||
const str = 'user';
|
||||
expect(saslprep(str)).toEqual(str);
|
||||
});
|
||||
|
||||
test('should remove `mapped to nothing` characters', (t) => {
|
||||
t.is(saslprep('I\u00ADX'), 'IX')
|
||||
})
|
||||
test('should work be case preserved', () => {
|
||||
const str = 'USER';
|
||||
expect(saslprep(str)).toEqual(str);
|
||||
});
|
||||
|
||||
test('should replace `Non-ASCII space characters` with space', (t) => {
|
||||
t.is(saslprep('a\u00A0b'), 'a\u0020b')
|
||||
})
|
||||
test('should work with high code points (> U+FFFF)', () => {
|
||||
const str = '\uD83D\uDE00';
|
||||
expect(saslprep(str, { allowUnassigned: true })).toEqual(str);
|
||||
});
|
||||
|
||||
test('should normalize as NFKC', (t) => {
|
||||
t.is(saslprep('\u00AA'), 'a')
|
||||
t.is(saslprep('\u2168'), 'IX')
|
||||
})
|
||||
test('should remove `mapped to nothing` characters', () => {
|
||||
expect(saslprep('I\u00ADX')).toEqual('IX');
|
||||
});
|
||||
|
||||
test('should throws when prohibited characters', (t) => {
|
||||
test('should replace `Non-ASCII space characters` with space', () => {
|
||||
expect(saslprep('a\u00A0b')).toEqual('a\u0020b');
|
||||
});
|
||||
|
||||
test('should normalize as NFKC', () => {
|
||||
expect(saslprep('\u00AA')).toEqual('a');
|
||||
expect(saslprep('\u2168')).toEqual('IX');
|
||||
});
|
||||
|
||||
test('should throws when prohibited characters', () => {
|
||||
// C.2.1 ASCII control characters
|
||||
t.throws(() => saslprep('a\u007Fb'))
|
||||
expect(() => saslprep('a\u007Fb')).toThrow();
|
||||
|
||||
// C.2.2 Non-ASCII control characters
|
||||
t.throws(() => saslprep('a\u06DDb'))
|
||||
expect(() => saslprep('a\u06DDb')).toThrow();
|
||||
|
||||
// C.3 Private use
|
||||
t.throws(() => saslprep('a\uE000b'))
|
||||
expect(() => saslprep('a\uE000b')).toThrow();
|
||||
|
||||
// C.4 Non-character code points
|
||||
t.throws(() => saslprep(`a${chr(0x1FFFE)}b`))
|
||||
expect(() => saslprep(`a${chr(0x1fffe)}b`)).toThrow();
|
||||
|
||||
// C.5 Surrogate codes
|
||||
t.throws(() => saslprep('a\uD800b'))
|
||||
expect(() => saslprep('a\uD800b')).toThrow();
|
||||
|
||||
// C.6 Inappropriate for plain text
|
||||
t.throws(() => saslprep('a\uFFF9b'))
|
||||
expect(() => saslprep('a\uFFF9b')).toThrow();
|
||||
|
||||
// C.7 Inappropriate for canonical representation
|
||||
t.throws(() => saslprep('a\u2FF0b'))
|
||||
expect(() => saslprep('a\u2FF0b')).toThrow();
|
||||
|
||||
// C.8 Change display properties or are deprecated
|
||||
t.throws(() => saslprep('a\u200Eb'))
|
||||
expect(() => saslprep('a\u200Eb')).toThrow();
|
||||
|
||||
// C.9 Tagging characters
|
||||
t.throws(() => saslprep(`a${chr(0xE0001)}b`))
|
||||
})
|
||||
expect(() => saslprep(`a${chr(0xe0001)}b`)).toThrow();
|
||||
});
|
||||
|
||||
test('should not containt RandALCat and LCat bidi', (t) => {
|
||||
t.throws(() => saslprep('a\u06DD\u00AAb'))
|
||||
})
|
||||
test('should not containt RandALCat and LCat bidi', () => {
|
||||
expect(() => saslprep('a\u06DD\u00AAb')).toThrow();
|
||||
});
|
||||
|
||||
test('RandALCat should be first and last', (t) => {
|
||||
t.notThrows(() => saslprep('\u0627\u0031\u0628'))
|
||||
t.throws(() => saslprep('\u0627\u0031'))
|
||||
})
|
||||
test('RandALCat should be first and last', () => {
|
||||
expect(() => saslprep('\u0627\u0031\u0628')).not.toThrow();
|
||||
expect(() => saslprep('\u0627\u0031')).toThrow();
|
||||
});
|
||||
|
||||
test('should handle unassigned code points', (t) => {
|
||||
t.throws(() => saslprep('a\u0487'))
|
||||
t.notThrows(() => saslprep('a\u0487', {allowUnassigned: true}))
|
||||
})
|
||||
test('should handle unassigned code points', () => {
|
||||
expect(() => saslprep('a\u0487')).toThrow();
|
||||
expect(() => saslprep('a\u0487', { allowUnassigned: true })).not.toThrow();
|
||||
});
|
||||
|
||||
+12
-11
@@ -1,15 +1,16 @@
|
||||
import { setFlagsFromString } from 'v8'
|
||||
import { range } from '../lib/util'
|
||||
import test from 'ava'
|
||||
'use strict';
|
||||
|
||||
const { setFlagsFromString } = require('v8');
|
||||
const { range } = require('../lib/util');
|
||||
|
||||
// 984 by default.
|
||||
setFlagsFromString('--stack_size=500')
|
||||
setFlagsFromString('--stack_size=500');
|
||||
|
||||
test('should work', (t) => {
|
||||
const list = range(1, 3)
|
||||
t.deepEqual(list, [1, 2, 3])
|
||||
})
|
||||
test('should work', () => {
|
||||
const list = range(1, 3);
|
||||
expect(list).toEqual([1, 2, 3]);
|
||||
});
|
||||
|
||||
test('should work for large ranges', (t) => {
|
||||
t.notThrows(() => range(1, 1e6))
|
||||
})
|
||||
test('should work for large ranges', () => {
|
||||
expect(() => range(1, 1e6)).not.toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user