|
2 | 2 | * Copyright Strimzi authors.
|
3 | 3 | * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
|
4 | 4 | */
|
5 |
| -import expectationsBasic from "./mock/expectations-basic"; |
6 |
| -import expectationsMissingMutation from "./mock/expectations-missing-mutation"; |
7 |
| -import introspectionBasic from "./mock/mock-introspection"; |
| 5 | +import expectationsBasic from './mock/expectations-basic'; |
| 6 | +import expectationsMissingMutation from './mock/expectations-missing-mutation'; |
| 7 | +import introspectionBasic from './mock/mock-introspection'; |
8 | 8 | import expectionsEmptyTopic from './mock/expectations-empty-topic';
|
9 |
| -import expectationsMissingType from "./mock/expectations-missing-type" |
10 |
| -import introspectionMissingMutation from "./mock/mock-introspection-missing-mutation-type" |
11 |
| -import introspectionUnsupportedFieldType from "./mock/mock-introspection-unsupported-field-type"; |
12 |
| -import introspectionUnindexable from "./mock/mock-introspection-unindexable"; |
13 |
| -import introspectionMissingMutationBlock from "./mock/mock-introspection-missing-mutation-block"; |
14 |
| -import introspectionWrongTypeOnTopic from "./mock/mock-introspection-wrong-type-on-topic"; |
15 |
| -import introspectionWrongTypeOnMutationBlock from "./mock/mock-introspection-wrong-type-on-mutation-block"; |
16 |
| -import {introspect} from "./Introspection"; |
17 |
| -import {entitiesBasic} from "./mock/mock-entities"; |
18 |
| - |
19 |
| -describe("Basic Introspection", () => { |
20 |
| - it("should match", () => |
21 |
| - { |
22 |
| - const introspected = introspect(expectationsBasic, introspectionBasic); |
23 |
| - expect(introspected).toEqual(entitiesBasic); |
24 |
| - }); |
| 9 | +import expectationsMissingType from './mock/expectations-missing-type'; |
| 10 | +import introspectionMissingMutation from './mock/mock-introspection-missing-mutation-type'; |
| 11 | +import introspectionUnsupportedFieldType from './mock/mock-introspection-unsupported-field-type'; |
| 12 | +import introspectionUnindexable from './mock/mock-introspection-unindexable'; |
| 13 | +import introspectionMissingMutationBlock from './mock/mock-introspection-missing-mutation-block'; |
| 14 | +import introspectionWrongTypeOnTopic from './mock/mock-introspection-wrong-type-on-topic'; |
| 15 | +import introspectionWrongTypeOnMutationBlock from './mock/mock-introspection-wrong-type-on-mutation-block'; |
| 16 | +import { introspect } from './Introspection'; |
| 17 | +import { entitiesBasic } from './mock/mock-entities'; |
| 18 | + |
| 19 | +describe('Basic Introspection', () => { |
| 20 | + it('should match', () => { |
| 21 | + const introspected = introspect(expectationsBasic, introspectionBasic); |
| 22 | + expect(introspected).toEqual(entitiesBasic); |
| 23 | + }); |
25 | 24 | });
|
26 | 25 |
|
27 |
| -describe("Missing Type", () => { |
28 |
| - it("should error", () => |
29 |
| - { |
30 |
| - expect(() => {introspect(expectationsMissingType, introspectionBasic)}).toThrowError("Unable to find a type for Foo"); |
31 |
| - |
32 |
| - }); |
| 26 | +describe('Missing Type', () => { |
| 27 | + it('should error', () => { |
| 28 | + expect(() => { |
| 29 | + introspect(expectationsMissingType, introspectionBasic); |
| 30 | + }).toThrowError('Unable to find a type for Foo'); |
| 31 | + }); |
33 | 32 | });
|
34 | 33 |
|
35 |
| -describe("Missing Mutation Type", () => { |
36 |
| - it("should error", () => |
37 |
| - { |
38 |
| - expect(() => {introspect(expectationsMissingMutation, introspectionMissingMutation)}).toThrowError("mutations is empty"); |
39 |
| - |
40 |
| - }); |
| 34 | +describe('Missing Mutation Type', () => { |
| 35 | + it('should error', () => { |
| 36 | + expect(() => { |
| 37 | + introspect(expectationsMissingMutation, introspectionMissingMutation); |
| 38 | + }).toThrowError('mutations is empty'); |
| 39 | + }); |
41 | 40 | });
|
42 | 41 |
|
43 |
| -describe("Unsupported Field Type", () => { |
44 |
| - it("should error", () => |
45 |
| - { |
46 |
| - expect(() => {introspect(expectationsBasic, introspectionUnsupportedFieldType)}).toThrowError("Unsupported graphql kind UNION for String"); |
47 |
| - |
48 |
| - }); |
| 42 | +describe('Unsupported Field Type', () => { |
| 43 | + it('should error', () => { |
| 44 | + expect(() => { |
| 45 | + introspect(expectationsBasic, introspectionUnsupportedFieldType); |
| 46 | + }).toThrowError('Unsupported graphql kind UNION for String'); |
| 47 | + }); |
49 | 48 | });
|
50 | 49 |
|
51 |
| -describe("Unindexable types", () => { |
52 |
| - it("should error", () => |
53 |
| - { |
54 |
| - expect(() => {introspect(expectationsBasic, introspectionUnindexable)}).toThrowError("key identified by name must be of type string"); |
55 |
| - |
56 |
| - }); |
| 50 | +describe('Unindexable types', () => { |
| 51 | + it('should error', () => { |
| 52 | + expect(() => { |
| 53 | + introspect(expectationsBasic, introspectionUnindexable); |
| 54 | + }).toThrowError('key identified by name must be of type string'); |
| 55 | + }); |
57 | 56 | });
|
58 | 57 |
|
59 |
| -describe("Missing mutation block", () => { |
60 |
| - it("should error", () => |
61 |
| - { |
62 |
| - expect(() => {introspect(expectationsBasic, introspectionMissingMutationBlock)}).toThrowError("Unable to find a type for Mutation"); |
63 |
| - |
64 |
| - }); |
| 58 | +describe('Missing mutation block', () => { |
| 59 | + it('should error', () => { |
| 60 | + expect(() => { |
| 61 | + introspect(expectationsBasic, introspectionMissingMutationBlock); |
| 62 | + }).toThrowError('Unable to find a type for Mutation'); |
| 63 | + }); |
65 | 64 | });
|
66 | 65 |
|
67 |
| -describe("Wrong type on mutation block", () => { |
68 |
| - it("should error", () => |
69 |
| - { |
70 |
| - expect(() => {introspect(expectationsMissingMutation, introspectionWrongTypeOnMutationBlock)}).toThrowError("mutations is empty"); |
71 |
| - |
72 |
| - }); |
| 66 | +describe('Wrong type on mutation block', () => { |
| 67 | + it('should error', () => { |
| 68 | + expect(() => { |
| 69 | + introspect( |
| 70 | + expectationsMissingMutation, |
| 71 | + introspectionWrongTypeOnMutationBlock |
| 72 | + ); |
| 73 | + }).toThrowError('mutations is empty'); |
| 74 | + }); |
73 | 75 | });
|
74 | 76 |
|
75 |
| -describe("Non object type", () => { |
76 |
| - it("should error", () => |
77 |
| - { |
78 |
| - const introspected = introspect(expectionsEmptyTopic, introspectionWrongTypeOnTopic); |
79 |
| - expect(introspected); |
80 |
| - |
81 |
| - }); |
| 77 | +describe('Non object type', () => { |
| 78 | + it('should error', () => { |
| 79 | + const introspected = introspect( |
| 80 | + expectionsEmptyTopic, |
| 81 | + introspectionWrongTypeOnTopic |
| 82 | + ); |
| 83 | + expect(introspected); |
| 84 | + }); |
82 | 85 | });
|
83 |
| - |
|
0 commit comments