2021-07-12 19:25:37 +02:00
|
|
|
import "../fixtures";
|
|
|
|
|
2020-07-01 17:24:24 +02:00
|
|
|
import Account from "model/account";
|
|
|
|
import Photo from "model/photo";
|
|
|
|
|
2020-07-02 10:03:00 +02:00
|
|
|
let chai = require("chai/chai");
|
2020-07-01 17:24:24 +02:00
|
|
|
let assert = chai.assert;
|
|
|
|
|
|
|
|
describe("model/account", () => {
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get account defaults", () => {
|
|
|
|
const values = { ID: 5 };
|
|
|
|
const account = new Account(values);
|
|
|
|
const result = account.getDefaults();
|
|
|
|
assert.equal(result.ID, 0);
|
|
|
|
assert.equal(result.AccShare, true);
|
|
|
|
assert.equal(result.AccName, "");
|
|
|
|
});
|
2020-07-01 17:24:24 +02:00
|
|
|
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get account entity name", () => {
|
|
|
|
const values = { ID: 5, AccName: "Test Name" };
|
|
|
|
const account = new Account(values);
|
|
|
|
const result = account.getEntityName();
|
|
|
|
assert.equal(result, "Test Name");
|
|
|
|
});
|
2020-07-01 17:24:24 +02:00
|
|
|
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get account id", () => {
|
|
|
|
const values = { ID: 5, AccName: "Test Name" };
|
|
|
|
const account = new Account(values);
|
|
|
|
const result = account.getId();
|
|
|
|
assert.equal(result, 5);
|
|
|
|
});
|
2020-07-01 17:24:24 +02:00
|
|
|
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get folders", (done) => {
|
|
|
|
const values = { ID: 123, AccName: "Test Name" };
|
|
|
|
const account = new Account(values);
|
|
|
|
account
|
|
|
|
.Folders()
|
|
|
|
.then((response) => {
|
|
|
|
assert.equal(response.foo, "folders");
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
done(error);
|
|
|
|
});
|
|
|
|
});
|
2020-07-01 17:24:24 +02:00
|
|
|
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get share photos", (done) => {
|
|
|
|
const values = { ID: 123, AccName: "Test Name" };
|
|
|
|
const account = new Account(values);
|
|
|
|
const values1 = { ID: 5, Title: "Crazy Cat", UID: 789 };
|
|
|
|
const photo = new Photo(values1);
|
|
|
|
const values2 = { ID: 6, Title: "Crazy Cat 2", UID: 783 };
|
|
|
|
const photo2 = new Photo(values2);
|
|
|
|
const Photos = [photo, photo2];
|
|
|
|
account
|
|
|
|
.Share(Photos, "destination")
|
|
|
|
.then((response) => {
|
|
|
|
assert.equal(response.foo, "share");
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
done(error);
|
|
|
|
});
|
|
|
|
});
|
2020-07-01 17:24:24 +02:00
|
|
|
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get collection resource", () => {
|
|
|
|
const result = Account.getCollectionResource();
|
|
|
|
assert.equal(result, "accounts");
|
|
|
|
});
|
2020-07-01 17:24:24 +02:00
|
|
|
|
2021-07-12 19:25:37 +02:00
|
|
|
it("should get model name", () => {
|
|
|
|
const result = Account.getModelName();
|
|
|
|
assert.equal(result, "Account");
|
|
|
|
});
|
|
|
|
});
|