Skip to content

Commit

Permalink
Merge branch 'more-test-fixes' into release/5.3.0
Browse files Browse the repository at this point in the history
Mergin in more test fixes
  • Loading branch information
jvigliotta committed Jan 21, 2025
2 parents 9023625 + eefc899 commit 49cc883
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/exportDataAction/ExportDataTaskSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ define([

describe('when invoked', () => {

beforeEach(async (done) => {
beforeEach(async () => {
await task.invoke();
done();
});

it('requests comprehensive telemetry for all objects', () => {
Expand Down
21 changes: 7 additions & 14 deletions src/persistence/test/MCWSPersistenceProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ describe('The MCWS Persistence Provider', () => {
);
});

it('provides a promise for available namespaces', async (done) => {
it('provides a promise for available namespaces', async () => {
const spaces = await mcwsPersistenceProvider.getPersistenceNamespaces();
expect(spaces).toEqual(persistenceNamespaces);
done();
});

// DO WE DELETE THIS TEST? I don't think we use this functionality anymore.
xit('provides a listing of namespaces when provided a namespace definition', async (done) => {
xit('provides a listing of namespaces when provided a namespace definition', async () => {
const namespaceTriples = [
{
Subject: '/test/namespace/a',
Expand Down Expand Up @@ -95,10 +94,9 @@ describe('The MCWS Persistence Provider', () => {

const objects = await mcwsPersistenceProvider.getNamespacesFromMCWS({ url: '/test/namespace' });
expect(objects).toEqual(namespaceTriples);
done();
});

it('allows objects to be created', async (done) => {
it('allows objects to be created', async () => {
mockOpaqueFile.create.and.returnValue(Promise.resolve(true));
const domainObject = {
identifier: {
Expand All @@ -114,10 +112,9 @@ describe('The MCWS Persistence Provider', () => {
.toHaveBeenCalledWith('testKey');
expect(mockOpaqueFile.create)
.toHaveBeenCalledWith({ someKey: 'some value' });
done();
});

it('allows objects to be read', async (done) => {
it('allows objects to be read', async () => {
const identifier = {
key: 'testKey',
namespace: 'testSpace'
Expand All @@ -139,10 +136,9 @@ describe('The MCWS Persistence Provider', () => {
.toHaveBeenCalledWith('testKey');
expect(mockOpaqueFile.read)
.toHaveBeenCalled();
done();
});

it('allows objects to be updated', async (done) => {
it('allows objects to be updated', async () => {
mockOpaqueFile.replace.and.returnValue(Promise.resolve(true));
const domainObject = {
identifier: {
Expand All @@ -160,11 +156,10 @@ describe('The MCWS Persistence Provider', () => {
.toHaveBeenCalledWith('testKey');
expect(mockOpaqueFile.replace)
.toHaveBeenCalledWith({ someKey: 'some value' });
done();
});

// We don't allow delete in the core API, so we don't need this test.
xit('allows objects to be deleted', async (done) => {
xit('allows objects to be deleted', async () => {
mockOpaqueFile.remove.and.returnValue(Promise.resolve(true));
await mcwsPersistenceProvider.delete({ key: 'testKey', namespace: 'testSpace' });

Expand All @@ -173,14 +168,12 @@ describe('The MCWS Persistence Provider', () => {
expect(mockNamespace.opaqueFile)
.toHaveBeenCalledWith('testKey');
expect(mockOpaqueFile.remove).toHaveBeenCalled();
done();
});

it('converts rejected promises to promises resolves to undefined', async (done) => {
it('converts rejected promises to promises resolves to undefined', async () => {
mockOpaqueFile.read.and.returnValue(Promise.reject('hello'));
const result = await mcwsPersistenceProvider.get({ key: 'testKey', namespace: 'testSpace' });

expect(result).toBeUndefined();
done();
});
});

0 comments on commit 49cc883

Please sign in to comment.