it('download related schema', async () => { const actual = await dtsgenerator([ fs.readFileSync('./schema/simple_example.json', { encoding: 'utf-8' }) ]); const expected = fs.readFileSync('./test/expected_file/simple_schema.d.ts', { encoding: 'utf-8' }); assert.equal(actual, expected, actual); });
it('circular referenced schema', async () => { const actual = await dtsgenerator([ fs.readFileSync('./schema/circular.json', { encoding: 'utf-8' }) ]); const expected = fs.readFileSync('./test/expected_file/circular.d.ts', { encoding: 'utf-8' }); assert.equal(actual, expected, actual); });
it("change cell 2 width", function() { var item = ColumnHeaderItem.create().setWidth(200); var columnHeader = ColumnHeader.create().setItem(2, item); assert.equal(JSON.stringify(columnHeader.toMinJS()), JSON.stringify({ items: { 2: { width: 200 } } })); });
moxios.wait(() => { let response = onFulfilled.getCall(0).args[0]; equal(response.status, 204); let request = moxios.requests.get('PUT', '/users/12345'); notEqual(request, undefined); done(); });
it("columnNo=1 isRightBorder", function() { var point = new Point( viewModel.rowHeader.width + viewModel.columnHeader.items.get(1).width + 1, viewModel.columnHeader.height + 1); var columnInfo = clientPointToColumnInfo(viewModel, opeModel, point); // 対象列番号 assert.equal(columnInfo.columnNo, 1); // 左座標 assert.equal(columnInfo.left, viewModel.rowHeader.width); // 幅 assert.equal(columnInfo.width, viewModel.columnHeader.items.get(1).width); assert.equal(columnInfo.isRightBorder, true); });
it("columnNo=0", function() { var point = new Point( viewModel.rowHeader.width - 1, viewModel.columnHeader.height + 1); var columnInfo = clientPointToColumnInfo(viewModel, opeModel, point); // 対象列番号 assert.equal(columnInfo.columnNo, 0); // 左座標 assert.equal(columnInfo.left, 0); // 幅 assert.equal(columnInfo.width, viewModel.rowHeader.width); assert.equal(columnInfo.isRightBorder, false); });
it("non hit", function() { var columnInfo = new ColumnInfo(1, 50, 50, false); var rowInfo = new RowInfo(1, 18, 18, false); var columnHeader = pickColumnHeader(columnInfo, rowInfo, null); assert.equal(columnHeader, null); });
it('should parse arguments 2', () => { initialize([ 'node', 'script.js', '--out', 'output.d.ts', '--stdin', '--url', 'http://example.com/hoge/fuga', '--url', 'http://example.com/hoge/fuga2', './file1.json', '../file2.json', 'file3.json', ]); assert.deepEqual(opts.files, ['./file1.json', '../file2.json', 'file3.json']); assert.deepEqual(opts.urls, ['http://example.com/hoge/fuga', 'http://example.com/hoge/fuga2']); assert.equal(opts.stdin, true); assert.equal(opts.out, 'output.d.ts'); assert.equal(opts.isReadFromStdin(), true); });
it("change cell 2 width", function() { var item = RowHeaderItem.create().setHeight(200); var rowHeader = RowHeader.create().setItem(2, item); assert.equal(JSON.stringify(rowHeader.toMinJS()), JSON.stringify({ items: { 2: { height: 200 } } })); });
() => { var encodedValues = qs.stringify( { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, { encodeValuesOnly: true } ); assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h'); }