Skip to content

Commit

Permalink
fixup! use single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
biniam committed Jul 6, 2017
1 parent 545fa6c commit 19964a3
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions services/account-without-juggler/test/unit/account-controller.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
import { AccountController } from "../../controllers/AccountController";
import { expect } from "@loopback/testlab";
import { accountRepository } from "../../repositories/account";
import { AccountController } from '../../controllers/AccountController';
import { expect } from '@loopback/testlab';
import { accountRepository } from '../../repositories/account';

let accCtrl: any;

const testAcc = {
id: "test1",
customerNumber: "1234",
id: 'test1',
customerNumber: '1234',
balance: 1000,
branch: "Toronto",
type: "Chequing",
branch: 'Toronto',
type: 'Chequing',
avgBalance: 500,
minimumBalance: 0
};

const brokenAcc = {
customerNumber: "123456",
customerNumber: '123456',
balance: 1000,
branch: "Broke City",
type: "Chequing"
branch: 'Broke City',
type: 'Chequing'
};

describe("AccountController Unit Test Suite", () => {
describe('AccountController Unit Test Suite', () => {
before(createAccountController);

it("creates an account instance", async () => {
it('creates an account instance', async () => {
const result = await accCtrl.createAccount(testAcc);
expect(result).to.deepEqual(testAcc);
const getResult = await accCtrl.getAccount('{"where":{"id":"test1"}}');
const getResult = await accCtrl.getAccount('{'where':{'id':'test1'}}');
expect(getResult).to.not.be.empty();
expect(getResult).have.lengthOf(1);
expect(getResult[0]).to.deepEqual(testAcc);
});
it("should not create an invalid instance", async () => {
it('should not create an invalid instance', async () => {
try {
await accCtrl.createAccount(brokenAcc);
} catch (err) {
expect(err).to.not.be.empty();
}
});
it("should not accept invalid args", async () => {
it('should not accept invalid args', async () => {
try {
await accCtrl.getAccount("");
await accCtrl.getAccount('');
} catch (err) {
expect(err).to.not.be.empty();
}
});

it("updates an account instance", async () => {
const result = await accCtrl.updateAccount('{"id":"test1"}', {
it('updates an account instance', async () => {
const result = await accCtrl.updateAccount('{'id':'test1'}', {
balance: 2000
});
expect(result.count).to.be.equal(1);
const getResult = await accCtrl.getAccount('{"where":{"id":"test1"}}');
const getResult = await accCtrl.getAccount('{'where':{'id':'test1'}}');
expect(getResult).to.not.be.empty();
expect(getResult).have.lengthOf(1);
expect(getResult[0].id).to.be.equal(testAcc.id);
expect(getResult[0].toObject().balance).to.be.equal(2000);
});

it("deletes an account instance", async () => {
const result = await accCtrl.deleteAccount('{"id":"test1"}');
it('deletes an account instance', async () => {
const result = await accCtrl.deleteAccount('{'id':'test1'}');
expect(result.count).to.be.equal(1);
const getResult = await accCtrl.getAccount('{"where":{"id":"test1"}}');
const getResult = await accCtrl.getAccount('{'where':{'id':'test1'}}');
expect(getResult).to.be.empty();
});
});
Expand Down

0 comments on commit 19964a3

Please sign in to comment.