Skip to content

Commit

Permalink
mocha: suite/test => describe/it
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Dec 3, 2020
1 parent 3f43432 commit 2fcfa81
Show file tree
Hide file tree
Showing 68 changed files with 137 additions and 138 deletions.
2 changes: 1 addition & 1 deletion test/00-units.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var path = require('path');
var fs = require('fs');


suite('Units', function () {
describe('Units', function () {
var directory = path.resolve(__dirname, 'units');

fs.readdirSync(directory).forEach(function (file) {
Expand Down
4 changes: 2 additions & 2 deletions test/10-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ var yaml = require('../');
var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA;


suite('Loader', function () {
describe('Loader', function () {
var samplesDir = path.resolve(__dirname, 'samples-common');

fs.readdirSync(samplesDir).forEach(function (jsFile) {
if (path.extname(jsFile) !== '.js') return; // continue

var yamlFile = path.resolve(samplesDir, path.basename(jsFile, '.js') + '.yml');

test(path.basename(jsFile, '.js'), function () {
it(path.basename(jsFile, '.js'), function () {
var expected = require(path.resolve(samplesDir, jsFile));
var actual = [];

Expand Down
4 changes: 2 additions & 2 deletions test/11-load-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ var yaml = require('../');
var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA;


suite('Load errors', function () {
describe('Load errors', function () {
var samplesDir = path.resolve(__dirname, 'samples-load-errors');

fs.readdirSync(samplesDir).forEach(function (sampleName) {
var yamlFile = path.resolve(samplesDir, sampleName);

test(path.basename(sampleName, '.yml'), function () {
it(path.basename(sampleName, '.yml'), function () {
var yamlSource = fs.readFileSync(yamlFile, { encoding: 'utf8' });

assert.throws(function () {
Expand Down
4 changes: 2 additions & 2 deletions test/20-dumper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ var yaml = require('../');
var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA;


suite('Dumper', function () {
describe('Dumper', function () {
var samplesDir = path.resolve(__dirname, 'samples-common');

fs.readdirSync(samplesDir).forEach(function (jsFile) {
if (path.extname(jsFile) !== '.js') return; // continue

test(path.basename(jsFile, '.js'), function () {
it(path.basename(jsFile, '.js'), function () {
var sample = require(path.resolve(samplesDir, jsFile));
var data = typeof sample === 'function' ? sample.expected : sample,
serialized = yaml.dump(data, { schema: TEST_SCHEMA }),
Expand Down
4 changes: 2 additions & 2 deletions test/25-dumper-fuzzy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ var dumpOptionsArbitrary = fc.record({
return instance;
});

suite('Properties', function () {
test('Load from dumped should be the original object', function () {
describe('Properties', function () {
it('Load from dumped should be the original object', function () {
fc.assert(fc.property(
yamlArbitrary,
dumpOptionsArbitrary,
Expand Down
2 changes: 1 addition & 1 deletion test/30-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var path = require('path');
var fs = require('fs');


suite('Issues', function () {
describe('Issues', function () {
var issues = path.resolve(__dirname, 'issues');

fs.readdirSync(issues).forEach(function (file) {
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0008.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Parse failed when no document start present', function () {
it('Parse failed when no document start present', function () {
assert.doesNotThrow(function () {
yaml.load(readFileSync(require('path').join(__dirname, '/0008.yml'), 'utf8'));
}, TypeError);
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0017.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Non-specific "!" tags should resolve to !!str', function () {
it('Non-specific "!" tags should resolve to !!str', function () {
var data = yaml.load(readFileSync(require('path').join(__dirname, '/0017.yml'), 'utf8'));

assert.strictEqual(typeof data, 'string');
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0019.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Timestamp parsing is one month off', function () {
it('Timestamp parsing is one month off', function () {
var data = yaml.load(readFileSync(require('path').join(__dirname, '/0019.yml'), 'utf8'));

// JS month starts with 0 (0 => Jan, 1 => Feb, ...)
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0026.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('should convert new line into white space', function () {
it('should convert new line into white space', function () {
var data = yaml.load(readFileSync(require('path').join(__dirname, '/0026.yml'), 'utf8'));

assert.strictEqual(data.test, 'a b c\n');
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0033.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('refactor compact variant of MarkedYAMLError.toString', function () {
it('refactor compact variant of MarkedYAMLError.toString', function () {
var source = readFileSync(require('path').join(__dirname, '/0033.yml'), 'utf8');

assert.throws(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0046.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Timestamps are incorrectly parsed in local time', function () {
it('Timestamps are incorrectly parsed in local time', function () {
var data = yaml.load(readFileSync(require('path').join(__dirname, '/0046.yml'), 'utf8')),
date1, date2;

Expand Down
2 changes: 1 addition & 1 deletion test/issues/0054.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test("Incorrect utf-8 handling on require('file.yaml')", function () {
it("Incorrect utf-8 handling on require('file.yaml')", function () {
var data = yaml.load(readFileSync(require('path').join(__dirname, '/0054.yml'), 'utf8')),
expected = '',
index;
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0063.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Invalid errors/warnings of invalid indentation on flow scalars', function () {
it('Invalid errors/warnings of invalid indentation on flow scalars', function () {
var sources = [
'text:\n hello\n world', // plain style
"text:\n 'hello\n world'", // single-quoted style
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0064.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Wrong error message when yaml file contains tabs', function () {
it('Wrong error message when yaml file contains tabs', function () {
assert.doesNotThrow(
function () { yaml.load(readFileSync(require('path').join(__dirname, '/0064.yml'), 'utf8')); },
yaml.YAMLException);
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0068.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Prevent adding unnecessary space character to end of a line within block collections', function () {
it('Prevent adding unnecessary space character to end of a line within block collections', function () {
assert.strictEqual(yaml.dump({ data: [ 'foo', 'bar', 'baz' ] }), 'data:\n - foo\n - bar\n - baz\n');
assert.strictEqual(yaml.dump({ foo: { bar: [ 'baz' ] } }), 'foo:\n bar:\n - baz\n');
});
2 changes: 1 addition & 1 deletion test/issues/0085.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var DEPRECATED_BOOLEANS_SYNTAX = [
];


test('Dumper should take into account booleans syntax from YAML 1.0/1.1', function () {
it('Dumper should take into account booleans syntax from YAML 1.0/1.1', function () {
DEPRECATED_BOOLEANS_SYNTAX.forEach(function (string) {
var dump = yaml.dump(string).trim();

Expand Down
2 changes: 1 addition & 1 deletion test/issues/0092.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Invalid parse error on whitespace between quoted scalar keys and ":" symbol in mappings', function () {
it('Invalid parse error on whitespace between quoted scalar keys and ":" symbol in mappings', function () {
assert.doesNotThrow(function () {
yaml.load('{ "field1" : "v1", "field2": "v2" }');
});
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0093.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Unwanted line breaks in folded scalars', function () {
it('Unwanted line breaks in folded scalars', function () {
var data = yaml.load(readFileSync(require('path').join(__dirname, '/0093.yml'), 'utf8'));

assert.strictEqual(data.first, 'a b\n c\n d\ne f\n');
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0095.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Empty block scalars loaded wrong', function () {
it('Empty block scalars loaded wrong', function () {
assert.deepStrictEqual(yaml.load('a: |\nb: .'), { a: '', b: '.' });
assert.deepStrictEqual(yaml.load('a: |+\nb: .'), { a: '', b: '.' });
assert.deepStrictEqual(yaml.load('a: |-\nb: .'), { a: '', b: '.' });
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0108.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Literal scalars have an unwanted leading line break', function () {
it('Literal scalars have an unwanted leading line break', function () {
assert.strictEqual(yaml.load('|\n foobar\n'), 'foobar\n');
assert.strictEqual(yaml.load('|\n hello\n world\n'), 'hello\nworld\n');
assert.strictEqual(yaml.load('|\n war never changes\n'), 'war never changes\n');
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0110.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Circular and cross references', function () {
it('Circular and cross references', function () {
var source = {
a: { a: 1 },
b: [ 1, 2 ],
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0112.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Plain scalar "constructor" parsed as `null`', function () {
it('Plain scalar "constructor" parsed as `null`', function () {
assert.strictEqual(yaml.load('constructor'), 'constructor');
assert.deepStrictEqual(yaml.load('constructor: value'), { constructor: 'value' });
assert.deepStrictEqual(yaml.load('key: constructor'), { key: 'constructor' });
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0117.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ var assert = require('assert');
var yaml = require('../../');


test('Negative zero loses the sign after dump', function () {
it('Negative zero loses the sign after dump', function () {
assert.strictEqual(yaml.dump(-0), '-0.0\n');
});
2 changes: 1 addition & 1 deletion test/issues/0144.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ var assert = require('assert');
var yaml = require('../../');


test('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () {
it('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () {
assert.strictEqual(yaml.load('--- |\nfoo\n'), 'foo\n');
});
2 changes: 1 addition & 1 deletion test/issues/0154.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Indentation warning on empty lines within quoted scalars and flow collections', function () {
it('Indentation warning on empty lines within quoted scalars and flow collections', function () {
assert.doesNotThrow(function () { yaml.load("- 'hello\n\n world'"); });
assert.doesNotThrow(function () { yaml.load('- "hello\n\n world"'); });
assert.doesNotThrow(function () { yaml.load('- [hello,\n\n world]'); });
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0155.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ var assert = require('assert');
var yaml = require('../../');


test('Named null', function () {
it('Named null', function () {
assert.deepStrictEqual(yaml.load('---\ntest: !!null \nfoo: bar'), { test: null, foo: 'bar' });
});
2 changes: 1 addition & 1 deletion test/issues/0156.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ var TestClassYaml = new yaml.Type('!test', {
var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ TestClassYaml ]);


test('Resolving of empty nodes are skipped in some cases', function () {
it('Resolving of empty nodes are skipped in some cases', function () {
assert.throws(function () { yaml.load('- foo: !test\n- bar: baz', { schema: TEST_SCHEMA }); }, SuccessSignal);
});
2 changes: 1 addition & 1 deletion test/issues/0160.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ var assert = require('assert');
var yaml = require('../../');


test('Correct encoding of UTF-16 surrogate pairs', function () {
it('Correct encoding of UTF-16 surrogate pairs', function () {
assert.strictEqual(yaml.load('"\\U0001F431"'), '🐱');
});
2 changes: 1 addition & 1 deletion test/issues/0194.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Don\'t throw on warning', function () {
it('Don\'t throw on warning', function () {
var src = readFileSync(require('path').join(__dirname, '/0194.yml'), 'utf8'),
warnings = [],
data;
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0203.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Don\'t throw on warning', function () {
it('Don\'t throw on warning', function () {
var src = readFileSync(require('path').join(__dirname, '/0203.yml'), 'utf8');

assert.deepStrictEqual(yaml.load(src), { test: '\n\nHello\nworld' });
Expand Down
4 changes: 2 additions & 2 deletions test/issues/0205.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Duplicated objects within array', function () {
it('Duplicated objects within array', function () {
var obj = { test: 'canary' };
var arrayWithRefs = [ obj, obj ];

Expand All @@ -15,7 +15,7 @@ test('Duplicated objects within array', function () {
assert.strictEqual(obtained[0], obtained[1]);
});

test('Duplicated arrays within array', function () {
it('Duplicated arrays within array', function () {
var array = [ 0, 1 ];
var arrayWithRefs = [ array, array ];

Expand Down
2 changes: 1 addition & 1 deletion test/issues/0220.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test('Float type dumper should not miss dot', function () {
it('Float type dumper should not miss dot', function () {
assert.strictEqual(5e-100.toString(10), '5e-100');
assert.strictEqual(0.5e-100.toString(10), '5e-101');

Expand Down
2 changes: 1 addition & 1 deletion test/issues/0221.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var assert = require('assert');
var yaml = require('../../');


test.skip('Block scalar chomping does not work on zero indent', function () {
it.skip('Block scalar chomping does not work on zero indent', function () {
assert.throws(function () { yaml.load('|-\nfoo\nbar'); }, yaml.YAMLException);
assert.deepStrictEqual(yaml.dump('foo\nbar'), '|-\n foo\nbar');
});
4 changes: 2 additions & 2 deletions test/issues/0235.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
var assert = require('assert');
var yaml = require('../../');

test('Flow style does not dump with block literals.', function () {
it('Flow style does not dump with block literals.', function () {
assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 0 }), '{a: "\\n"}\n');
});

test('Ok to dump block-style literals when not yet flowing.', function () {
it('Ok to dump block-style literals when not yet flowing.', function () {
// cf. example 8.6 from the YAML 1.2 spec
assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 2 }), 'a: |+\n\n');
});
4 changes: 2 additions & 2 deletions test/issues/0243.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var yaml = require('../../');
var readFileSync = require('fs').readFileSync;


test('Duplicated mapping key errors on top level throw at beginning of key', function () {
it('Duplicated mapping key errors on top level throw at beginning of key', function () {
var src = readFileSync(require('path').join(__dirname, '/0243-basic.yml'), 'utf8');
var lines = src.split('\n');

Expand All @@ -17,7 +17,7 @@ test('Duplicated mapping key errors on top level throw at beginning of key', fun
}
});

test('Duplicated mapping key errors inside of mapping values throw at beginning of key', function () {
it('Duplicated mapping key errors inside of mapping values throw at beginning of key', function () {
var src = readFileSync(require('path').join(__dirname, '/0243-nested.yml'), 'utf8');
var lines = src.split('\n');

Expand Down
4 changes: 2 additions & 2 deletions test/issues/0248-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var assert = require('assert');
var yaml = require('../../');

test('Listener informed on a very simple scalar.', function () {
it('Listener informed on a very simple scalar.', function () {
var history = [];
function l(eventType, state) {
history.push([ eventType, state.position ]);
Expand All @@ -21,7 +21,7 @@ test('Listener informed on a very simple scalar.', function () {
assert.strictEqual(history[3][1], 16);
});

test('Listener informed on a map with a list.', function () {
it('Listener informed on a map with a list.', function () {
var history = [];
function l(eventType, state) {
history.push([ eventType, state.position, state.result ]);
Expand Down
2 changes: 1 addition & 1 deletion test/issues/0266.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var DEPRECATED_BOOLEANS_SYNTAX = [
];


test('Dumper should not take into account booleans syntax from YAML 1.0/1.1 in noCompatMode', function () {
it('Dumper should not take into account booleans syntax from YAML 1.0/1.1 in noCompatMode', function () {
DEPRECATED_BOOLEANS_SYNTAX.forEach(function (string) {
var dump = yaml.dump(string, { noCompatMode: true }).trim();

Expand Down
Loading

0 comments on commit 2fcfa81

Please sign in to comment.