altair-static 4.4.2 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs_1 = require("fs");
4
- const path_1 = require("path");
5
- const index_1 = require("./index");
6
- const getAltairHtml = require("./utils/get-altair-html");
7
- const translateRenderedStrToObj = (result) => {
8
- const resultObj = Function(`
9
- let __options;
10
- const AltairGraphQL = { init: (options) => { __options = options; } };
11
- ${result}
12
- return __options;`)();
13
- return resultObj;
14
- };
15
- describe('renderInitialOptions', () => {
16
- it('should return expected string', () => {
17
- const result = index_1.renderInitialOptions({
18
- baseURL: '/',
19
- initialQuery: `query {
20
- Hello
21
- }`,
22
- endpointURL: 'https://example.com/graphql',
23
- initialHeaders: {
24
- 'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4'
25
- },
26
- initialSettings: {
27
- theme: 'dark'
28
- }
29
- });
30
- expect(translateRenderedStrToObj(result)).toEqual({
31
- initialQuery: `query {
32
- Hello
33
- }`,
34
- endpointURL: 'https://example.com/graphql',
35
- initialHeaders: {
36
- 'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4'
37
- },
38
- initialSettings: {
39
- theme: 'dark'
40
- }
41
- });
42
- expect(result).toMatchSnapshot();
43
- });
44
- it('should render boolean values correctly', () => {
45
- const result = index_1.renderInitialOptions({
46
- preserveState: false,
47
- });
48
- expect(translateRenderedStrToObj(result)).toEqual({
49
- preserveState: false,
50
- });
51
- });
52
- });
53
- describe('renderAltair', () => {
54
- it('should return expected string', () => {
55
- getAltairHtml.default = jest.fn();
56
- getAltairHtml.default.mockReturnValue(fs_1.readFileSync(path_1.resolve(__dirname, 'index.html'), 'utf8'));
57
- expect(index_1.renderAltair({
58
- baseURL: '/',
59
- initialQuery: `query {
60
- Hello
61
- }`,
62
- endpointURL: 'https://example.com/graphql',
63
- initialVariables: '{ variable: 1 }'
64
- })).toMatchSnapshot();
65
- });
66
- });
67
- //# sourceMappingURL=index.test.js.map
@@ -1,2 +0,0 @@
1
- export default function getAltairHtml(): string;
2
- //# sourceMappingURL=get-altair-html.d.ts.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs_1 = require("fs");
4
- const path_1 = require("path");
5
- const get_dist_1 = require("./get-dist");
6
- function getAltairHtml() {
7
- return fs_1.readFileSync(path_1.resolve(get_dist_1.getDistDirectory(), 'index.html'), 'utf8');
8
- }
9
- exports.default = getAltairHtml;
10
- //# sourceMappingURL=get-altair-html.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * Returns the path to Altair assets, for resolving the assets when rendering Altair
3
- */
4
- export declare const getDistDirectory: () => string;
5
- //# sourceMappingURL=get-dist.d.ts.map
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDistDirectory = void 0;
4
- const path_1 = require("path");
5
- /**
6
- * Returns the path to Altair assets, for resolving the assets when rendering Altair
7
- */
8
- exports.getDistDirectory = () => path_1.resolve(__dirname, '../dist');
9
- //# sourceMappingURL=get-dist.js.map