* fix: remove circular dependency redux depended on templates/Challenges/redux and vice versa. This meant that import order mattered and confusing bugs could arise. (cherry picked from commit 7d67a4e70922bbb3051f2f9982dcc69e240d43dc) * feat: require imports to be in alphabetical order Import order generally does not matter, but there are edge cases (circular imports and css imports, for example) where changing order changes behaviour (cherry picked from commit b8d1393a91ec6e068caf8e8498a5c95df68c2b2c) * chore: order imports * fix: lift up challenge description + title comps This brings the classic Show closer to the others as they now all create the description and title components * fix: remove donation-saga/index circular import (cherry picked from commit 51a44ca668a700786d2744feffeae4fdba5fd207) * refactor: extract action-types from settings (cherry picked from commit 25e26124d691c84a0d0827d41dafb761c686fadd) * fix: lint errors * feat: prevent useless renames
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
const idNode = require('./__fixtures__/id-node.json');
|
|
const imageNode = require('./__fixtures__/image-node.json');
|
|
const multipleChildrenNode = require('./__fixtures__/multiple-children.json');
|
|
const nonIdNode = require('./__fixtures__/non-id-node.json');
|
|
const getId = require('./get-id');
|
|
|
|
describe('get-id', () => {
|
|
it('should return a string', () => {
|
|
expect.assertions(1);
|
|
const actual = getId(idNode);
|
|
expect(typeof actual).toBe('string');
|
|
});
|
|
|
|
it('should get the expected identifier', () => {
|
|
expect.assertions(1);
|
|
const actual = getId(idNode);
|
|
expect(actual).toBe('html-key');
|
|
});
|
|
|
|
it('should return null if the node does contain an id', () => {
|
|
expect.assertions(1);
|
|
const actual = getId(nonIdNode);
|
|
expect(actual).toBeNull();
|
|
});
|
|
|
|
// TODO: bin this (and the json!) after development (it'll be a silly test
|
|
// once we're using directives)
|
|
it('should ignore image nodes', () => {
|
|
expect.assertions(1);
|
|
const actual = getId(imageNode);
|
|
expect(actual).toBeNull();
|
|
});
|
|
|
|
// TODO: bin this (and the json!) after development (it'll be a silly test
|
|
// once we're using directives)
|
|
|
|
// TODO: do we want to fail silently? Might it be better to output warnings
|
|
// or perhaps even stop the parser? Probably warnings if anything.
|
|
it('should ignore paragraphs that contain more than the id element', () => {
|
|
expect.assertions(1);
|
|
const actual = getId(multipleChildrenNode);
|
|
expect(actual).toBeNull();
|
|
});
|
|
});
|