chore: code review comments

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-08-14 15:37:09 +02:00
parent 9eec064aaf
commit f1e9c08f97
9 changed files with 95 additions and 37 deletions
@@ -77,7 +77,7 @@ describe('NavItemBlueprint', () => {
const tester = createExtensionTester(extension);
expect(tester.data(NavItemBlueprint.dataRefs.target)).toEqual({
expect(tester.get(NavItemBlueprint.dataRefs.target)).toEqual({
title: 'TEST',
icon: MockIcon,
routeRef: mockRouteRef,
@@ -97,7 +97,7 @@ describe('NavItemBlueprint', () => {
config: { title: 'OVERRIDDEN' },
});
expect(tester.data(NavItemBlueprint.dataRefs.target)).toEqual({
expect(tester.get(NavItemBlueprint.dataRefs.target)).toEqual({
title: 'OVERRIDDEN',
icon: MockIcon,
routeRef: mockRouteRef,
@@ -64,7 +64,7 @@ describe('NavLogoBlueprint', () => {
const tester = createExtensionTester(extension);
expect(tester.data(NavLogoBlueprint.dataRefs.logoElements)).toEqual({
expect(tester.get(NavLogoBlueprint.dataRefs.logoElements)).toEqual({
logoFull,
logoIcon,
});
@@ -101,7 +101,7 @@ describe('PageBlueprint', () => {
// TODO(blam): test for the routePath output doesn't work, due to the the way the test harness works
// expect(tester.data(coreExtensionData.routePath)).toBe('/test');
expect(tester.data(coreExtensionData.routeRef)).toBe(mockRouteRef);
expect(tester.get(coreExtensionData.routeRef)).toBe(mockRouteRef);
const { getByTestId } = tester.render();
@@ -147,7 +147,7 @@ describe('PageBlueprint', () => {
CardBlueprint.make({ name: 'card', params: {} }),
);
const { getByTestId, getByText } = renderInTestApp(tester.element());
const { getByTestId, getByText } = renderInTestApp(tester.reactElement());
await waitFor(() => expect(getByTestId('card')).toBeInTheDocument());
await waitFor(() =>
@@ -62,7 +62,7 @@ describe('SignInPageBlueprint', () => {
const tester = createExtensionTester(extension);
const Element = tester.data(SignInPageBlueprint.dataRefs.component)!;
const Element = tester.get(SignInPageBlueprint.dataRefs.component)!;
expect(Element).toBeDefined();
@@ -56,7 +56,7 @@ describe('ThemeBlueprint', () => {
const extension = ThemeBlueprint.make({ params: { theme } });
expect(
createExtensionTester(extension).data(ThemeBlueprint.dataRefs.theme),
createExtensionTester(extension).get(ThemeBlueprint.dataRefs.theme),
).toEqual(theme);
});
});
@@ -76,7 +76,7 @@ describe('TranslationBlueprint', () => {
});
expect(
createExtensionTester(extension).data(
createExtensionTester(extension).get(
TranslationBlueprint.dataRefs.translation,
),
).toBe(messages);
@@ -688,7 +688,7 @@ describe('createExtension', () => {
const tester = createExtensionTester(overridden);
expect(tester.data(numberDataRef)).toBe(43);
expect(tester.get(numberDataRef)).toBe(43);
});
it('should work functionally with overrides', () => {
@@ -722,14 +722,14 @@ describe('createExtension', () => {
},
});
expect(createExtensionTester(overriden).data(stringDataRef)).toBe(
expect(createExtensionTester(overriden).get(stringDataRef)).toBe(
'foo-boom-override-hello',
);
expect(
createExtensionTester(overriden, {
config: { foo: 'hello', bar: 'world' },
}).data(stringDataRef),
}).get(stringDataRef),
).toBe('foo-hello-override-world');
});
@@ -809,7 +809,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'orig-opt',
single: 'orig-single',
@@ -836,7 +836,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'opt',
single: 'single',
@@ -862,7 +862,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'none',
single: 'single',
@@ -885,7 +885,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'orig-opt',
single: 'orig-single',
@@ -912,7 +912,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'orig-opt',
single: 'orig-single',
@@ -939,7 +939,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'orig-opt',
single: 'orig-single',
@@ -966,7 +966,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'orig-opt',
single: 'orig-single',
@@ -997,7 +997,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toEqual({
opt: 'none',
single: 'override-orig-single',
@@ -1023,7 +1023,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toThrowErrorMatchingInlineSnapshot(
`"Failed to instantiate extension 'subject', override data provided for input 'multi' must match the length of the original inputs"`,
);
@@ -1046,7 +1046,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toThrowErrorMatchingInlineSnapshot(
`"Failed to instantiate extension 'subject', override data for input 'multi' may not mix forwarded inputs with data overrides"`,
);
@@ -1069,7 +1069,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toThrowErrorMatchingInlineSnapshot(
`"Failed to instantiate extension 'subject', missing required extension data value(s) 'test1'"`,
);
@@ -1098,7 +1098,7 @@ describe('createExtension', () => {
.add(singleExt)
.add(multi1Ext)
.add(multi2Ext)
.data(outputRef),
.get(outputRef),
).toThrowErrorMatchingInlineSnapshot(
`"Failed to instantiate extension 'subject', extension data 'test2' was provided but not declared"`,
);