Skip to content

Commit

Permalink
Merge pull request #186 from steemit/fix-formatter
Browse files Browse the repository at this point in the history
Fix formatter path in test
  • Loading branch information
bonustrack committed Jun 26, 2017
2 parents 864299d + 826ff41 commit 09213cb
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 43 deletions.
3 changes: 2 additions & 1 deletion examples/get-post-content.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const steem = require('..');
const steem = require('../lib');

const resultP = steem.api.getContentAsync('yamadapc', 'test-1-2-3-4-5-6-7-9');
resultP.then(result => console.log(result));
4 changes: 2 additions & 2 deletions examples/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var steem = require('./../index');
var steem = require('../lib');

steem.api.getAccountCount(function(err, result) {
console.log(err, result);
Expand Down Expand Up @@ -32,4 +32,4 @@ steem.api.getDiscussionsByActive({
start_permlink: 'this-week-in-level-design-1-22-2017'
}, function(err, result) {
console.log(err, result);
});
});
2 changes: 1 addition & 1 deletion examples/test-vote.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const steem = require('..');
const steem = require('../lib');

const username = process.env.STEEM_USERNAME;
const password = process.env.STEEM_PASSWORD;
Expand Down
15 changes: 0 additions & 15 deletions index.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "steem",
"version": "0.5.18",
"description": "Steem.js the JavaScript API for Steem blockchain",
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"test": "eslint --quiet src test; mocha -t 20000 --require babel-polyfill --require babel-register",
"test-auth": "npm test -- --grep 'steem.auth'",
Expand Down
15 changes: 15 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const api = require('./api');
const auth = require('./auth');
const broadcast = require('./broadcast');
const formatter = require('./formatter')(api);
const memo = require('./auth/memo');
const config = require('./config');

module.exports = {
api,
auth,
broadcast,
formatter,
memo,
config,
};
34 changes: 16 additions & 18 deletions test/broadcast.test.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
import Promise from 'bluebird';
import should from 'should';
import steemAuth from '../src/auth';
import steemBroadcast from '../src/broadcast';
import packageJson from '../package.json';
import steem from '../src';

const username = process.env.STEEM_USERNAME || 'guest123';
const password = process.env.STEEM_PASSWORD;
const postingWif = password
? steemAuth.toWif(username, password, 'posting')
? steem.auth.toWif(username, password, 'posting')
: '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';

describe('steem.broadcast:', () => {
it('exists', () => {
should.exist(steemBroadcast);
should.exist(steem.broadcast);
});

it('has generated methods', () => {
should.exist(steemBroadcast.vote);
should.exist(steemBroadcast.voteWith);
should.exist(steemBroadcast.comment);
should.exist(steemBroadcast.transfer);
should.exist(steem.broadcast.vote);
should.exist(steem.broadcast.voteWith);
should.exist(steem.broadcast.comment);
should.exist(steem.broadcast.transfer);
});

it('has backing methods', () => {
should.exist(steemBroadcast.send);
should.exist(steem.broadcast.send);
});

it('has promise methods', () => {
should.exist(steemBroadcast.sendAsync);
should.exist(steemBroadcast.voteAsync);
should.exist(steemBroadcast.transferAsync);
should.exist(steem.broadcast.sendAsync);
should.exist(steem.broadcast.voteAsync);
should.exist(steem.broadcast.transferAsync);
});

describe('patching transaction with default global properties', () => {
it('works', async () => {
const tx = await steemBroadcast._prepareTransaction({
const tx = await steem.broadcast._prepareTransaction({
extensions: [],
operations: [['vote', {
voter: 'yamadapc',
Expand All @@ -55,7 +53,7 @@ describe('steem.broadcast:', () => {

describe('downvoting', () => {
it('works', async () => {
const tx = await steemBroadcast.voteAsync(
const tx = await steem.broadcast.voteAsync(
postingWif,
username,
'yamadapc',
Expand All @@ -80,7 +78,7 @@ describe('steem.broadcast:', () => {
});

it('works', async () => {
const tx = await steemBroadcast.voteAsync(
const tx = await steem.broadcast.voteAsync(
postingWif,
username,
'yamadapc',
Expand All @@ -99,7 +97,7 @@ describe('steem.broadcast:', () => {
});

it('works with callbacks', (done) => {
steemBroadcast.vote(
steem.broadcast.vote(
postingWif,
username,
'yamadapc',
Expand Down Expand Up @@ -127,7 +125,7 @@ describe('steem.broadcast:', () => {
});

it('works', async () => {
const tx = await steemBroadcast.customJsonAsync(
const tx = await steem.broadcast.customJsonAsync(
postingWif,
[],
[username],
Expand Down
9 changes: 4 additions & 5 deletions test/comment.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import Promise from 'bluebird';
import should from 'should';
import steemAuth from '../src/auth';
import steemBroadcast from '../src/broadcast';
import steem from '../src';
import pkg from '../package.json';

const username = process.env.STEEM_USERNAME || 'guest123';
const password = process.env.STEEM_PASSWORD;
const postingWif = password
? steemAuth.toWif(username, password, 'posting')
? steem.auth.toWif(username, password, 'posting')
: '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';

describe('steem.broadcast:', () => {
Expand All @@ -18,7 +17,7 @@ describe('steem.broadcast:', () => {
});

it('works', async () => {
const permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase();
const permlink = steem.formatter.commentPermlink('siol', 'test');
const operations = [
['comment',
{
Expand Down Expand Up @@ -52,7 +51,7 @@ describe('steem.broadcast:', () => {
}]
];

const tx = await steemBroadcast.sendAsync(
const tx = await steem.broadcast.sendAsync(
{ operations, extensions: [] },
{ posting: postingWif }
);
Expand Down

0 comments on commit 09213cb

Please sign in to comment.