mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 15:02:23 +00:00
Move tests to their own describe block (#3447)
This commit is contained in:
parent
f3d593bc1e
commit
c756adad6f
@ -30,11 +30,9 @@ describe("The Object API", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockProvider = jasmine.createSpyObj("mock provider", [
|
mockProvider = jasmine.createSpyObj("mock provider", [
|
||||||
"create",
|
"create",
|
||||||
"update",
|
"update"
|
||||||
"get"
|
|
||||||
]);
|
]);
|
||||||
mockProvider.create.and.returnValue(Promise.resolve(true));
|
mockProvider.create.and.returnValue(Promise.resolve(true));
|
||||||
mockProvider.get.and.returnValue(Promise.resolve(mockDomainObject));
|
|
||||||
objectAPI.addProvider(TEST_NAMESPACE, mockProvider);
|
objectAPI.addProvider(TEST_NAMESPACE, mockProvider);
|
||||||
});
|
});
|
||||||
it("Calls 'create' on provider if object is new", () => {
|
it("Calls 'create' on provider if object is new", () => {
|
||||||
@ -59,6 +57,19 @@ describe("The Object API", () => {
|
|||||||
expect(mockProvider.create).not.toHaveBeenCalled();
|
expect(mockProvider.create).not.toHaveBeenCalled();
|
||||||
expect(mockProvider.update).not.toHaveBeenCalled();
|
expect(mockProvider.update).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("The get function", () => {
|
||||||
|
describe("when a provider is available", () => {
|
||||||
|
let mockProvider;
|
||||||
|
beforeEach(() => {
|
||||||
|
mockProvider = jasmine.createSpyObj("mock provider", [
|
||||||
|
"get"
|
||||||
|
]);
|
||||||
|
mockProvider.get.and.returnValue(Promise.resolve(mockDomainObject));
|
||||||
|
objectAPI.addProvider(TEST_NAMESPACE, mockProvider);
|
||||||
|
});
|
||||||
|
|
||||||
it("Caches multiple requests for the same object", () => {
|
it("Caches multiple requests for the same object", () => {
|
||||||
expect(mockProvider.get.calls.count()).toBe(0);
|
expect(mockProvider.get.calls.count()).toBe(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user