Skip to content

Commit

Permalink
fix snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiago Bustamante committed Mar 12, 2020
1 parent 4708969 commit 3b8e33e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/unit/container/container-namespaces.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('ContainerNamespaces', () => {
const constructor = InjectorHandler.getConstructorFromType(MyType);
const config = new IoCBindConfig(constructor, jest.fn(), jest.fn());
namespaces.set(constructor, config);
expect(namespaces.get(constructor, true)).toEqual(config);
expect(namespaces.get(constructor)).toEqual(config);
});

it('should retrieve a bindConfig for the current namespace', () => {
Expand All @@ -27,9 +27,9 @@ describe('ContainerNamespaces', () => {
const namespaceName = 'newNamespace';
namespaces.selectNamespace(namespaceName);
namespaces.set(constructor, config);
expect(namespaces.get(constructor, true)).toEqual(config);
expect(namespaces.get(constructor)).toEqual(config);
namespaces.removeNamespace(namespaceName);
expect(namespaces.get(constructor, true)).toBeUndefined();
expect(namespaces.get(constructor)).toBeUndefined();
});

it('should retrieve a bindConfig from default namespace if does not exist in the current namespace', () => {
Expand All @@ -39,37 +39,37 @@ describe('ContainerNamespaces', () => {
const namespaceName = 'newNamespace';
namespaces.set(constructor, config);
namespaces.selectNamespace(namespaceName);
expect(namespaces.get(constructor, true)).toEqual(config);
expect(namespaces.get(constructor)).toEqual(config);
namespaces.removeNamespace(namespaceName);
expect(namespaces.get(constructor, true)).toEqual(config);
expect(namespaces.get(constructor)).toEqual(config);
});
});

describe('getValue()', () => {
it('should retrieve a bindConfig for the default namespace', () => {
const config = new IoCBindValueConfig('my-config');
namespaces.setValue(config.name, config);
expect(namespaces.getValue(config.name, true)).toEqual(config);
expect(namespaces.getValue(config.name)).toEqual(config);
});

it('should retrieve a bindConfig for the current namespace', () => {
const config = new IoCBindValueConfig('my-config');
const namespaceName = 'newNamespace';
namespaces.selectNamespace(namespaceName);
namespaces.setValue(config.name, config);
expect(namespaces.getValue(config.name, true)).toEqual(config);
expect(namespaces.getValue(config.name)).toEqual(config);
namespaces.removeNamespace(namespaceName);
expect(namespaces.getValue(config.name, true)).toBeUndefined();
expect(namespaces.getValue(config.name)).toBeUndefined();
});

it('should retrieve a bindConfig from default namespace if does not exist in the current namespace', () => {
const config = new IoCBindValueConfig('my-config');
const namespaceName = 'newNamespace';
namespaces.setValue(config.name, config);
namespaces.selectNamespace(namespaceName);
expect(namespaces.getValue(config.name, true)).toEqual(config);
expect(namespaces.getValue(config.name)).toEqual(config);
namespaces.removeNamespace(namespaceName);
expect(namespaces.getValue(config.name, true)).toEqual(config);
expect(namespaces.getValue(config.name)).toEqual(config);
});
});

Expand All @@ -79,11 +79,11 @@ describe('ContainerNamespaces', () => {
const namespaceName = 'newNamespace';
namespaces.selectNamespace(namespaceName);
namespaces.setValue(config.name, config);
expect(namespaces.getValue(config.name, true)).toEqual(config);
expect(namespaces.getValue(config.name)).toEqual(config);
namespaces.selectNamespace(null);
expect(namespaces.getValue(config.name, true)).toBeUndefined();
expect(namespaces.getValue(config.name)).toBeUndefined();
namespaces.selectNamespace(namespaceName);
expect(namespaces.getValue(config.name, true)).toEqual(config);
expect(namespaces.getValue(config.name)).toEqual(config);
});
});

Expand Down

0 comments on commit 3b8e33e

Please sign in to comment.