Move tests to their own describe block (#3447)

This commit is contained in:
Shefali Joshi 2020-10-09 14:29:52 -07:00 committed by GitHub
parent f3d593bc1e
commit c756adad6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,11 +30,9 @@ describe("The Object API", () => {
beforeEach(() => {
mockProvider = jasmine.createSpyObj("mock provider", [
"create",
"update",
"get"
"update"
]);
mockProvider.create.and.returnValue(Promise.resolve(true));
mockProvider.get.and.returnValue(Promise.resolve(mockDomainObject));
objectAPI.addProvider(TEST_NAMESPACE, mockProvider);
});
it("Calls 'create' on provider if object is new", () => {
@ -59,6 +57,19 @@ describe("The Object API", () => {
expect(mockProvider.create).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", () => {
expect(mockProvider.get.calls.count()).toBe(0);