diff --git a/test/assertions/to-satisfy.spec.js b/test/assertions/to-satisfy.spec.js
index 935edd4b..e30d5302 100644
--- a/test/assertions/to-satisfy.spec.js
+++ b/test/assertions/to-satisfy.spec.js
@@ -1074,6 +1074,72 @@ describe('"to satisfy" assertion', () => {
);
});
+ describe('XMLDocument', () => {
+ it('should compare XML element names case sensitively', () => {
+ expect(
+ () => {
+ expect(parseXmlDocument('').firstChild, 'to satisfy', {
+ name: 'foo'
+ });
+ },
+ 'to throw an error satisfying to equal snapshot',
+ expect.unindent`
+ expected to satisfy { name: 'foo' }
+
+
+ `
+ );
+ });
+
+ it('should compare XML element names case sensitively, even when the owner document lacks a contentType attribute', () => {
+ expect(
+ () => {
+ const document = parseXmlDocument('');
+ document.firstChild._ownerDocument = {
+ toString() {
+ return '[object XMLDocument]';
+ }
+ };
+ expect(document.firstChild, 'to satisfy', {
+ name: 'foo'
+ });
+ },
+ 'to throw an error satisfying to equal snapshot',
+ expect.unindent`
+ expected to satisfy { name: 'foo' }
+
+
+ `
+ );
+ });
+
+ describe('with an array as the value', () => {
+ it('should succeed with a text child', () => {
+ expect(
+ parseXmlDocument(
+ [
+ '',
+ '',
+ ' World',
+ ''
+ ].join('\n')
+ ),
+ 'queried for first',
+ 'hello',
+ 'to satisfy',
+ {
+ attributes: {
+ type: 'greeting'
+ },
+ children: ['World']
+ }
+ );
+ });
+ });
+ });
+
describe('when used with expect.it', () => {
it('succeeds if the given structure is present', () => {
expect(
diff --git a/test/index.spec.js b/test/index.spec.js
index 1ff43c5a..abe128d1 100644
--- a/test/index.spec.js
+++ b/test/index.spec.js
@@ -773,31 +773,6 @@ describe('unexpected-dom', () => {
});
}));
- describe('to satisfy', () => {
- describe('when comparing an array of children', () => {
- it('should succeed with a text child', () => {
- expect(
- [
- '',
- '',
- ' World',
- ''
- ].join('\n'),
- 'when parsed as XML',
- 'queried for first',
- 'hello',
- 'to satisfy',
- {
- attributes: {
- type: 'greeting'
- },
- children: ['World']
- }
- );
- });
- });
- });
-
describe('when the DOMParser global is available', () => {
const OriginalDOMParser = root.DOMParser;
@@ -913,44 +888,4 @@ describe('unexpected-dom', () => {
`
);
});
-
- it('should compare XML element names case sensitively', () => {
- expect(
- () => {
- expect(parseXmlDocument('').firstChild, 'to satisfy', {
- name: 'foo'
- });
- },
- 'to throw an error satisfying to equal snapshot',
- expect.unindent`
- expected to satisfy { name: 'foo' }
-
-
- `
- );
- });
-
- it('should compare XML element names case sensitively, even when the owner document lacks a contentType attribute', () => {
- expect(
- () => {
- const document = parseXmlDocument('');
- document.firstChild._ownerDocument = {
- toString() {
- return '[object XMLDocument]';
- }
- };
- expect(document.firstChild, 'to satisfy', {
- name: 'foo'
- });
- },
- 'to throw an error satisfying to equal snapshot',
- expect.unindent`
- expected to satisfy { name: 'foo' }
-
-
- `
- );
- });
});