Skip to content

Commit

Permalink
test(e2e): fix magistrate tests (#3849)
Browse files Browse the repository at this point in the history
  • Loading branch information
air1one authored Jun 29, 2020
1 parent 511e575 commit ed91409
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ const testUtils = require("../../../../lib/utils/test-utils");
const utils = require("./utils");

describe("Check that the business was registered", () => {
it("should have the business registered", async () => {
const businessResponse = await testUtils.GET("businesses");
testUtils.expectSuccessful(businessResponse);

const businesses = businessResponse.data.data;
expect(businesses).toBeArrayOfSize(1);
expect(businesses[0].name).toBe(utils.businessRegistrationAsset.name);
expect(businesses[0].website).toBe(utils.businessRegistrationAsset.website);
expect(businesses[0].publicKey).toBe(utils.wallets.businessRegistration.publicKey);
});

it("should have set the wallet business attribute", async () => {
const walletResponse = await testUtils.GET(`wallets/${utils.wallets.businessRegistration.publicKey}`);
testUtils.expectSuccessful(walletResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ const testUtils = require("../../../../lib/utils/test-utils");
const utils = require("./utils");

describe("Check that the business was updated", () => {
it("should have the business updated", async () => {
const businessResponse = await testUtils.GET("businesses");
testUtils.expectSuccessful(businessResponse);

const businesses = businessResponse.data.data;
expect(businesses).toBeArrayOfSize(1);
expect(businesses[0].name).toBe(utils.businessUpdateAsset.name);
expect(businesses[0].website).toBe(utils.businessUpdateAsset.website);
expect(businesses[0].publicKey).toBe(utils.wallets.businessRegistration.publicKey);
});

it("should have set the wallet business attribute", async () => {
const walletResponse = await testUtils.GET(`wallets/${utils.wallets.businessRegistration.publicKey}`);
testUtils.expectSuccessful(walletResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ const testUtils = require("../../../../lib/utils/test-utils");
const utils = require("./utils");

describe("Check that the bridgechain was registered", () => {
it("should have the bridgechain registered", async () => {
const bridgechainResponse = await testUtils.GET("bridgechains");
testUtils.expectSuccessful(bridgechainResponse);
it("should have set the wallet bridgechain attribute", async () => {
const walletResponse = await testUtils.GET(`wallets/${utils.wallets.businessRegistration.publicKey}`);
testUtils.expectSuccessful(walletResponse);

const bridgechains = bridgechainResponse.data.data;
expect(bridgechains).toBeArrayOfSize(1);
expect(bridgechains[0].name).toBe(utils.bridgechainRegistrationAsset.name);
expect(bridgechains[0].seedNodes).toEqual(utils.bridgechainRegistrationAsset.seedNodes);
expect(bridgechains[0].bridgechainRepository).toBe(utils.bridgechainRegistrationAsset.bridgechainRepository);
expect(bridgechains[0].bridgechainAssetRepository).toBe(utils.bridgechainRegistrationAsset.bridgechainAssetRepository);
expect(bridgechains[0].genesisHash).toBe(utils.bridgechainRegistrationAsset.genesisHash);
expect(bridgechains[0].ports).toEqual(utils.bridgechainRegistrationAsset.ports);
const wallet = walletResponse.data.data;
expect(wallet).toBeObject();

const business = wallet.attributes.business;
expect(business).toBeObject();
expect(business.bridgechains).toEqual({
[utils.bridgechainRegistrationAsset.genesisHash]: {
bridgechainAsset: {
name: utils.bridgechainRegistrationAsset.name,
seedNodes: utils.bridgechainRegistrationAsset.seedNodes,
genesisHash: utils.bridgechainRegistrationAsset.genesisHash,
bridgechainRepository: utils.bridgechainRegistrationAsset.bridgechainRepository,
ports: utils.bridgechainRegistrationAsset.ports,
bridgechainAssetRepository: utils.bridgechainRegistrationAsset.bridgechainAssetRepository,
}
}
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ const testUtils = require("../../../../lib/utils/test-utils");
const utils = require("./utils");

describe("Check that the bridgechain was updated", () => {
it("should have the bridgechain updated", async () => {
const bridgechainResponse = await testUtils.GET("bridgechains");
testUtils.expectSuccessful(bridgechainResponse);
it("should have updated the wallet bridgechain attribute", async () => {
const walletResponse = await testUtils.GET(`wallets/${utils.wallets.businessRegistration.publicKey}`);
testUtils.expectSuccessful(walletResponse);

const bridgechains = bridgechainResponse.data.data;
expect(bridgechains).toBeArrayOfSize(1);
expect(bridgechains[0].name).toBe(utils.bridgechainRegistrationAsset.name);
expect(bridgechains[0].genesisHash).toBe(utils.bridgechainRegistrationAsset.genesisHash);
expect(bridgechains[0].seedNodes).toEqual(utils.bridgechainUpdateAsset.seedNodes);
expect(bridgechains[0].bridgechainRepository).toBe(utils.bridgechainUpdateAsset.bridgechainRepository);
expect(bridgechains[0].bridgechainAssetRepository).toBe(utils.bridgechainUpdateAsset.bridgechainAssetRepository);
expect(bridgechains[0].ports).toEqual(utils.bridgechainUpdateAsset.ports);
const wallet = walletResponse.data.data;
expect(wallet).toBeObject();

const business = wallet.attributes.business;
expect(business).toBeObject();
expect(business.bridgechains).toEqual({
[utils.bridgechainRegistrationAsset.genesisHash]: {
bridgechainAsset: {
name: utils.bridgechainRegistrationAsset.name,
seedNodes: utils.bridgechainUpdateAsset.seedNodes,
genesisHash: utils.bridgechainRegistrationAsset.genesisHash,
bridgechainRepository: utils.bridgechainUpdateAsset.bridgechainRepository,
ports: utils.bridgechainUpdateAsset.ports,
bridgechainAssetRepository: utils.bridgechainUpdateAsset.bridgechainAssetRepository,
}
}
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ const testUtils = require("../../../../lib/utils/test-utils");
const utils = require("./utils");

describe("Check that the bridgechain was resigned", () => {
it("should have the bridgechain resigned", async () => {
const bridgechainResponse = await testUtils.GET("bridgechains");
testUtils.expectSuccessful(bridgechainResponse);
it("should have the wallet bridgechain attribute resigned", async () => {
const walletResponse = await testUtils.GET(`wallets/${utils.wallets.businessRegistration.publicKey}`);
testUtils.expectSuccessful(walletResponse);

const bridgechains = bridgechainResponse.data.data;
expect(bridgechains).toBeArrayOfSize(1);
expect(bridgechains[0].isResigned).toBeTrue();
const wallet = walletResponse.data.data;
expect(wallet).toBeObject();

const business = wallet.attributes.business;
expect(business).toBeObject();
expect(business.bridgechains[utils.bridgechainRegistrationAsset.genesisHash]).toBeObject();
expect(business.bridgechains[utils.bridgechainRegistrationAsset.genesisHash].resigned).toBeTrue();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ const testUtils = require("../../../../lib/utils/test-utils");
const utils = require("./utils");

describe("Check that the business was resigned", () => {
it("should have the business resigned", async () => {
const businessResponse = await testUtils.GET("businesses");
testUtils.expectSuccessful(businessResponse);
it("should have the wallet business attribute resigned", async () => {
const walletResponse = await testUtils.GET(`wallets/${utils.wallets.businessRegistration.publicKey}`);
testUtils.expectSuccessful(walletResponse);

const businesses = businessResponse.data.data;
expect(businesses).toBeArrayOfSize(1);
expect(businesses[0].isResigned).toBeTrue();
const wallet = walletResponse.data.data;
expect(wallet).toBeObject();

const business = wallet.attributes.business;
expect(business).toBeObject();
expect(business.resigned).toBeTrue();
});
});

0 comments on commit ed91409

Please sign in to comment.