Skip to content

Commit 26c2a07

Browse files
authored
Merge pull request #235 from echolocation/master
add support for async RSAA properties
2 parents 31c41f2 + 775366b commit 26c2a07

File tree

3 files changed

+477
-4
lines changed

3 files changed

+477
-4
lines changed

src/__snapshots__/middleware.test.js.snap

Lines changed: 366 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,372 @@ exports[`#apiMiddleware must use an [RSAA].options function when present: option
16511651
}
16521652
`;
16531653
1654+
exports[`#apiMiddleware must use an async [RSAA].body function when present: body() 1`] = `
1655+
[MockFunction] {
1656+
"calls": Array [
1657+
Array [
1658+
undefined,
1659+
],
1660+
],
1661+
"results": Array [
1662+
Object {
1663+
"isThrow": false,
1664+
"value": Promise {},
1665+
},
1666+
],
1667+
}
1668+
`;
1669+
1670+
exports[`#apiMiddleware must use an async [RSAA].body function when present: fetch mock 1`] = `
1671+
Object {
1672+
"calls": Array [
1673+
Array [
1674+
"http://127.0.0.1/api/users/1",
1675+
Object {
1676+
"body": "mockBody",
1677+
"credentials": undefined,
1678+
"headers": Object {},
1679+
"method": "GET",
1680+
},
1681+
],
1682+
],
1683+
"instances": Array [
1684+
undefined,
1685+
],
1686+
"invocationCallOrder": Any<Object>,
1687+
"results": Array [
1688+
Object {
1689+
"isThrow": false,
1690+
"value": Promise {},
1691+
},
1692+
],
1693+
}
1694+
`;
1695+
1696+
exports[`#apiMiddleware must use an async [RSAA].body function when present: final result 1`] = `
1697+
Object {
1698+
"meta": undefined,
1699+
"payload": Object {
1700+
"data": "12345",
1701+
},
1702+
"type": "SUCCESS",
1703+
}
1704+
`;
1705+
1706+
exports[`#apiMiddleware must use an async [RSAA].body function when present: next mock 1`] = `
1707+
[MockFunction] {
1708+
"calls": Array [
1709+
Array [
1710+
Object {
1711+
"type": "REQUEST",
1712+
},
1713+
],
1714+
Array [
1715+
Object {
1716+
"meta": undefined,
1717+
"payload": Object {
1718+
"data": "12345",
1719+
},
1720+
"type": "SUCCESS",
1721+
},
1722+
],
1723+
],
1724+
"results": Array [
1725+
Object {
1726+
"isThrow": false,
1727+
"value": Object {
1728+
"type": "REQUEST",
1729+
},
1730+
},
1731+
Object {
1732+
"isThrow": false,
1733+
"value": Object {
1734+
"meta": undefined,
1735+
"payload": Object {
1736+
"data": "12345",
1737+
},
1738+
"type": "SUCCESS",
1739+
},
1740+
},
1741+
],
1742+
}
1743+
`;
1744+
1745+
exports[`#apiMiddleware must use an async [RSAA].endpoint function when present: endpoint() 1`] = `
1746+
[MockFunction] {
1747+
"calls": Array [
1748+
Array [
1749+
undefined,
1750+
],
1751+
],
1752+
"results": Array [
1753+
Object {
1754+
"isThrow": false,
1755+
"value": Promise {},
1756+
},
1757+
],
1758+
}
1759+
`;
1760+
1761+
exports[`#apiMiddleware must use an async [RSAA].endpoint function when present: fetch mock 1`] = `
1762+
Object {
1763+
"calls": Array [
1764+
Array [
1765+
"http://127.0.0.1/api/users/1",
1766+
Object {
1767+
"body": undefined,
1768+
"credentials": undefined,
1769+
"headers": Object {},
1770+
"method": "GET",
1771+
},
1772+
],
1773+
],
1774+
"instances": Array [
1775+
undefined,
1776+
],
1777+
"invocationCallOrder": Any<Object>,
1778+
"results": Array [
1779+
Object {
1780+
"isThrow": false,
1781+
"value": Promise {},
1782+
},
1783+
],
1784+
}
1785+
`;
1786+
1787+
exports[`#apiMiddleware must use an async [RSAA].endpoint function when present: final result 1`] = `
1788+
Object {
1789+
"meta": undefined,
1790+
"payload": Object {
1791+
"data": "12345",
1792+
},
1793+
"type": "SUCCESS",
1794+
}
1795+
`;
1796+
1797+
exports[`#apiMiddleware must use an async [RSAA].endpoint function when present: next mock 1`] = `
1798+
[MockFunction] {
1799+
"calls": Array [
1800+
Array [
1801+
Object {
1802+
"type": "REQUEST",
1803+
},
1804+
],
1805+
Array [
1806+
Object {
1807+
"meta": undefined,
1808+
"payload": Object {
1809+
"data": "12345",
1810+
},
1811+
"type": "SUCCESS",
1812+
},
1813+
],
1814+
],
1815+
"results": Array [
1816+
Object {
1817+
"isThrow": false,
1818+
"value": Object {
1819+
"type": "REQUEST",
1820+
},
1821+
},
1822+
Object {
1823+
"isThrow": false,
1824+
"value": Object {
1825+
"meta": undefined,
1826+
"payload": Object {
1827+
"data": "12345",
1828+
},
1829+
"type": "SUCCESS",
1830+
},
1831+
},
1832+
],
1833+
}
1834+
`;
1835+
1836+
exports[`#apiMiddleware must use an async [RSAA].headers function when present: fetch mock 1`] = `
1837+
Object {
1838+
"calls": Array [
1839+
Array [
1840+
"http://127.0.0.1/api/users/1",
1841+
Object {
1842+
"body": undefined,
1843+
"credentials": undefined,
1844+
"headers": Object {
1845+
"Test-Header": "test",
1846+
},
1847+
"method": "GET",
1848+
},
1849+
],
1850+
],
1851+
"instances": Array [
1852+
undefined,
1853+
],
1854+
"invocationCallOrder": Any<Object>,
1855+
"results": Array [
1856+
Object {
1857+
"isThrow": false,
1858+
"value": Promise {},
1859+
},
1860+
],
1861+
}
1862+
`;
1863+
1864+
exports[`#apiMiddleware must use an async [RSAA].headers function when present: final result 1`] = `
1865+
Object {
1866+
"meta": undefined,
1867+
"payload": Object {
1868+
"data": "12345",
1869+
},
1870+
"type": "SUCCESS",
1871+
}
1872+
`;
1873+
1874+
exports[`#apiMiddleware must use an async [RSAA].headers function when present: headers() 1`] = `
1875+
[MockFunction] {
1876+
"calls": Array [
1877+
Array [
1878+
undefined,
1879+
],
1880+
],
1881+
"results": Array [
1882+
Object {
1883+
"isThrow": false,
1884+
"value": Promise {},
1885+
},
1886+
],
1887+
}
1888+
`;
1889+
1890+
exports[`#apiMiddleware must use an async [RSAA].headers function when present: next mock 1`] = `
1891+
[MockFunction] {
1892+
"calls": Array [
1893+
Array [
1894+
Object {
1895+
"type": "REQUEST",
1896+
},
1897+
],
1898+
Array [
1899+
Object {
1900+
"meta": undefined,
1901+
"payload": Object {
1902+
"data": "12345",
1903+
},
1904+
"type": "SUCCESS",
1905+
},
1906+
],
1907+
],
1908+
"results": Array [
1909+
Object {
1910+
"isThrow": false,
1911+
"value": Object {
1912+
"type": "REQUEST",
1913+
},
1914+
},
1915+
Object {
1916+
"isThrow": false,
1917+
"value": Object {
1918+
"meta": undefined,
1919+
"payload": Object {
1920+
"data": "12345",
1921+
},
1922+
"type": "SUCCESS",
1923+
},
1924+
},
1925+
],
1926+
}
1927+
`;
1928+
1929+
exports[`#apiMiddleware must use an async [RSAA].options function when present: fetch mock 1`] = `
1930+
Object {
1931+
"calls": Array [
1932+
Array [
1933+
"http://127.0.0.1/api/users/1",
1934+
Object {
1935+
"body": undefined,
1936+
"credentials": undefined,
1937+
"headers": Object {},
1938+
"method": "GET",
1939+
},
1940+
],
1941+
],
1942+
"instances": Array [
1943+
undefined,
1944+
],
1945+
"invocationCallOrder": Any<Object>,
1946+
"results": Array [
1947+
Object {
1948+
"isThrow": false,
1949+
"value": Promise {},
1950+
},
1951+
],
1952+
}
1953+
`;
1954+
1955+
exports[`#apiMiddleware must use an async [RSAA].options function when present: final result 1`] = `
1956+
Object {
1957+
"meta": undefined,
1958+
"payload": Object {
1959+
"data": "12345",
1960+
},
1961+
"type": "SUCCESS",
1962+
}
1963+
`;
1964+
1965+
exports[`#apiMiddleware must use an async [RSAA].options function when present: next mock 1`] = `
1966+
[MockFunction] {
1967+
"calls": Array [
1968+
Array [
1969+
Object {
1970+
"type": "REQUEST",
1971+
},
1972+
],
1973+
Array [
1974+
Object {
1975+
"meta": undefined,
1976+
"payload": Object {
1977+
"data": "12345",
1978+
},
1979+
"type": "SUCCESS",
1980+
},
1981+
],
1982+
],
1983+
"results": Array [
1984+
Object {
1985+
"isThrow": false,
1986+
"value": Object {
1987+
"type": "REQUEST",
1988+
},
1989+
},
1990+
Object {
1991+
"isThrow": false,
1992+
"value": Object {
1993+
"meta": undefined,
1994+
"payload": Object {
1995+
"data": "12345",
1996+
},
1997+
"type": "SUCCESS",
1998+
},
1999+
},
2000+
],
2001+
}
2002+
`;
2003+
2004+
exports[`#apiMiddleware must use an async [RSAA].options function when present: options() 1`] = `
2005+
[MockFunction] {
2006+
"calls": Array [
2007+
Array [
2008+
undefined,
2009+
],
2010+
],
2011+
"results": Array [
2012+
Object {
2013+
"isThrow": false,
2014+
"value": Promise {},
2015+
},
2016+
],
2017+
}
2018+
`;
2019+
16542020
exports[`#apiMiddleware must use meta property of request type descriptor when it is a function: fetch mock 1`] = `
16552021
Object {
16562022
"calls": Array [

0 commit comments

Comments
 (0)